aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-07 10:24:25 +0300
committerGravatar Vitaly Takmazov2023-01-07 10:24:25 +0300
commitdcd080bc2c864ac5efdb81809cb73ea987f3fead (patch)
tree525460a13319f4c884fd97bc6a82e6ee5f638811 /src/main/java/com
parentd0c350c3715c61830a2864dc7c44c23e39a9cfd9 (diff)
XMPP: deactivate jids on presence errors
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/XMPPManager.java10
1 files changed, 7 insertions, 3 deletions
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());
+ }
}
}
}