* add ssl xmpp port; this should work with pidgin as samjam documented.
authorWilfried Göesgens <willi@citadel.org>
Sat, 28 Mar 2009 10:18:35 +0000 (10:18 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 28 Mar 2009 10:18:35 +0000 (10:18 +0000)
citadel/control.c
citadel/include/dtds/config-defs.h
citadel/modules/jabber/serv_xmpp.c
citadel/setup.c
citadel/tuiconfig.c

index 03ffa7c75d09917455cd31fdf42cf427ba146414..07edd88baf386e9b8fa9f091751be8b261648667 100644 (file)
@@ -389,6 +389,7 @@ void cmd_conf(char *argbuf)
                cprintf("%ld\n", config.c_pop3_fetch);
                cprintf("%ld\n", config.c_pop3_fastest);
                cprintf("%d\n", config.c_spam_flag_only);
+               cprintf("%d\n", config.c_xmpps_c2s_port);
                cprintf("000\n");
        }
 
@@ -645,6 +646,9 @@ void cmd_conf(char *argbuf)
                        case 66:
                                config.c_spam_flag_only = atoi(buf);
                                break;
+                       case 67:
+                               config.c_xmpps_c2s_port = atoi(buf);
+                               break;
                        }
                        ++a;
                }
index d14b3b4f49b242b46939fdb998313754ac6a6cbc..71f6096088dbad094cd82baa1910970462943942 100644 (file)
@@ -89,3 +89,4 @@ CFG_VALUE(INTEGER(c_xmpp_s2s_port),           " XMPP server-to-server port (usually 5269)
 CFG_VALUE(TIME(c_pop3_fetch),          " How often to fetch POP3 messages");
 CFG_VALUE(TIME(c_pop3_fastest),                " Users can specify POP3 fetching this often");
 CFG_VALUE(INTEGER(c_spam_flag_only),   " 1 = flag instead of reject spam");
+CFG_VALUE(INTEGER(c_xmpps_c2s_port),           " XMPP client-to-server SSL port (usually 5223)");
index 314ecbaa166ae4eb503e913c1d4d8a45e6da1f0b..c6fc94731b61d342a3c647eece8a55b97158096e 100644 (file)
@@ -424,6 +424,18 @@ void xmpp_greeting(void) {
 }
 
 
+/*
+ * Here's where our XMPPs session begins its happy day.
+ */
+void xmpps_greeting(void) {
+       CtdlModuleStartCryptoMsgs(NULL, NULL, NULL);
+#ifdef HAVE_OPENSSL
+       if (!CC->redirect_ssl) CC->kill_me = 1;         /* kill session if no crypto */
+#endif
+       xmpp_greeting();
+}
+
+
 /* 
  * Main command loop for XMPP sessions.
  */
@@ -472,6 +484,7 @@ void xmpp_logout_hook(void) {
 
 
 const char *CitadelServiceXMPP="XMPP";
+const char *CitadelServiceXMPPs="XMPPs";
 
 CTDL_MODULE_INIT(jabber)
 {
@@ -487,6 +500,21 @@ CTDL_MODULE_INIT(jabber)
                 CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT);
                 CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH);
                 CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH);
+
+#ifdef HAVE_OPENSSL
+               CtdlRegisterServiceHook(config.c_xmpps_c2s_port,
+                                       NULL,
+                                       xmpps_greeting,
+                                       xmpp_command_loop,
+                                       xmpp_async_loop,
+                                       CitadelServiceXMPPs);
+#endif
+
+               CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP);
+                CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN);
+                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT);
+                CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH);
+                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH);
        }
 
        /* return our Subversion id for the Log */
index 05e6eacb1cad17aa975cccdf7034a16e57a6feb7..b5ff9e9d51935053681278fcd6b180ea3f9d06a1 100644 (file)
@@ -1212,7 +1212,7 @@ int main(int argc, char *argv[])
        if (config.c_managesieve_port == 0) config.c_managesieve_port = 2020;
        if (config.c_xmpp_c2s_port == 0) config.c_xmpp_c2s_port = 5222;
        if (config.c_xmpp_s2s_port == 0) config.c_xmpp_s2s_port = 5269;
-
+       if (config.c_xmpps_c2s_port == 0) config.c_xmpps_c2s_port = 5223;
        /* Go through a series of dialogs prompting for config info */
        for (curr = 1; curr <= MAXSETUP; ++curr) {
                edit_value(curr);
index 5197abeae8e662f819a03fd42cf5df7b54cc541a..9401b345ea58d571f55292182f87d7bf1a6f67d0 100644 (file)
@@ -173,6 +173,7 @@ void do_system_configuration(CtdlIPC *ipc)
        strprompt("ManageSieve server port (-1 to disable)", &sc[51][0], 5);
 
        strprompt("XMPP (Jabber) client to server port (-1 to disable)", &sc[62][0], 5);
+       strprompt("XMPP (Jabber) client to server SSL port (-1 to disable)", &sc[67][0], 5);
        /* No prompt because we don't implement this service yet, it's just a placeholder */
        /* strprompt("XMPP (Jabber) server to server port (-1 to disable)", &sc[63][0], 5); */