diff options
author | 2018-02-25 08:46:01 +0300 | |
---|---|---|
committer | 2018-02-25 08:46:01 +0300 | |
commit | 81f82943e8c37f47bd02d7490935121ff16f6d71 (patch) | |
tree | 3adca7ed87c40a6582d8d52f01c4278705a071b4 /juick-server/src/main | |
parent | bd89e1b84f195edcc68c1e9325f412f67b099504 (diff) |
xmpp: show reply command
Diffstat (limited to 'juick-server/src/main')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPBot.java | 12 |
1 files changed, 11 insertions, 1 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 1c17a0aa..a07dbe86 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -617,10 +617,20 @@ public class XMPPBot implements StanzaListener, AutoCloseable { return String.join("\n", replies.stream().map(PlainTextFormatter::formatPostSummary).collect(Collectors.toList())); } - return PlainTextFormatter.formatPostSummary(msg); + return PlainTextFormatter.formatPost(msg); } return "Message not found"; } + @UserCommand(pattern = "^#(\\d+)\\/(\\d+)$", help = "#1234/5 - Show reply") + public String commandShowReply(User user, Jid from, String... arguments) { + int mid = NumberUtils.toInt(arguments[0], 0); + int rid = NumberUtils.toInt(arguments[1], 0); + com.juick.Message reply = messagesService.getReply(mid, rid); + if (reply != null) { + return PlainTextFormatter.formatPost(reply); + } + return "Reply not found"; + } @UserCommand(pattern = "^D #(\\d+)$", help = "D #1234 - Delete post", patternFlags = Pattern.CASE_INSENSITIVE) public String commandDeletePost(User user, Jid from, String... args) { int mid = Integer.valueOf(args[0]); |