diff options
Diffstat (limited to 'juick-server/src')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPConnection.java | 16 |
1 files changed, 4 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 8e26192c..12e66d40 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java +++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java @@ -256,6 +256,9 @@ public class XMPPConnection implements StanzaListener, NotificationListener { broadcastPresence(null); } }); + router.addInboundPresenceListener(event -> { + incomingPresence(event.getPresence()); + }); service.submit(() -> { try { router.connect(); @@ -629,18 +632,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { @Override public void stanzaReceived(Stanza xmlValue) { - if (xmlValue instanceof Presence) { - Presence p = (Presence) xmlValue; - if (p.getType() == null || !p.getType().equals(Presence.Type.ERROR)) { - incomingPresence(p); - } - } else if (xmlValue instanceof Message) { - Message msg = (Message) xmlValue; - router.send(msg); - } else if (xmlValue instanceof IQ) { - IQ iq = (IQ) xmlValue; - router.send(iq); - } + router.send(xmlValue); } private void broadcastPresence(Presence.Type type) { |