From 6f8fc3d489a006b6f96af954af6075d491b0af55 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 7 Apr 2018 14:22:20 +0300 Subject: fix xmpp error flow --- .../main/java/com/juick/server/XMPPConnection.java | 23 +++++++++++----------- 1 file 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) { -- cgit v1.2.3