diff options
author | 2016-02-01 19:48:21 +0300 | |
---|---|---|
committer | 2016-02-01 19:48:21 +0300 | |
commit | a9a7dd2da8db472e20c3aa44ae7cac274b8ed499 (patch) | |
tree | 76791098b26e0bd77b08e9f9b586e77e8c8c896c /src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java | |
parent | 14c5ddd69a6f76a96d7eb98afb01caac79308553 (diff) |
refactoring
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()); |