diff options
author | Vitaly Takmazov | 2018-03-29 10:26:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-29 10:26:33 +0300 |
commit | d1ddcef27dac66dafe68e6cadc0806a3f20324fe (patch) | |
tree | f6ddaad3e31028098846e05664e6b7d2ea6bb685 /juick-server/src/main | |
parent | ad415109b1cc89de5bb632654fc7904c3dc755f4 (diff) |
server: xmpp presence handler refactoring
Diffstat (limited to 'juick-server/src/main')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPConnection.java | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/juick-server/src/main/java/com/juick/server/XMPPConnection.java b/juick-server/src/main/java/com/juick/server/XMPPConnection.java index e073913c..c246fdd6 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java +++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java @@ -493,7 +493,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { }); } - public boolean incomingPresence(Presence p) { + private void incomingPresence(Presence p) { final String username = p.getTo().getLocal(); final boolean toJuick = username.equals(jid.getLocal()); @@ -503,7 +503,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { reply.setTo(p.getFrom().asBareJid()); reply.setType(Presence.Type.UNSUBSCRIBE); xmpp.sendOut(ClientPresence.from(reply)); - return true; } else if (p.getType().equals(Presence.Type.PROBE)) { int uid_to = 0; if (!toJuick) { @@ -527,9 +526,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { reply.setId(p.getId()); reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); xmpp.sendOut(ClientPresence.from(reply)); - return true; } - return true; } else if (p.getType().equals(Presence.Type.SUBSCRIBE)) { boolean canSubscribe = false; if (toJuick) { @@ -541,7 +538,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { canSubscribe = true; } } - if (canSubscribe) { Presence reply = new Presence(); reply.setFrom(p.getTo()); @@ -553,8 +549,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { reply.setPriority((byte) 10); reply.setType(null); xmpp.sendOut(ClientPresence.from(reply)); - - return true; } else { Presence reply = new Presence(); reply.setFrom(p.getTo()); @@ -563,7 +557,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { reply.setId(p.getId()); reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); xmpp.sendOut(ClientPresence.from(reply)); - return true; } } else if (p.getType().equals(Presence.Type.UNSUBSCRIBE)) { if (!toJuick) { @@ -579,8 +572,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener { reply.setType(Presence.Type.UNSUBSCRIBED); xmpp.sendOut(ClientPresence.from(reply)); } - - return false; } public boolean incomingMessage(Message msg) { @@ -701,7 +692,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } } - void broadcastPresence(Presence.Type type) { + private void broadcastPresence(Presence.Type type) { Presence presence = new Presence(); presence.setFrom(jid); if (type != null) { @@ -725,7 +716,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { } } - public ExternalComponent getRouter() { + ExternalComponent getRouter() { return router; } } |