From: Art Cancro Date: Sun, 21 Feb 2010 05:37:32 +0000 (+0000) Subject: * Reply to XMPP queries in unsupported namespaces with a error... X-Git-Tag: v7.86~408 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;ds=sidebyside;h=973ed9d8493bff7151a05cfb8fb1e7deccf908ac;p=citadel.git * Reply to XMPP queries in unsupported namespaces with a error instead of an empty result. --- diff --git a/citadel/modules/jabber/xmpp_query_namespace.c b/citadel/modules/jabber/xmpp_query_namespace.c index 0c34d5f7b..64aba16c5 100644 --- a/citadel/modules/jabber/xmpp_query_namespace.c +++ b/citadel/modules/jabber/xmpp_query_namespace.c @@ -86,20 +86,19 @@ void jabber_iq_roster_query(void) cprintf(""); cptr = CtdlGetContextArray(&nContexts); - if (!cptr) - return ; /** FIXME: Does jabber need to send something to maintain the protocol? */ - - for (i=0; iuser.usernum) - ) { - jabber_roster_item(&cptr[i]); + if (cptr) { + for (i=0; iuser.usernum) + ) { + jabber_roster_item(&cptr[i]); + } } } + free (cptr); } - free (cptr); cprintf(""); } @@ -113,14 +112,32 @@ xmpp_query_namespace(purple5b5c1e5a, , vcard-temp:query) * */ -void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) { +void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) +{ + int supported_namespace = 0; + + /* We need to know before we begin the response whether this is a supported namespace, so + * unfortunately all supported namespaces need to be defined here *and* down below where + * they are handled. + */ + if ( + (!strcasecmp(query_xmlns, "jabber:iq:roster:query")) + && (!strcasecmp(query_xmlns, "jabber:iq:auth:query")) + ) { + supported_namespace = 1; + } CtdlLogPrintf(CTDL_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns); /* * Beginning of query result. */ - cprintf("\n"); + cprintf("" + "" + "" + ); + } + /* - * End of query result. If we didn't hit any known namespaces then we will - * have simply delivered an empty result stanza, which should be ok. + * End of query result. If we didn't hit any known namespaces then we should + * deliver a "service unavailable" error (see RFC3921 section 2.4 and 11.1.5.4) */ cprintf(""); - } diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 2a16edd8a..b7cd49056 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -289,7 +289,6 @@ void rss_save_item(rsscollection *rssc) { int msglen = 0; rss_item *ri = rssc->Item; - CtdlLogPrintf(0, "RSS: saving item...\n"); recp = (struct recptypes *) malloc(sizeof(struct recptypes)); if (recp == NULL) return; memset(recp, 0, sizeof(struct recptypes)); @@ -334,7 +333,7 @@ void rss_save_item(rsscollection *rssc) { } else { /* Item has not been seen, so save it. */ - + CtdlLogPrintf(CTDL_DEBUG, "RSS: saving item...\n"); if (ri->description == NULL) ri->description = strdup(""); for (i=strlen(ri->description); i>=0; --i) { if (isspace(ri->description[i])) {