diff options
author | Vitaly Takmazov | 2018-03-21 15:39:19 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-21 15:39:19 +0300 |
commit | 77c7232a3ca354e009dfdd5a5eb0d390d7e627f5 (patch) | |
tree | d4448088db7eaa24fd3ed73d74192135c2cd0e3b /juick-server/src/main/java/com | |
parent | 2fda6291ef2869d4f5f29afa92737d8f0f527a0e (diff) |
xmpp: do not post commands
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPBot.java | 17 |
1 files changed, 10 insertions, 7 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 29637032..c29fa188 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -337,13 +337,16 @@ public class XMPPBot implements StanzaListener, AutoCloseable { } Optional<String> result = processCommand(user_from, msg.getFrom(), command); - result.ifPresent(r -> sendReply(msg.getFrom(), r)); - // new message - List<Tag> tags = tagService.fromString(command, false); - String body = command.substring(TagUtils.toString(tags).length()); - int mid = messagesService.createMessage(user_from.getUid(), body, null, tags); - subscriptionService.subscribeMessage(mid, user_from.getUid()); - applicationEventPublisher.publishEvent(new MessageEvent(this, messagesService.getMessage(mid))); + if (result.isPresent()) { + sendReply(msg.getFrom(), result.get()); + } else { + // new message + List<Tag> tags = tagService.fromString(command, false); + String body = command.substring(TagUtils.toString(tags).length()); + int mid = messagesService.createMessage(user_from.getUid(), body, null, tags); + subscriptionService.subscribeMessage(mid, user_from.getUid()); + applicationEventPublisher.publishEvent(new MessageEvent(this, messagesService.getMessage(mid))); + } return true; } |