aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-10 09:36:08 +0300
committerGravatar Vitaly Takmazov2017-10-10 09:38:32 +0300
commit41c4ea59c8d1929a1f8b8f8536ffa696e64e1336 (patch)
tree74564e1176bfa2ae4fa388bddae13e396f988834 /juick-xmpp/src/main/java/com/juick/components
parent448fc7e84732422011186a9a4633c345e9c6208e (diff)
xmpp: mark jids inactive when resource-constraint is received
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/JuickBot.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
index cefacb56..f79db78e 100644
--- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
+++ b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
@@ -204,10 +204,20 @@ public class JuickBot implements StanzaListener, AutoCloseable {
}
public boolean incomingMessage(Message msg) {
- if (StringUtils.isBlank(msg.getBody()) || (msg.getType() != null && msg.getType().equals(Message.Type.ERROR))) {
+ if (StringUtils.isBlank(msg.getBody())) {
+ return false;
+ }
+ if (msg.getType() != null && msg.getType().equals(Message.Type.ERROR)) {
+ StanzaError error = msg.getExtension(StanzaError.class);
+ if (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 true;
+ }
+ }
return false;
}
-
String username = msg.getTo().getLocal();
User user_from;