diff options
author | Vitaly Takmazov | 2023-01-07 10:16:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-07 10:16:54 +0300 |
commit | d0c350c3715c61830a2864dc7c44c23e39a9cfd9 (patch) | |
tree | e4ceb605c510fb7dd30703ef57b9585947338130 /src/main | |
parent | c5e6a65323a7558ca0322ec810a9dff847968730 (diff) |
XMPP: deactivate jids on 'cancel' error types
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/XMPPManager.java | 14 |
1 files changed, 9 insertions, 5 deletions
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; |