diff options
author | Vitaly Takmazov | 2018-03-21 14:12:16 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-21 14:12:16 +0300 |
commit | cfa0a72e2822817b5d8fc45e673ca3d40f214572 (patch) | |
tree | c9626fef5d57daf95ec6e51bd389b98d732c57a8 /juick-server/src/main/java/com | |
parent | 403fab0c39e99ffd0b386eb612f3574938ae2125 (diff) |
xmpp: feed command
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPBot.java | 10 |
1 files changed, 10 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 9b6b5fe4..b8789276 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -689,6 +689,16 @@ public class XMPPBot implements StanzaListener, AutoCloseable { public String commandSearchAll(User user, Jid from, String... args) { return "Temporarily unavailable"; } + @UserCommand(pattern = "^(#+)$", help = "# - Show last messages from your feed (## - second page, ...)") + public String commandMyFeed(User user, String... arguments) { + // number of # is the page count + int page = arguments[0].length() - 1; + List<Integer> mids = messagesService.getMyFeed(user.getUid(), page, false); + if (mids.size() > 0) { + return "Your feed: \n" + printMessages(mids, true); + } + return "Your feed is empty"; + } void sendReply(Jid jidTo, String txt) { Message reply = new Message(); |