diff options
-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; } |