aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPServer.java40
1 files changed, 22 insertions, 18 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
index e26e0a1e..cb5172d6 100644
--- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
+++ b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
@@ -6,6 +6,7 @@ import com.juick.xmpp.JID;
import com.juick.xmpp.Stanza;
import com.juick.xmpp.StanzaChild;
import com.juick.xmpp.extensions.JuickMessage;
+import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,29 +66,32 @@ public class XMPPServer implements DisposableBean {
brokenSSLhosts = Arrays.asList(env.getProperty("broken_ssl_hosts", "").split(","));
bannedHosts = Arrays.asList(env.getProperty("banned_hosts", "").split(","));
bot = new JuickBot(this, Jid);
+ boolean disabled = BooleanUtils.toBoolean(env.getProperty("xmpp_disabled", "false"));
childParsers.put(JuickMessage.XMLNS, new JuickMessage());
- router = new ConnectionRouter(this, componentName, componentPort, env.getProperty("xmpp_password"));
-
- service.submit(router);
-
- service.submit(() -> {
- final ServerSocket listener = new ServerSocket(s2sPort);
- logger.info("s2s listener ready");
- while (true) {
- try {
- Socket socket = listener.accept();
- ConnectionIn client = new ConnectionIn(this, bot, socket);
- addConnectionIn(client);
- service.submit(client);
- } catch (Exception e) {
- logger.error("s2s error", e);
+ if (!disabled) {
+ router = new ConnectionRouter(this, componentName, componentPort, env.getProperty("xmpp_password"));
+
+ service.submit(router);
+
+ service.submit(() -> {
+ final ServerSocket listener = new ServerSocket(s2sPort);
+ logger.info("s2s listener ready");
+ while (true) {
+ try {
+ Socket socket = listener.accept();
+ ConnectionIn client = new ConnectionIn(this, bot, socket);
+ addConnectionIn(client);
+ service.submit(client);
+ } catch (Exception e) {
+ logger.error("s2s error", e);
+ }
}
- }
- });
+ });
- service.submit(new CleaningUp(this));
+ service.submit(new CleaningUp(this));
+ }
} catch (Exception e) {
logger.error("XMPPComponent error", e);