aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-26 17:04:30 +0300
committerGravatar Vitaly Takmazov2018-03-26 17:04:30 +0300
commitb03bca4032912981b9cb642a1ec94143c3410afc (patch)
treeb689d0b0ad81e4469e2cc2012506c8c09f5755bf /juick-server/src/main/java
parentf7f09ae5792a8e21deacabca6290d503742abdf5 (diff)
xmpp: view tag command
Diffstat (limited to 'juick-server/src/main/java')
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPBot.java10
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 a3335596..41c98856 100644
--- a/juick-server/src/main/java/com/juick/server/XMPPBot.java
+++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java
@@ -675,6 +675,16 @@ public class XMPPBot implements StanzaListener, AutoCloseable {
}
return "Reply not found";
}
+ @UserCommand(pattern = "^\\*(\\S+)(\\+?)$", help = "*tag - Show last messages with tag")
+ public String commandShowTag(User user, Jid from, String... arguments) {
+ Tag tag = tagService.getTag(arguments[0], false);
+ if (tag != null) {
+ // TODO: synonims
+ List<Integer> mids = messagesService.getTag(tag.TID, user.getUid(), 0, 10);
+ return "Last messages with *" + tag.getName() + ":\n" + printMessages(mids, true);
+ }
+ return "Tag 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]);