From 59427fb8419deb29ba0a1c4e0e8039e6590389c6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 17 Jul 2018 13:30:13 +0300 Subject: XMPP: route presences over XMPPRouter/babbler component --- .../src/main/java/com/juick/server/XMPPConnection.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'juick-server/src/main/java/com/juick') 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) { -- cgit v1.2.3