* add ssl xmpp port; this should work with pidgin as samjam documented.
[citadel.git] / citadel / modules / jabber / serv_xmpp.c
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 */