]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/jabber/serv_xmpp.c
* New session variable 'can_receive_im' which indicates that the session is running...
[citadel.git] / citadel / modules / jabber / serv_xmpp.c
index c6fc94731b61d342a3c647eece8a55b97158096e..988efad2910221388a8b458ad871324db26853e9 100644 (file)
@@ -55,8 +55,6 @@ struct xmpp_event *xmpp_queue = NULL;
 
 void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
 {
-       CtdlLogPrintf(CTDL_DEBUG, "New XMPP stream.\n");
-
        while (*attr) {
                if (!strcasecmp(attr[0], "to")) {
                        safestrncpy(XMPP->server_name, attr[1], sizeof XMPP->server_name);
@@ -112,11 +110,12 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) {
                strcpy(el, ++sep);
        }
 
+       /*
        CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
-
        for (i=0; attr[i] != NULL; i+=2) {
                CtdlLogPrintf(CTDL_DEBUG, "                    Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
        }
+       uncomment for more verbosity */
 
        if (!strcasecmp(el, "stream")) {
                xmpp_stream_start(data, supplied_el, attr);
@@ -182,10 +181,12 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                strcpy(el, ++sep);
        }
 
+       /*
        CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT END  : <%s>\n", el);
        if (XMPP->chardata_len > 0) {
                CtdlLogPrintf(CTDL_DEBUG, "          chardata: %s\n", XMPP->chardata);
        }
+       uncomment for more verbosity */
 
        if (!strcasecmp(el, "resource")) {
                if (XMPP->chardata_len > 0) {
@@ -384,7 +385,6 @@ void xmpp_cleanup_function(void) {
        /* Don't do this stuff if this is not a XMPP session! */
        if (CC->h_command_function != xmpp_command_loop) return;
 
-       CtdlLogPrintf(CTDL_DEBUG, "Performing XMPP cleanup hook\n");
        if (XMPP->chardata != NULL) {
                free(XMPP->chardata);
                XMPP->chardata = NULL;
@@ -421,18 +421,8 @@ void xmpp_greeting(void) {
        XML_SetElementHandler(XMPP->xp, xmpp_xml_start, xmpp_xml_end);
        XML_SetCharacterDataHandler(XMPP->xp, xmpp_xml_chardata);
        // XML_SetUserData(XMPP->xp, something...);
-}
 
-
-/*
- * 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();
+       CC->can_receive_im = 1;         /* This protocol is capable of receiving instant messages */
 }
 
 
@@ -484,7 +474,6 @@ void xmpp_logout_hook(void) {
 
 
 const char *CitadelServiceXMPP="XMPP";
-const char *CitadelServiceXMPPs="XMPPs";
 
 CTDL_MODULE_INIT(jabber)
 {
@@ -500,21 +489,6 @@ 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 */