diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/XMPPBot.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPBot.java | 7 |
1 files changed, 7 insertions, 0 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 ac1c4121..9b6b5fe4 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -19,6 +19,8 @@ package com.juick.server; import com.juick.Tag; import com.juick.User; +import com.juick.server.component.LikeEvent; +import com.juick.server.component.SubscribeEvent; import com.juick.server.xmpp.s2s.StanzaListener; import com.juick.formatters.PlainTextFormatter; import com.juick.server.helpers.TagStats; @@ -31,6 +33,7 @@ import org.ocpsoft.prettytime.PrettyTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Component; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.stanza.model.*; @@ -79,6 +82,8 @@ public class XMPPBot implements StanzaListener, AutoCloseable { private PrivacyQueriesService privacyQueriesService; @Inject private SubscriptionService subscriptionService; + @Inject + private ApplicationEventPublisher applicationEventPublisher; @PostConstruct public void init() { @@ -529,6 +534,7 @@ public class XMPPBot implements StanzaListener, AutoCloseable { MessagesService.RecommendStatus status = messagesService.recommendMessage(mid, user.getUid()); switch (status) { case Added: + applicationEventPublisher.publishEvent(new LikeEvent(this, user, msg)); return "Message is added to your recommendations"; case Deleted: return "Message deleted from your recommendations."; @@ -546,6 +552,7 @@ public class XMPPBot implements StanzaListener, AutoCloseable { User toUser = userService.getUserByName(args[1]); if (subscribe) { if (subscriptionService.subscribeUser(user, toUser)) { + applicationEventPublisher.publishEvent(new SubscribeEvent(this, user, toUser)); return "Subscribed to @" + toUser.getName(); } } else { |