From f86e3e089ff4e4e27133156e277c94d4cd8c7111 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Apr 2018 21:55:36 +0300 Subject: URI refactoring --- .../src/main/java/com/juick/server/XMPPConnection.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'juick-server-xmpp/src/main/java') diff --git a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java index 40209fad..f0c205d9 100644 --- a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java +++ b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java @@ -63,6 +63,7 @@ import rocks.xmpp.extensions.version.SoftwareVersionManager; import rocks.xmpp.extensions.version.model.SoftwareVersion; import rocks.xmpp.util.XmppUtils; +import javax.annotation.Nonnull; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; @@ -200,7 +201,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } } } else { - URI attachment = URI.create(""); + URI attachment = URI.create(StringUtils.EMPTY); OobX oobX = message.getExtension(OobX.class); if (oobX != null) { attachment = oobX.getUri(); @@ -587,26 +588,25 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } return; } - if (StringUtils.isBlank(msg.getBody())) { - return; - } - String username = msg.getTo().getLocal(); User user_from; user_from = userService.getUserByJID(msg.getFrom().asBareJid().toEscapedString()); - URI attachmentURI = URI.create(""); + URI attachmentURI = URI.create(StringUtils.EMPTY); OobX oobX = msg.getExtension(OobX.class); if (oobX != null) { attachmentURI = oobX.getUri(); } incomingMessageJuick(user_from, msg.getFrom(), msg.getBody(), attachmentURI); } - public com.juick.Message incomingMessageJuick(User user_from, Jid from, String command, URI attachment) throws Exception { + public com.juick.Message incomingMessageJuick(User user_from, Jid from, String command, @Nonnull URI attachment) throws Exception { if (user_from == null) { String signuphash = userService.getSignUpHashByJID(from.asBareJid().toEscapedString()); sendReply(from, "Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account."); return null; } + if (StringUtils.isBlank(command) && attachment.toString().isEmpty()) { + return null; + } int commandlen = command.length(); -- cgit v1.2.3