From 8372395b016f2285a4c531f6cd8b766e60f25f64 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 29 Mar 2018 08:04:16 +0300 Subject: server: fix xmpp message processing --- juick-server/src/main/java/com/juick/server/XMPPBot.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/XMPPBot.java b/juick-server/src/main/java/com/juick/server/XMPPBot.java index 6805b733..e2c6cfac 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -317,11 +317,9 @@ public class XMPPBot implements StanzaListener, NotificationListener { @Override public void processMessageEvent(MessageEvent event) { com.juick.Message msg = event.getMessage(); - if (msg.getRid() == 0 && msg.getMid() > 0) { - String notify = "New message posted.\n#" + msg.getMid() + " https://juick.com/" + msg.getMid(); - userService.getJIDsbyUID(msg.getUser().getUid()) - .forEach(jid -> sendReply(Jid.of(jid), notify)); - } else if (msg.getTo() != null) { + boolean isPM = msg.getMid() == 0; + boolean isReply = msg.getRid() > 0; + if (isPM) { userService.getJIDsbyUID(msg.getTo().getUid()) .forEach(userJid -> { Message mm = new Message(); @@ -337,6 +335,10 @@ public class XMPPBot implements StanzaListener, NotificationListener { } xmpp.sendOut(ClientMessage.from(mm)); }); + } else if (!isReply) { + String notify = "New message posted.\n#" + msg.getMid() + " https://juick.com/" + msg.getMid(); + userService.getJIDsbyUID(msg.getUser().getUid()) + .forEach(jid -> sendReply(Jid.of(jid), notify)); } } -- cgit v1.2.3