diff options
author | 2018-04-07 14:22:20 +0300 | |
---|---|---|
committer | 2018-04-07 14:22:20 +0300 | |
commit | 6f8fc3d489a006b6f96af954af6075d491b0af55 (patch) | |
tree | 1758262ad8b40e3edd37af2bf938a1a2d2121cec /juick-server-xmpp/src | |
parent | fb0d5b72314e8463f3c5a650e7298ba0a924383d (diff) |
fix xmpp error flow
Diffstat (limited to 'juick-server-xmpp/src')
-rw-r--r-- | juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java | 23 |
1 files changed, 11 insertions, 12 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 c800b65d..db925400 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 @@ -173,6 +173,17 @@ public class XMPPConnection implements StanzaListener, NotificationListener { }); router.addInboundMessageListener(e -> { Message message = e.getMessage(); + if (message.getType() != null && message.getType().equals(Message.Type.ERROR)) { + StanzaError error = message.getError(); + if (error != null && error.getCondition().equals(Condition.RESOURCE_CONSTRAINT)) { + // offline query is full, deactivating this jid + if (userService.setActiveStatusForJID(message.getFrom().toEscapedString(), UserService.ActiveStatus.Inactive)) { + logger.info("{} is inactive now", message.getFrom()); + return; + } + } + return; + } Jid jid = message.getTo(); if (jid.getDomain().equals(router.getDomain().toEscapedString()) || jid.equals(this.jid)) { com.juick.Message jmsg = message.getExtension(com.juick.Message.class); @@ -564,18 +575,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } public void incomingMessage(Message msg) throws Exception { - if (msg.getType() != null && msg.getType().equals(Message.Type.ERROR)) { - StanzaError error = msg.getError(); - if (error != null && error.getCondition().equals(Condition.RESOURCE_CONSTRAINT)) { - // offline query is full, deactivating this jid - if (userService.setActiveStatusForJID(msg.getFrom().toEscapedString(), UserService.ActiveStatus.Inactive)) { - logger.info("{} is inactive now", msg.getFrom()); - return; - } - } - return; - } - User user_from; user_from = userService.getUserByJID(msg.getFrom().asBareJid().toEscapedString()); if (user_from == null) { |