From: Art Cancro Date: Thu, 29 Nov 2007 15:52:18 +0000 (+0000) Subject: Slight change to the way we offer XMPP stream features. X-Git-Tag: v7.86~2735 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=35e6afce32087ba90924eb1ed1105197161c3b7b;p=citadel.git Slight change to the way we offer XMPP stream features. Before authentication, the only feature we offer is SASL, implying to the client that the only thing it is allowed to do is log in. After a successful SASL authentication, which causes the XMPP stream to be restarted, the features we offer are sessions and binding, but not SASL. This allows clients to initialize in the correct sequence and guarantees that we will have an email address to use in the JID. --- diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index 27c4f6a60..e23ad7cc1 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -1,5 +1,5 @@ /* - * $Id: $ + * $Id$ * * XMPP (Jabber) service for the Citadel system * Copyright (c) 2007 by Art Cancro @@ -78,18 +78,16 @@ void xmpp_stream_start(void *data, const char *supplied_el, const char **attr) /* The features of this stream are... */ cprintf(""); - /* Binding... */ - cprintf(""); - - /* Sessions... */ - cprintf(""); - - /* SASL (but only if we're not already logged in; this is important!) ... */ if (!CC->logged_in) { + /* If we're not logged in yet, offer SASL as our feature set */ xmpp_output_auth_mechs(); } + else { + /* If we've logged in, now offer binding and sessions as our feature set */ + cprintf(""); + cprintf(""); + } - /* ...and the ability to close XML tags using angle brackets. We should patent this. */ cprintf(""); } @@ -202,10 +200,16 @@ void xmpp_xml_end(void *data, const char *supplied_el) { /* Generate the "full JID" of the client resource */ + // snprintf(XMPP->client_jid, sizeof XMPP->client_jid, + // "%d@%s/%s", + // CC->cs_pid, + // config.c_fqdn, + // XMPP->iq_client_resource + //); + snprintf(XMPP->client_jid, sizeof XMPP->client_jid, - "%d@%s/%s", - CC->cs_pid, - config.c_fqdn, + "%s/%s", + CC->cs_inet_email, XMPP->iq_client_resource ); @@ -364,5 +368,5 @@ CTDL_MODULE_INIT(jabber) } /* return our Subversion id for the Log */ - return "$Id: $"; + return "$Id$"; }