From a9a7dd2da8db472e20c3aa44ae7cac274b8ed499 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 1 Feb 2016 19:48:21 +0300 Subject: refactoring --- src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java') 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 = ""; + String msg = ""; 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()); -- cgit v1.2.3