aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-www/src/main/webapp/WEB-INF/juick.conf.example3
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPServer.java40
-rw-r--r--server-core/src/main/resources/juick.conf.example4
3 files changed, 27 insertions, 20 deletions
diff --git a/juick-www/src/main/webapp/WEB-INF/juick.conf.example b/juick-www/src/main/webapp/WEB-INF/juick.conf.example
index 54ac862a..bbe2a9e5 100644
--- a/juick-www/src/main/webapp/WEB-INF/juick.conf.example
+++ b/juick-www/src/main/webapp/WEB-INF/juick.conf.example
@@ -2,4 +2,5 @@ mysql_username=username
xmpp_password=secret
sape_user=usertoken
wns_application_sip=ms-app://x-1-11-1-1111111111-...
-wns_client_secret=secret \ No newline at end of file
+wns_client_secret=secret
+xmpp_disabled=false \ No newline at end of file
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);
diff --git a/server-core/src/main/resources/juick.conf.example b/server-core/src/main/resources/juick.conf.example
index 306a4e93..c9411456 100644
--- a/server-core/src/main/resources/juick.conf.example
+++ b/server-core/src/main/resources/juick.conf.example
@@ -42,4 +42,6 @@ keystore_password=
broken_ssl_hosts=
banned_hosts=
-upload_tmp_dir= \ No newline at end of file
+upload_tmp_dir=
+
+xmpp_disabled=false \ No newline at end of file