diff options
author | Vitaly Takmazov | 2018-04-04 21:55:36 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-04 21:55:36 +0300 |
commit | f86e3e089ff4e4e27133156e277c94d4cd8c7111 (patch) | |
tree | e319c662eb805b95ddf31074c3a6c4b8e4b7bdbd /juick-server-xmpp | |
parent | ba52f4add7a96df36112522faf0f85f41b190694 (diff) |
URI refactoring
Diffstat (limited to 'juick-server-xmpp')
-rw-r--r-- | juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java | 14 |
1 files changed, 7 insertions, 7 deletions
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(); |