diff options
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java index 272bc197..73e7a65e 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java @@ -10,7 +10,6 @@ import com.juick.xmpp.extensions.XOOB; import com.juick.xmpp.utils.SHA1; import com.juick.xmpp.utils.XmlUtils; import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.io.InputStreamReader; @@ -28,6 +27,12 @@ import java.util.logging.Level; */ public class ConnectionRouter extends Connection implements Runnable { + private String componentName; + + ConnectionRouter(String componentName) { + this.componentName = componentName; + } + @Override public void run() { LOGGER.info("STREAM ROUTER START"); @@ -43,7 +48,7 @@ public class ConnectionRouter extends Connection implements Runnable { parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); writer = new OutputStreamWriter(Channels.newOutputStream(client)); - String msg = "<stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' to='s2s'>"; + String msg = "<stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' to='" + componentName + "'>"; writer.write(msg); writer.flush(); @@ -74,7 +79,7 @@ public class ConnectionRouter extends Connection implements Runnable { if (to != null && (tag.equals("message") || tag.equals("presence") || tag.equals("iq"))) { JID jid = new JID(to); if (jid.Host != null) { - if (jid.Host.equals(XMPPComponent.COMPONENTNAME)) { + if (jid.Host.equals(componentName)) { if (tag.equals("message")) { Message xmsg = Message.parse(parser, XMPPComponent.childParsers); LOGGER.info("STREAM ROUTER (PROCESS): " + xmsg.toString()); |