From d1ddcef27dac66dafe68e6cadc0806a3f20324fe Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 29 Mar 2018 10:26:33 +0300 Subject: server: xmpp presence handler refactoring --- .../src/main/java/com/juick/server/XMPPConnection.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'juick-server/src/main/java/com') 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; } } -- cgit v1.2.3