From: Art Cancro Date: Wed, 28 Nov 2007 04:10:52 +0000 (+0000) Subject: Minor xml fix to xmpp server X-Git-Tag: v7.86~2740 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=8dc12d6f1a6dae236eecb2e09376b6020728e8d8;p=citadel.git Minor xml fix to xmpp server --- diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index 90425064d..e24f1869b 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -122,6 +122,9 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) { if (!strcasecmp(attr[i], "type")) iqtype = attr[i+1]; if (!strcasecmp(attr[i], "id")) iqid = attr[i+1]; } + if (iqtype != NULL) { + safestrncpy(XMPP->iq_type, iqtype, sizeof XMPP->iq_type); + } if ((iqtype != NULL) && (iqid != NULL)) { if (!strcasecmp(iqtype, "set")) { safestrncpy(XMPP->iq_bind_id, iqid, sizeof XMPP->iq_bind_id); @@ -165,10 +168,17 @@ void xmpp_xml_end(void *data, const char *supplied_el) { else if (!strcasecmp(el, "iq")) { + /* + * iq type="get" + */ + if (!strcasecmp(XMPP->iq_type, "get")) { + lprintf(CTDL_DEBUG, " DISCO DUCK! \n"); + } - /* If this stanza was a "bind" attempt, process it ... */ - - if ( (!IsEmptyStr(XMPP->iq_bind_id)) && (!IsEmptyStr(XMPP->iq_client_resource)) ) { + /* + * If this stanza was a "bind" attempt, process it ... + */ + else if ( (!IsEmptyStr(XMPP->iq_bind_id)) && (!IsEmptyStr(XMPP->iq_client_resource)) ) { /* Generate the "full JID" of the client resource */ @@ -202,7 +212,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) { /* Now clear these fields out so they don't get used by a future stanza */ XMPP->iq_bind_id[0] = 0; XMPP->iq_client_resource[0] = 0; - XMPP->iq_session = 1; + XMPP->iq_session = 0; } else if (!strcasecmp(el, "auth")) { diff --git a/citadel/modules/jabber/serv_xmpp.h b/citadel/modules/jabber/serv_xmpp.h index c5fb645c9..7a902fcd6 100644 --- a/citadel/modules/jabber/serv_xmpp.h +++ b/citadel/modules/jabber/serv_xmpp.h @@ -11,6 +11,7 @@ struct citxmpp { /* Information about the current session */ int chardata_alloc; char client_jid[256]; /* "full JID" of the client */ + char iq_type[256]; char iq_bind_id[256]; /* for stanzas */ char iq_client_resource[256]; /* resource name requested by the client */ int iq_session; /* nonzero == client is requesting a session */ diff --git a/citadel/modules/jabber/xmpp_sasl_service.c b/citadel/modules/jabber/xmpp_sasl_service.c index 9e9aef6ff..4803fca02 100644 --- a/citadel/modules/jabber/xmpp_sasl_service.c +++ b/citadel/modules/jabber/xmpp_sasl_service.c @@ -99,7 +99,7 @@ void xmpp_output_auth_mechs(void) { */ void xmpp_sasl_auth(char *sasl_auth_mech, char *authstring) { - if (strcasecmp(XMPP->sasl_auth_mech, "PLAIN")) { + if (strcasecmp(sasl_auth_mech, "PLAIN")) { cprintf(""); cprintf(""); cprintf("");