From bb2a47ea3c17f92c1d55d8b0d26cd26a880373d9 Mon Sep 17 00:00:00 2001 From: Anatoliy Sablin Date: Mon, 6 Nov 2017 16:54:00 +0300 Subject: Moved to message listener. --- juick-commands/build.gradle | 2 -- .../main/java/com/juick/command/BlacklistTag.java | 3 +-- .../main/java/com/juick/command/BlacklistUser.java | 3 +-- .../src/main/java/com/juick/command/Command.java | 3 +-- .../com/juick/command/CommandsConfiguration.java | 20 ++++++++++++++++++++ .../main/java/com/juick/command/DeleteMessage.java | 3 +-- .../java/com/juick/command/EditOrReplyMessage.java | 3 +-- .../main/java/com/juick/command/LastMessages.java | 3 +-- .../src/main/java/com/juick/command/Login.java | 3 +-- .../main/java/com/juick/command/MessageListener.java | 19 +++++++++++++++++++ .../java/com/juick/command/MultiArgsCommand.java | 5 ++--- .../src/main/java/com/juick/command/MyFeeds.java | 3 +-- .../src/main/java/com/juick/command/Ping.java | 3 +-- .../src/main/java/com/juick/command/PostMessage.java | 3 +-- .../main/java/com/juick/command/PrivateMessage.java | 12 ++++-------- .../src/main/java/com/juick/command/Processor.java | 9 ++++----- .../main/java/com/juick/command/Recommendations.java | 3 +-- .../main/java/com/juick/command/ShowBlacklist.java | 3 +-- .../main/java/com/juick/command/ShowFavorites.java | 3 +-- .../src/main/java/com/juick/command/ShowHelp.java | 3 +-- .../src/main/java/com/juick/command/ShowMessage.java | 3 +-- .../java/com/juick/command/ShowSubscriptions.java | 3 +-- .../src/main/java/com/juick/command/ShowTags.java | 3 +-- .../main/java/com/juick/command/ShowUserInfo.java | 3 +-- .../java/com/juick/command/SubscribeMessage.java | 3 +-- .../main/java/com/juick/command/SubscribeTag.java | 3 +-- .../main/java/com/juick/command/SubscribeUser.java | 3 +-- .../java/com/juick/command/ToggleSubscriptions.java | 3 +-- juick-server-web/build.gradle | 2 +- 29 files changed, 72 insertions(+), 63 deletions(-) create mode 100644 juick-commands/src/main/java/com/juick/command/CommandsConfiguration.java create mode 100644 juick-commands/src/main/java/com/juick/command/MessageListener.java diff --git a/juick-commands/build.gradle b/juick-commands/build.gradle index bfe85d98..c6dfff42 100644 --- a/juick-commands/build.gradle +++ b/juick-commands/build.gradle @@ -1,5 +1,3 @@ -version 'unspecified' - apply plugin: 'java' sourceCompatibility = 1.8 diff --git a/juick-commands/src/main/java/com/juick/command/BlacklistTag.java b/juick-commands/src/main/java/com/juick/command/BlacklistTag.java index 2ce455dc..8c84a2fe 100644 --- a/juick-commands/src/main/java/com/juick/command/BlacklistTag.java +++ b/juick-commands/src/main/java/com/juick/command/BlacklistTag.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.Tag; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.PrivacyQueriesService; import com.juick.service.TagService; import com.juick.service.UserService; @@ -43,7 +42,7 @@ public class BlacklistTag extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { User blUser = getUserService().getUserByName(arguments[0]); if (blUser != null) { Tag tag = getTagService().getTag(arguments[0], false); diff --git a/juick-commands/src/main/java/com/juick/command/BlacklistUser.java b/juick-commands/src/main/java/com/juick/command/BlacklistUser.java index f2682c6a..b138e816 100644 --- a/juick-commands/src/main/java/com/juick/command/BlacklistUser.java +++ b/juick-commands/src/main/java/com/juick/command/BlacklistUser.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.PrivacyQueriesService; import com.juick.service.UserService; import lombok.Getter; @@ -39,7 +38,7 @@ public class BlacklistUser extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { User blUser = getUserService().getUserByName(arguments[0]); if (blUser != null) { PrivacyQueriesService.PrivacyResult result = getPrivacyQueriesService().blacklistUser(sender, blUser); diff --git a/juick-commands/src/main/java/com/juick/command/Command.java b/juick-commands/src/main/java/com/juick/command/Command.java index 9a8775e5..57ae8ef7 100644 --- a/juick-commands/src/main/java/com/juick/command/Command.java +++ b/juick-commands/src/main/java/com/juick/command/Command.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import java.util.regex.Pattern; @@ -14,5 +13,5 @@ public interface Command { String help(); - String execute(User sender, ProtocolListener protocolListener, String command); + String execute(User sender, MessageListener protocolListener, String command); } diff --git a/juick-commands/src/main/java/com/juick/command/CommandsConfiguration.java b/juick-commands/src/main/java/com/juick/command/CommandsConfiguration.java new file mode 100644 index 00000000..b6b9ea0d --- /dev/null +++ b/juick-commands/src/main/java/com/juick/command/CommandsConfiguration.java @@ -0,0 +1,20 @@ +package com.juick.command; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +import java.util.Set; + +/** + * @author ma1uta + */ +@Configuration +@ComponentScan(basePackages = {"com.juick.command"}) +public class CommandsConfiguration { + + @Bean + public Processor processor(Set commands) { + return new Processor(commands); + } +} diff --git a/juick-commands/src/main/java/com/juick/command/DeleteMessage.java b/juick-commands/src/main/java/com/juick/command/DeleteMessage.java index ab46a28a..500e18b3 100644 --- a/juick-commands/src/main/java/com/juick/command/DeleteMessage.java +++ b/juick-commands/src/main/java/com/juick/command/DeleteMessage.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import lombok.Getter; import org.apache.commons.lang3.math.NumberUtils; @@ -37,7 +36,7 @@ public class DeleteMessage extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { int mid = NumberUtils.toInt(arguments[0], 0); if (getMessagesService().deleteMessage(sender.getUid(), mid)) { return String.format("Message %s deleted", mid); diff --git a/juick-commands/src/main/java/com/juick/command/EditOrReplyMessage.java b/juick-commands/src/main/java/com/juick/command/EditOrReplyMessage.java index 00ec4be9..e7fbf764 100644 --- a/juick-commands/src/main/java/com/juick/command/EditOrReplyMessage.java +++ b/juick-commands/src/main/java/com/juick/command/EditOrReplyMessage.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.Tag; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import com.juick.service.TagService; import lombok.Getter; @@ -45,7 +44,7 @@ public class EditOrReplyMessage extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { int mid = NumberUtils.toInt(arguments[1]); int rid = NumberUtils.toInt(arguments[4], 0); String txt = arguments[5]; diff --git a/juick-commands/src/main/java/com/juick/command/LastMessages.java b/juick-commands/src/main/java/com/juick/command/LastMessages.java index 77ba8a81..871348de 100644 --- a/juick-commands/src/main/java/com/juick/command/LastMessages.java +++ b/juick-commands/src/main/java/com/juick/command/LastMessages.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.User; import com.juick.formatters.PlainTextFormatter; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import lombok.Getter; import org.springframework.stereotype.Component; @@ -37,7 +36,7 @@ public class LastMessages implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { return "Last messages:\n" + getMessagesService().getMessages(getMessagesService().getAll(sender.getUid(), 0)).stream() .sorted(Collections.reverseOrder()) diff --git a/juick-commands/src/main/java/com/juick/command/Login.java b/juick-commands/src/main/java/com/juick/command/Login.java index 0dc6a021..3092a5f5 100644 --- a/juick-commands/src/main/java/com/juick/command/Login.java +++ b/juick-commands/src/main/java/com/juick/command/Login.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.UserService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -36,7 +35,7 @@ public class Login implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { return "http://juick.com/login?hash=" + getUserService().getHashByUID(sender.getUid()); } } diff --git a/juick-commands/src/main/java/com/juick/command/MessageListener.java b/juick-commands/src/main/java/com/juick/command/MessageListener.java new file mode 100644 index 00000000..54d2c7e7 --- /dev/null +++ b/juick-commands/src/main/java/com/juick/command/MessageListener.java @@ -0,0 +1,19 @@ +package com.juick.command; + +import com.juick.User; +import rocks.xmpp.core.stanza.model.Message; + +/** + * @author ma1uta + */ +public interface MessageListener { + + void sendStanza(Message message); + + void sendMessage(Message message); + + void messagePosted(com.juick.Message msg); + + void userSubscribed(User from, User to); + +} diff --git a/juick-commands/src/main/java/com/juick/command/MultiArgsCommand.java b/juick-commands/src/main/java/com/juick/command/MultiArgsCommand.java index 5fde6775..4d50bff0 100644 --- a/juick-commands/src/main/java/com/juick/command/MultiArgsCommand.java +++ b/juick-commands/src/main/java/com/juick/command/MultiArgsCommand.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import java.util.regex.Matcher; @@ -11,7 +10,7 @@ import java.util.regex.Matcher; public abstract class MultiArgsCommand implements Command { @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { Matcher matcher = pattern().matcher(command.trim()); String[] arguments = new String[matcher.groupCount()]; for (int i = 1; i <= matcher.groupCount(); i++) { @@ -20,5 +19,5 @@ public abstract class MultiArgsCommand implements Command { return execute(sender, protocolListener, arguments); } - protected abstract String execute(User sender, ProtocolListener protocolListener, String... arguments); + protected abstract String execute(User sender, MessageListener protocolListener, String... arguments); } diff --git a/juick-commands/src/main/java/com/juick/command/MyFeeds.java b/juick-commands/src/main/java/com/juick/command/MyFeeds.java index 5156e3c5..6a078cc9 100644 --- a/juick-commands/src/main/java/com/juick/command/MyFeeds.java +++ b/juick-commands/src/main/java/com/juick/command/MyFeeds.java @@ -3,7 +3,6 @@ package com.juick.command; import com.juick.Message; import com.juick.User; import com.juick.formatters.PlainTextFormatter; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +39,7 @@ public class MyFeeds extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { // number of # is the page count int page = arguments[0].length() - 1; List mids = getMessagesService().getMyFeed(sender.getUid(), page, false); diff --git a/juick-commands/src/main/java/com/juick/command/Ping.java b/juick-commands/src/main/java/com/juick/command/Ping.java index 7684af7a..6298abf5 100644 --- a/juick-commands/src/main/java/com/juick/command/Ping.java +++ b/juick-commands/src/main/java/com/juick/command/Ping.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import org.springframework.stereotype.Component; import java.util.regex.Pattern; @@ -25,7 +24,7 @@ public class Ping implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { return "PONG"; } } diff --git a/juick-commands/src/main/java/com/juick/command/PostMessage.java b/juick-commands/src/main/java/com/juick/command/PostMessage.java index 2ef5ce22..9dba3396 100644 --- a/juick-commands/src/main/java/com/juick/command/PostMessage.java +++ b/juick-commands/src/main/java/com/juick/command/PostMessage.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.Tag; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.server.util.TagUtils; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; @@ -47,7 +46,7 @@ public class PostMessage implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { List tags = getTagService().fromString(command, false); String body = command.substring(TagUtils.toString(tags).length()); int mid = getMessagesService().createMessage(sender.getUid(), body, null, tags); diff --git a/juick-commands/src/main/java/com/juick/command/PrivateMessage.java b/juick-commands/src/main/java/com/juick/command/PrivateMessage.java index 069bc367..6deaed45 100644 --- a/juick-commands/src/main/java/com/juick/command/PrivateMessage.java +++ b/juick-commands/src/main/java/com/juick/command/PrivateMessage.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.PMQueriesService; import com.juick.service.UserService; import lombok.Getter; @@ -46,7 +45,7 @@ public class PrivateMessage extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { String addressee = arguments[0]; String body = arguments[1]; int ret; @@ -80,12 +79,10 @@ public class PrivateMessage extends MultiArgsCommand { jmsg.setUser(sender); jmsg.setText(body); msg.addExtension(jmsg); - //TODO fix external dependency - //router.sendStanza(msg); + protocolListener.sendStanza(msg); msg.setTo(Jid.of(Integer.toString(addresseeUid), "ws.juick.com", null)); - //TODO fix external dependency - //router.sendStanza(msg); + protocolListener.sendStanza(msg); for (String userJid : jids_to) { Message mm = new Message(); @@ -99,8 +96,7 @@ public class PrivateMessage extends MultiArgsCommand { mm.setFrom(getJid()); mm.setBody("Private message from @" + sender.getName() + ":\n" + body); } - //TODO fix external dependency - //xmpp.sendOut(ClientMessage.from(mm)); + protocolListener.sendMessage(mm); } } diff --git a/juick-commands/src/main/java/com/juick/command/Processor.java b/juick-commands/src/main/java/com/juick/command/Processor.java index 60815d16..bf46a758 100644 --- a/juick-commands/src/main/java/com/juick/command/Processor.java +++ b/juick-commands/src/main/java/com/juick/command/Processor.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import lombok.Getter; import lombok.Setter; import org.slf4j.Logger; @@ -23,7 +22,7 @@ public class Processor { private final Set commands; @Setter - private ProtocolListener protocolListener; + private MessageListener messageListener; @Autowired public Processor(Set commands) { @@ -46,7 +45,7 @@ public class Processor { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Found command processor: {}", commandItem.getClass().getName()); } - return commandItem.execute(sender, getProtocolListener(), command); + return commandItem.execute(sender, getMessageListener(), command); } else { defaultCommand = commandItem; } @@ -56,9 +55,9 @@ public class Processor { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Found default command processor: {}", defaultCommand.getClass().getName()); } - return defaultCommand.execute(sender, getProtocolListener(), command); + return defaultCommand.execute(sender, getMessageListener(), command); } LOGGER.debug("Command processor not found, return help"); - return helpCommand != null ? helpCommand.execute(sender, getProtocolListener(), command) : "Help not found"; + return helpCommand != null ? helpCommand.execute(sender, getMessageListener(), command) : "Help not found"; } } diff --git a/juick-commands/src/main/java/com/juick/command/Recommendations.java b/juick-commands/src/main/java/com/juick/command/Recommendations.java index c7f38003..5bbdd878 100644 --- a/juick-commands/src/main/java/com/juick/command/Recommendations.java +++ b/juick-commands/src/main/java/com/juick/command/Recommendations.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.ShowQueriesService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +36,7 @@ public class Recommendations implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { StringBuilder msg = new StringBuilder(); msg.append("Recommended blogs"); List recommendedUsers = getShowQueriesService().getRecommendedUsers(sender); diff --git a/juick-commands/src/main/java/com/juick/command/ShowBlacklist.java b/juick-commands/src/main/java/com/juick/command/ShowBlacklist.java index bd4df7df..f56ff165 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowBlacklist.java +++ b/juick-commands/src/main/java/com/juick/command/ShowBlacklist.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.TagService; import com.juick.service.UserService; import lombok.Getter; @@ -40,7 +39,7 @@ public class ShowBlacklist implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { List blusers = getUserService().getUserBLUsers(sender.getUid()); List bltags = getTagService().getUserBLTags(sender.getUid()); diff --git a/juick-commands/src/main/java/com/juick/command/ShowFavorites.java b/juick-commands/src/main/java/com/juick/command/ShowFavorites.java index ced28936..144ed546 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowFavorites.java +++ b/juick-commands/src/main/java/com/juick/command/ShowFavorites.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.User; import com.juick.formatters.PlainTextFormatter; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +39,7 @@ public class ShowFavorites implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { List mids = getMessagesService().getUserRecommendations(sender.getUid(), 0); if (mids.size() > 0) { List messages = getMessagesService().getMessages(mids); diff --git a/juick-commands/src/main/java/com/juick/command/ShowHelp.java b/juick-commands/src/main/java/com/juick/command/ShowHelp.java index 78e01706..deea9c75 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowHelp.java +++ b/juick-commands/src/main/java/com/juick/command/ShowHelp.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import lombok.Getter; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; @@ -41,7 +40,7 @@ public class ShowHelp implements Command, ApplicationContextAware { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { return getHelp(); } diff --git a/juick-commands/src/main/java/com/juick/command/ShowMessage.java b/juick-commands/src/main/java/com/juick/command/ShowMessage.java index f50dfba9..741f98b9 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowMessage.java +++ b/juick-commands/src/main/java/com/juick/command/ShowMessage.java @@ -3,7 +3,6 @@ package com.juick.command; import com.juick.Message; import com.juick.User; import com.juick.formatters.PlainTextFormatter; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import lombok.Getter; import org.apache.commons.lang3.math.NumberUtils; @@ -41,7 +40,7 @@ public class ShowMessage extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { boolean showReplies = arguments[1].length() > 0; int mid = NumberUtils.toInt(arguments[0], 0); if (mid == 0) { diff --git a/juick-commands/src/main/java/com/juick/command/ShowSubscriptions.java b/juick-commands/src/main/java/com/juick/command/ShowSubscriptions.java index ad35a4c2..d4548c17 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowSubscriptions.java +++ b/juick-commands/src/main/java/com/juick/command/ShowSubscriptions.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.SubscriptionService; import com.juick.service.UserService; import lombok.Getter; @@ -39,7 +38,7 @@ public class ShowSubscriptions implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { List friends = getUserService().getUserFriends(sender.getUid()); List tags = getSubscriptionService().getSubscribedTags(sender); String msg = friends.size() > 0 ? "You are subscribed to users:" + friends.stream().map(u -> "\n@" + u.getName()) diff --git a/juick-commands/src/main/java/com/juick/command/ShowTags.java b/juick-commands/src/main/java/com/juick/command/ShowTags.java index 186919ad..40fa93e8 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowTags.java +++ b/juick-commands/src/main/java/com/juick/command/ShowTags.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.User; import com.juick.server.helpers.TagStats; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.TagService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +38,7 @@ public class ShowTags implements Command { } @Override - public String execute(User sender, ProtocolListener protocolListener, String command) { + public String execute(User sender, MessageListener protocolListener, String command) { List tags = getTagService().getUserTagStats(sender.getUid()); return "Your tags: (tag - messages)\n" + tags.stream() diff --git a/juick-commands/src/main/java/com/juick/command/ShowUserInfo.java b/juick-commands/src/main/java/com/juick/command/ShowUserInfo.java index 336b2e0d..53dd19e4 100644 --- a/juick-commands/src/main/java/com/juick/command/ShowUserInfo.java +++ b/juick-commands/src/main/java/com/juick/command/ShowUserInfo.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.User; import com.juick.formatters.PlainTextFormatter; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import com.juick.service.UserService; import lombok.Getter; @@ -40,7 +39,7 @@ public class ShowUserInfo extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { User blogUser = getUserService().getUserByName(arguments[0]); int page = arguments[1].length(); if (blogUser.getUid() > 0) { diff --git a/juick-commands/src/main/java/com/juick/command/SubscribeMessage.java b/juick-commands/src/main/java/com/juick/command/SubscribeMessage.java index 893c0b65..52d0713e 100644 --- a/juick-commands/src/main/java/com/juick/command/SubscribeMessage.java +++ b/juick-commands/src/main/java/com/juick/command/SubscribeMessage.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; import lombok.Getter; @@ -40,7 +39,7 @@ public class SubscribeMessage extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { boolean subscribe = arguments[0].equalsIgnoreCase("s"); int mid = NumberUtils.toInt(arguments[1], 0); if (getMessagesService().getMessage(mid) != null) { diff --git a/juick-commands/src/main/java/com/juick/command/SubscribeTag.java b/juick-commands/src/main/java/com/juick/command/SubscribeTag.java index ce9ebc20..8f74fc21 100644 --- a/juick-commands/src/main/java/com/juick/command/SubscribeTag.java +++ b/juick-commands/src/main/java/com/juick/command/SubscribeTag.java @@ -2,7 +2,6 @@ package com.juick.command; import com.juick.Tag; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.SubscriptionService; import com.juick.service.TagService; import lombok.Getter; @@ -40,7 +39,7 @@ public class SubscribeTag extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { boolean subscribe = arguments[0].equalsIgnoreCase("s"); Tag tag = getTagService().getTag(arguments[1], true); if (subscribe) { diff --git a/juick-commands/src/main/java/com/juick/command/SubscribeUser.java b/juick-commands/src/main/java/com/juick/command/SubscribeUser.java index f8204525..849a7c06 100644 --- a/juick-commands/src/main/java/com/juick/command/SubscribeUser.java +++ b/juick-commands/src/main/java/com/juick/command/SubscribeUser.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.SubscriptionService; import com.juick.service.UserService; import lombok.Getter; @@ -39,7 +38,7 @@ public class SubscribeUser extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { boolean subscribe = arguments[0].equalsIgnoreCase("s"); User toUser = getUserService().getUserByName(arguments[1]); if (toUser.getUid() > 0) { diff --git a/juick-commands/src/main/java/com/juick/command/ToggleSubscriptions.java b/juick-commands/src/main/java/com/juick/command/ToggleSubscriptions.java index 737565f9..8718d3bf 100644 --- a/juick-commands/src/main/java/com/juick/command/ToggleSubscriptions.java +++ b/juick-commands/src/main/java/com/juick/command/ToggleSubscriptions.java @@ -1,7 +1,6 @@ package com.juick.command; import com.juick.User; -import com.juick.server.protocol.ProtocolListener; import com.juick.service.UserService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; @@ -36,7 +35,7 @@ public class ToggleSubscriptions extends MultiArgsCommand { } @Override - protected String execute(User sender, ProtocolListener protocolListener, String... arguments) { + protected String execute(User sender, MessageListener protocolListener, String... arguments) { UserService.ActiveStatus newStatus; String retValUpdated; if (arguments[0].toLowerCase().equals("on")) { diff --git a/juick-server-web/build.gradle b/juick-server-web/build.gradle index b4163a27..ce761df8 100644 --- a/juick-server-web/build.gradle +++ b/juick-server-web/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'war' sourceCompatibility = 1.8 dependencies { - compile project(':juick-server-core') + compile project(':juick-commands') compile "com.fasterxml.jackson.core:jackson-core:${rootProject.jacksonVersion}" compile "com.fasterxml.jackson.core:jackson-databind:${rootProject.jacksonVersion}" compile "com.fasterxml.jackson.core:jackson-annotations:${rootProject.jacksonVersion}" -- cgit v1.2.3