From: Art Cancro Date: Tue, 26 Feb 2008 17:04:39 +0000 (+0000) Subject: XMPP service ... remove from tech preview, as several X-Git-Tag: v7.86~2461 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=a4a539f7b5c10763dff969efa26ec49349c0363f XMPP service ... remove from tech preview, as several clients are now working. Also allow underscores in user names, which are converted to spaces. --- diff --git a/citadel/modules/jabber/README.txt b/citadel/modules/jabber/README.txt index d72a61cce..f6cedb11b 100644 --- a/citadel/modules/jabber/README.txt +++ b/citadel/modules/jabber/README.txt @@ -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. diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index f131c988a..6fa8a66b9 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -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 */ diff --git a/citadel/modules/jabber/xmpp_presence.c b/citadel/modules/jabber/xmpp_presence.c index 0bce01b13..c4e86386b 100644 --- a/citadel/modules/jabber/xmpp_presence.c +++ b/citadel/modules/jabber/xmpp_presence.c @@ -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. */ diff --git a/citadel/modules/jabber/xmpp_queue.c b/citadel/modules/jabber/xmpp_queue.c index b78f762ee..a6e99bb1d 100644 --- a/citadel/modules/jabber/xmpp_queue.c +++ b/citadel/modules/jabber/xmpp_queue.c @@ -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; diff --git a/citadel/modules/jabber/xmpp_sasl_service.c b/citadel/modules/jabber/xmpp_sasl_service.c index 2f2dc419a..f444ba9b9 100644 --- a/citadel/modules/jabber/xmpp_sasl_service.c +++ b/citadel/modules/jabber/xmpp_sasl_service.c @@ -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); } diff --git a/citadel/tuiconfig.c b/citadel/tuiconfig.c index c1104df8d..3136bd679 100644 --- a/citadel/tuiconfig.c +++ b/citadel/tuiconfig.c @@ -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 diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index 3536f4829..9e6245029 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -602,8 +602,6 @@ void display_siteconfig(void) ((atoi(buf) != 0) ? "CHECKED" : "")); sprintf(&network[strlen(network)], "\n"); break; - -#ifdef TECH_PREVIEW case 62: sprintf(&network[strlen(network)], ""); 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)], "\n", buf); sprintf(&network[strlen(network)], "\n"); break; -#else /* TECH_PREVIEW */ - case 62: - sprintf(&network[strlen(network)], ""); - sprintf(&network[strlen(network)], ""); - sprintf(&network[strlen(network)], "", buf); - sprintf(&network[strlen(network)], "\n"); - break; - case 63: - sprintf(&network[strlen(network)], ""); - sprintf(&network[strlen(network)], ""); - sprintf(&network[strlen(network)], "\n", buf); - sprintf(&network[strlen(network)], "\n"); - break; -#endif /* TECH_PREVIEW */ } }