aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-17 13:30:13 +0300
committerGravatar Vitaly Takmazov2018-07-17 17:36:21 +0300
commit59427fb8419deb29ba0a1c4e0e8039e6590389c6 (patch)
treee38d371e5473e3cc4189904336d6d4aa880dfe18 /juick-server
parent5abd765f074f982e40eff234af72c53a55412361 (diff)
XMPP: route presences over XMPPRouter/babbler component
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPConnection.java16
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) {