diff options
author | Vitaly Takmazov | 2017-01-17 17:31:19 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-01-17 17:31:19 +0300 |
commit | ed993af2e0e95b9af8c949fc0a5c812e93731c14 (patch) | |
tree | 4f47adf8682b85c9a35ef54c000328d2596c63ca /juick-server/src/main/java/com/juick/server/protocol | |
parent | 2ab4bed9aa1d3142e95f6861871097626e5958c1 (diff) |
juick-server: messagePosted protocol event
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/protocol')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/protocol/ProtocolListener.java | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java index 19275b36..2597ddbc 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java +++ b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java @@ -88,6 +88,7 @@ public class JuickProtocol { String body = input.substring(TagUtils.toString(tags).length()); int mid = messagesService.createMessage(user.getUid(), body, null, tags); subscriptionService.subscribeMessage(mid, user.getUid()); + listener.messagePosted(messagesService.getMessage(mid)); return new ProtocolReply("New message posted.\n#" + mid + " " + baseUri + mid); } @@ -344,6 +345,7 @@ public class JuickProtocol { return new ProtocolReply("Tags are updated"); } else { int newrid = messagesService.createReply(mid, rid, user.getUid(), txt, null); + listener.messagePosted(messagesService.getReply(mid, newrid)); return new ProtocolReply("Reply posted.\n#" + mid + "/" + newrid + " " + baseUri + mid + "#" + newrid); } diff --git a/juick-server/src/main/java/com/juick/server/protocol/ProtocolListener.java b/juick-server/src/main/java/com/juick/server/protocol/ProtocolListener.java index 719520c7..11231e04 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/ProtocolListener.java +++ b/juick-server/src/main/java/com/juick/server/protocol/ProtocolListener.java @@ -1,5 +1,6 @@ package com.juick.server.protocol; +import com.juick.Message; import com.juick.User; /** @@ -8,4 +9,5 @@ import com.juick.User; public interface ProtocolListener { void privateMessage(User from, User to, String body); void userSubscribed(User from, User to); + void messagePosted(Message msg); } |