From dcd080bc2c864ac5efdb81809cb73ea987f3fead Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 7 Jan 2023 10:24:25 +0300 Subject: XMPP: deactivate jids on presence errors --- src/main/java/com/juick/XMPPManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java index 84ae36eb..cba6ef3e 100644 --- a/src/main/java/com/juick/XMPPManager.java +++ b/src/main/java/com/juick/XMPPManager.java @@ -485,9 +485,13 @@ public class XMPPManager implements NotificationListener { xmpp.send(ClientPresence.from(reply)); } else if (p.getType().equals(Presence.Type.ERROR)) { StanzaError error = p.getError(); - if (error != null && error.getCondition().equals(Condition.REMOTE_SERVER_NOT_FOUND)) { - if (userService.setActiveStatusForJID(p.getFrom().toEscapedString(), UserService.ActiveStatus.Inactive)) { - logger.info("{} is inactive now", p.getFrom()); + if (error != null) { + var shouldDeactivate = error.getCondition().equals(Condition.REMOTE_SERVER_NOT_FOUND) + || error.getType().equals(StanzaError.Type.CANCEL); + if (shouldDeactivate) { + if (userService.setActiveStatusForJID(p.getFrom().toEscapedString(), UserService.ActiveStatus.Inactive)) { + logger.info("{} is inactive now", p.getFrom()); + } } } } -- cgit v1.2.3