From ed993af2e0e95b9af8c949fc0a5c812e93731c14 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 17 Jan 2017 17:31:19 +0300 Subject: juick-server: messagePosted protocol event --- juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java | 2 ++ .../src/main/java/com/juick/server/protocol/ProtocolListener.java | 2 ++ 2 files changed, 4 insertions(+) (limited to 'juick-server/src/main/java/com/juick/server') 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); } -- cgit v1.2.3