From d0c350c3715c61830a2864dc7c44c23e39a9cfd9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 7 Jan 2023 10:16:54 +0300 Subject: XMPP: deactivate jids on 'cancel' error types --- src/main/java/com/juick/XMPPManager.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java index 20b8259b..84ae36eb 100644 --- a/src/main/java/com/juick/XMPPManager.java +++ b/src/main/java/com/juick/XMPPManager.java @@ -496,11 +496,15 @@ public class XMPPManager implements NotificationListener { public ClientMessage incomingMessage(Message msg) { 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 null; + if (error != null) { + var shouldDeactivate = error.getCondition().equals(Condition.RESOURCE_CONSTRAINT) + || error.getType().equals(StanzaError.Type.CANCEL); + if (shouldDeactivate) { + if (userService.setActiveStatusForJID(msg.getFrom().toEscapedString(), + UserService.ActiveStatus.Inactive)) { + logger.info("{} is inactive now", msg.getFrom()); + return null; + } } } return null; -- cgit v1.2.3