XMPP service ... remove from tech preview, as several
authorArt Cancro <ajc@citadel.org>
Tue, 26 Feb 2008 17:04:39 +0000 (17:04 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 26 Feb 2008 17:04:39 +0000 (17:04 +0000)
clients are now working.  Also allow underscores in user names, which are converted to
spaces.

citadel/modules/jabber/README.txt
citadel/modules/jabber/serv_xmpp.c
citadel/modules/jabber/xmpp_presence.c
citadel/modules/jabber/xmpp_queue.c
citadel/modules/jabber/xmpp_sasl_service.c
citadel/tuiconfig.c
webcit/siteconfig.c

index d72a61cce72802ee3d98429011eb20fee45cbed1..f6cedb11b30b7086bd2f22319322a864a7ed3a4c 100644 (file)
@@ -1,9 +1,4 @@
-
- Are you reading this?
- You shouldn't be.
- I haven't released this code yet.
- Go away.
+  
+ This directory contains an *unfinished* XMPP (Jabber) module for
+the Citadel system.  It does not work.  Go away.
  
index f131c988a45184864504bad8bbae0ea5cb6cd21b..6fa8a66b9172ee5105979dd8aa045d043c6a47b8 100644 (file)
@@ -480,7 +480,6 @@ const char *CitadelServiceXMPP="XMPP";
 CTDL_MODULE_INIT(jabber)
 {
        if (!threading) {
-#ifdef TECH_PREVIEW
 #ifdef HAVE_EXPAT
                CtdlRegisterServiceHook(config.c_xmpp_c2s_port,
                                        NULL,
@@ -496,7 +495,6 @@ CTDL_MODULE_INIT(jabber)
        #else
                lprintf(CTDL_INFO, "This server is missing the Expat XML parser.  Jabber service will be disabled.\n");
 #endif
-#endif /* TECH_PREVIEW */
        }
 
        /* return our Subversion id for the Log */
index 0bce01b133e2c294d8428e8f99b652792b811960..c4e86386b4c8bece74bf000e5a0022b708b2aad9 100644 (file)
@@ -92,7 +92,10 @@ void xmpp_presence_notify(char *presence_jid, char *presence_type) {
        lprintf(CTDL_DEBUG, "%d sessions for <%s> are now visible to session %d\n",
                visible_sessions, presence_jid, CC->cs_pid);
 
-       if ( (strcasecmp(presence_type, "unavailable")) && (visible_sessions == 1) ) {
+       if (
+          ( (strcasecmp(presence_type, "unavailable")) || (strcasecmp(presence_type, "unsubscribed")) )
+          && (visible_sessions == 1) ) {
+
                lprintf(CTDL_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid);
 
                /* Do an unsolicited roster update that adds a new contact. */
index b78f762ee92a891166dfcc29e55683e65af8f630..a6e99bb1de40131126854c2e664d9a9c1eace932 100644 (file)
@@ -128,6 +128,7 @@ void xmpp_process_events(void) {
                                case XMPP_EVT_LOGOUT:
                                        if (xptr->session_which_generated_this_event != CC->cs_pid) {
                                                xmpp_presence_notify(xptr->event_jid, "unavailable");
+                                               xmpp_presence_notify(xptr->event_jid, "unsubscribed");
                                        }
                                        break;
 
index 2f2dc419a33cd292c8cf7781b4fe7d39cf331328..f444ba9b9da232c5cdd87a6ef6444a2f3b333088 100644 (file)
@@ -61,12 +61,31 @@ int xmpp_auth_plain(char *authstring)
        char user[256];
        char pass[256];
        int result;
+       char *ptr = NULL;
+
+
+       /* Take apart the authentication string */
 
        CtdlDecodeBase64(decoded_authstring, authstring, strlen(authstring));
        safestrncpy(ident, decoded_authstring, sizeof ident);
        safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
        safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
 
+
+       /* If there are underscores in either string, change them to spaces.  Some clients
+        * do not allow spaces so we can tell the user to substitute underscores if their
+        * login name contains spaces.
+        */
+       while (ptr=strstr(ident, "_")) {
+               *ptr = ' ';
+       }
+
+       while (ptr=strstr(user, "_")) {
+               *ptr = ' ';
+       }
+
+       /* Now attempt authentication */
+
        if (!IsEmptyStr(ident)) {
                result = CtdlLoginExistingUser(user, ident);
        }
index c1104df8db10e72380ca06cc1e0f5f6f5f718d70..3136bd679af85d04302a2ba29ae559928d00f986 100644 (file)
@@ -172,11 +172,9 @@ void do_system_configuration(CtdlIPC *ipc)
        strprompt("Postfix TCP Dictionary Port server port (-1 to disable)", &sc[50][0], 5);
        strprompt("ManageSieve server port (-1 to disable)", &sc[51][0], 5);
 
-#ifdef TECH_PREVIEW
        strprompt("XMPP (Jabber) client to server port (-1 to disable)", &sc[62][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); */
-#endif
 
        /* This logic flips the question around, because it's one of those
         * situations where 0=yes and 1=no
index 3536f482938e6a70837357599c9fadb69e5331ce..9e6245029e8b82aa3a41ac201ae80aa4d94c9900 100644 (file)
@@ -602,8 +602,6 @@ void display_siteconfig(void)
                                ((atoi(buf) != 0) ? "CHECKED" : ""));
                        sprintf(&network[strlen(network)], "</TD></TR>\n");
                        break;
-
-#ifdef TECH_PREVIEW
                case 62:
                        sprintf(&network[strlen(network)], "<tr><td>");
                        sprintf(&network[strlen(network)], _("XMPP (Jabber) client to server port (-1 to disable)"));
@@ -618,20 +616,6 @@ void display_siteconfig(void)
                        sprintf(&network[strlen(network)], "<input type=\"hidden\" name=\"c_xmpp_s2s_port\" value=\"%s\">\n", buf);
                        sprintf(&network[strlen(network)], "</TD></TR>\n");
                        break;
-#else  /* TECH_PREVIEW */
-               case 62:
-                       sprintf(&network[strlen(network)], "<tr><td>");
-                       sprintf(&network[strlen(network)], "</td><td>");
-                       sprintf(&network[strlen(network)], "<input type=\"hidden\" name=\"c_xmpp_c2s_port\" value=\"%s\">", buf);
-                       sprintf(&network[strlen(network)], "</TD></TR>\n");
-                       break;
-               case 63:
-                       sprintf(&network[strlen(network)], "<tr><td>");
-                       sprintf(&network[strlen(network)], "</td><td>");
-                       sprintf(&network[strlen(network)], "<input type=\"hidden\" name=\"c_xmpp_s2s_port\" value=\"%s\">\n", buf);
-                       sprintf(&network[strlen(network)], "</TD></TR>\n");
-                       break;
-#endif /* TECH_PREVIEW */
                }
        
        }