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");
}
case 66:
config.c_spam_flag_only = atoi(buf);
break;
+ case 67:
+ config.c_xmpps_c2s_port = atoi(buf);
+ break;
}
++a;
}
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)");
}
+/*
+ * 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.
*/
const char *CitadelServiceXMPP="XMPP";
+const char *CitadelServiceXMPPs="XMPPs";
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 */
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);
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); */