aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-29 08:04:16 +0300
committerGravatar Vitaly Takmazov2018-03-29 08:04:16 +0300
commit8372395b016f2285a4c531f6cd8b766e60f25f64 (patch)
tree837f94197b995103c7cde5cff4a975de8c095254 /juick-server/src
parenta0faa305739fdae086ee83a775423e91c90a4ffb (diff)
server: fix xmpp message processing
Diffstat (limited to 'juick-server/src')
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPBot.java12
1 files changed, 7 insertions, 5 deletions
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));
}
}