aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-common/src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/juick-common/src/main/java/com/juick/server/CommandsManager.java b/juick-common/src/main/java/com/juick/server/CommandsManager.java
index d3be371f..6b759bed 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -77,6 +77,9 @@ public class CommandsManager {
public CommandResult processCommand(User user, String data, @Nonnull URI attachment) throws Exception {
String strippedData = StringUtils.stripStart(data, null);
+ if (strippedData.startsWith("?OTR")) {
+ return CommandResult.fromString("?OTR Error: we are not using OTR");
+ }
String input = MessageUtils.stripNonSafeUrls(strippedData);
Optional<Method> cmd = MethodUtils.getMethodsListWithAnnotation(getClass(), UserCommand.class).stream()
.filter(m -> Pattern.compile(m.getAnnotation(UserCommand.class).pattern(),
@@ -97,11 +100,11 @@ public class CommandsManager {
return commandResult;
}
}
- // new message
List<Tag> tags = tagService.fromString(input, false);
if (tags.size() >= 5) {
return CommandResult.fromString("Sorry, 5 tags maximum.");
}
+ // new message
String body = TagUtils.toString(tags).equals(input) ? StringUtils.EMPTY : input.substring(TagUtils.toString(tags).length()).trim();
String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
int mid = messagesService.createMessage(user.getUid(), body, attachmentType, tags);