diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPConnection.java | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/juick-server/src/main/java/com/juick/server/XMPPConnection.java b/juick-server/src/main/java/com/juick/server/XMPPConnection.java index 59b33aba..0975611a 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java +++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java @@ -540,13 +540,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } Jid to = msg.getTo(); if (to.getDomain().equals(router.getDomain().toEscapedString()) || to.equals(this.jid)) { - User user_from; - if (msg.getFrom().getDomain().equals("uid.juick.com")) { - user_from = userService.getUserByUID(NumberUtils.toInt(msg.getFrom().getLocal(), - 0)).orElse(new User()); - } else { - user_from = userService.getUserByJID(msg.getFrom().asBareJid().toEscapedString()); - } + User user_from = userService.getUserByJID(msg.getFrom().asBareJid().toEscapedString()); if ((user_from == null || user_from.getUid() == 0) && !msg.getFrom().equals(jid)) { String signuphash = userService.getSignUpHashByJID(msg.getFrom().asBareJid().toEscapedString()); return makeReply(msg.getFrom(), "Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account."); @@ -554,19 +548,15 @@ public class XMPPConnection implements StanzaListener, NotificationListener { com.juick.Message jmsg = msg.getExtension(com.juick.Message.class); if (jmsg != null) { - if (to.getLocal().equals("pm")) { - applicationEventPublisher.publishEvent(new MessageEvent(this, jmsg, Collections.singletonList(jmsg.getTo()))); - } else { - if (MessageUtils.isReply(jmsg)) { - // to get quote and attachment - com.juick.Message original = messagesService.getMessage(jmsg.getMid()); - com.juick.Message reply = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); - applicationEventPublisher.publishEvent(new MessageEvent(this, reply, - subscriptionService.getUsersSubscribedToComments(original, reply))); - } else if (!MessageUtils.isPM(jmsg)) { - applicationEventPublisher.publishEvent(new MessageEvent(this, - messagesService.getMessage(jmsg.getMid()), subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg.getMid()))); - } + if (MessageUtils.isReply(jmsg)) { + // to get quote and attachment + com.juick.Message original = messagesService.getMessage(jmsg.getMid()); + com.juick.Message reply = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); + applicationEventPublisher.publishEvent(new MessageEvent(this, reply, + subscriptionService.getUsersSubscribedToComments(original, reply))); + } else if (!MessageUtils.isPM(jmsg)) { + applicationEventPublisher.publishEvent(new MessageEvent(this, + messagesService.getMessage(jmsg.getMid()), subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg.getMid()))); } } else { URI attachment = URI.create(StringUtils.EMPTY); |