diff options
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 | 13 |
1 files changed, 13 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 be68fe62..06fbf2fc 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 @@ -198,6 +198,19 @@ public class JuickProtocol { return new ProtocolReply(msg); } + @UserCommand(pattern = "S", help = "S - Show your subscriptions") + public ProtocolReply commandSubscriptions(User currentUser, String... args) { + List<User> friends = userService.getUserFriends(currentUser.getUid()); + List<String> tags = subscriptionService.getSubscribedTags(currentUser); + String msg = friends.size() > 0 ? "You are subscribed to users:" + friends.stream().map(u -> "\n@" + u.getName()) + .collect(Collectors.joining()) + : "You are not subscribed to any user."; + msg += tags.size() > 0 ? "\nYou are subscribed to tags:" + tags.stream().map(t -> "\n*" + t) + .collect(Collectors.joining()) + : "\nYou are not subscribed to any tag."; + return new ProtocolReply(msg); + } + @UserCommand(pattern = "!", help = "! - Show your favorite messages") public ProtocolReply commandFavorites(User currentUser, String... args) { List<Integer> mids = messagesService.getUserRecommendations(currentUser.getUid(), 0); |