aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/build.gradle3
-rw-r--r--juick-server/src/main/java/com/juick/server/XMPPConnection.java11
2 files changed, 11 insertions, 3 deletions
diff --git a/juick-server/build.gradle b/juick-server/build.gradle
index d18dc242..04d39ea5 100644
--- a/juick-server/build.gradle
+++ b/juick-server/build.gradle
@@ -26,7 +26,10 @@ dependencies {
}
compile 'xpp3:xpp3:1.1.4c'
+ compile 'org.bitbucket.vitalyster.babbler:xmpp-core-common:receipts8-SNAPSHOT'
+ compile 'org.bitbucket.vitalyster.babbler:xmpp-addr:receipts8-SNAPSHOT'
compile 'org.bitbucket.vitalyster.babbler:xmpp-core-client:receipts8-SNAPSHOT'
+ compile 'org.bitbucket.vitalyster.babbler:xmpp-extensions-common:receipts8-SNAPSHOT'
compile 'org.bitbucket.vitalyster.babbler:xmpp-extensions-client:receipts8-SNAPSHOT'
compile "javax.inject:javax.inject:1"
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 78995e7a..3f15a2b9 100644
--- a/juick-server/src/main/java/com/juick/server/XMPPConnection.java
+++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java
@@ -38,6 +38,7 @@ import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
+import rocks.xmpp.core.session.XmppSession;
import rocks.xmpp.core.stanza.AbstractIQHandler;
import rocks.xmpp.core.stanza.model.*;
import rocks.xmpp.core.stanza.model.client.ClientMessage;
@@ -124,8 +125,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
public void init() {
logger.info("stream router start connecting to {}", componentPort);
xmpp.addStanzaListener(this);
- router = ExternalComponent.create(componentName, password, session.getConfiguration(), "localhost",
- componentPort);
+ router = ExternalComponent.create(componentName, password, "localhost", componentPort);
EntityCapabilitiesManager entityCapabilitiesManager = router.getManager(EntityCapabilitiesManager.class);
entityCapabilitiesManager.setNode("https://juick.com/caps");
MessageDeliveryReceiptsManager messageDeliveryReceiptsManager = router.getManager(MessageDeliveryReceiptsManager.class);
@@ -249,13 +249,18 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
logger.info("component connected");
}
});
+ router.addSessionStatusListener(event -> {
+ if (event.getStatus().equals(XmppSession.Status.AUTHENTICATED)) {
+ logger.info("Authenticated, broadcasting...");
+ broadcastPresence(null);
+ }
+ });
router.addInboundPresenceListener(event -> {
incomingPresence(event.getPresence());
});
service.submit(() -> {
try {
router.connect();
- broadcastPresence(null);
} catch (XmppException e) {
logger.warn("xmpp exception", e);
}