clients are now working. Also allow underscores in user names, which are converted to
spaces.
-
- 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.
CTDL_MODULE_INIT(jabber)
{
if (!threading) {
-#ifdef TECH_PREVIEW
#ifdef HAVE_EXPAT
CtdlRegisterServiceHook(config.c_xmpp_c2s_port,
NULL,
#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 */
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. */
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;
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);
}
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
((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)"));
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 */
}
}