diff options
author | Vitaly Takmazov | 2018-01-30 12:33:05 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-01-30 12:33:05 +0300 |
commit | 5f5cfa9ee18d5d590404096ae9c55086e4b08304 (patch) | |
tree | 149c7ddf68402689deabcb13ddeaea4fd9c9174e /juick-xmpp/src/main/java/com | |
parent | 1eb4eedbde8b33bce4bb6f00342b8ea8f115fd12 (diff) |
xmpp: drop broken paging from user blog command, refactoring
Diffstat (limited to 'juick-xmpp/src/main/java/com')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/JuickBot.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java index bbe693a1..7a25f5d5 100644 --- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java +++ b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java @@ -524,11 +524,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { public String commandFavorites(User currentUser, Jid from, String... args) { List<Integer> mids = messagesService.getUserRecommendations(currentUser.getUid(), 0); if (mids.size() > 0) { - List<com.juick.Message> messages = messagesService.getMessages(mids); - return "Favorite messages: \n" + String.join("\n", messages.stream() - .sorted(Collections.reverseOrder()) - .map(PlainTextFormatter::formatPost) - .collect(Collectors.toList())); + return "Favorite messages: \n" + printMessages(mids, false); } return "No favorite messages, try to \"like\" something ;)"; } @@ -588,16 +584,14 @@ public class JuickBot implements StanzaListener, AutoCloseable { } } @UserCommand(pattern = "^\\@([^\\s\\n\\+]+)(\\+?)$", - help = "@username+ - Show user's info and last 10 messages (@username++ - second page, ..)") + help = "@username+ - Show user's info and last 20 messages") public String commandUser(User user, Jid from, String... arguments) { User blogUser = userService.getUserByName(arguments[0]); int page = arguments[1].length(); if (blogUser.getUid() > 0) { - List<Integer> mids = messagesService.getUserBlog(blogUser.getUid(), 0, page); - List<com.juick.Message> messages = messagesService.getMessages(mids); + List<Integer> mids = messagesService.getUserBlog(blogUser.getUid(), 0, 0); return String.format("Last messages from @%s:\n%s", arguments[0], - String.join("\n", messages.stream() - .map(PlainTextFormatter::formatPostSummary).collect(Collectors.toList()))); + printMessages(mids, false)); } return "User not found"; } |