From 2e5ba5e7462d6684433ea638c9ff8f95c864be74 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 2 Apr 2018 19:58:06 +0300 Subject: xmpp: fix router namespace --- .../main/java/com/juick/server/xmpp/router/XMPPRouter.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'juick-server-xmpp/src/main/java/com/juick/server') diff --git a/juick-server-xmpp/src/main/java/com/juick/server/xmpp/router/XMPPRouter.java b/juick-server-xmpp/src/main/java/com/juick/server/xmpp/router/XMPPRouter.java index a262e941..e70eb168 100644 --- a/juick-server-xmpp/src/main/java/com/juick/server/xmpp/router/XMPPRouter.java +++ b/juick-server-xmpp/src/main/java/com/juick/server/xmpp/router/XMPPRouter.java @@ -8,7 +8,11 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.xmlpull.v1.XmlPullParserException; import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.stanza.model.IQ; +import rocks.xmpp.core.stanza.model.Message; import rocks.xmpp.core.stanza.model.Stanza; +import rocks.xmpp.core.stanza.model.server.ServerIQ; +import rocks.xmpp.core.stanza.model.server.ServerMessage; import rocks.xmpp.util.XmppUtils; import javax.annotation.PostConstruct; @@ -156,7 +160,14 @@ public class XMPPRouter implements StreamHandler { } @Override public void stanzaReceived(String stanza) { - sendOut(parse(stanza)); + Stanza input = parse(stanza); + if (input instanceof Message) { + sendOut(ServerMessage.from((Message)input)); + } else if (input instanceof IQ) { + sendOut(ServerIQ.from((IQ)input)); + } else { + logger.warn("unhandled stanza: {}", stanza); + } } @Override -- cgit v1.2.3