# HG changeset patch # User Mikael Berthe # Date 1134500926 -3600 # Node ID 0c1d373008624ce63ecf437fc1516ee0a71ae758 # Parent f791f5f0cfce6f412321929f8be1c0ed4601b6eb IQ: send feature-not-implemented error stanzas diff -r f791f5f0cfce -r 0c1d37300862 mcabber/src/jab_iq.c --- a/mcabber/src/jab_iq.c Tue Dec 13 18:33:04 2005 +0100 +++ b/mcabber/src/jab_iq.c Tue Dec 13 20:08:46 2005 +0100 @@ -163,7 +163,7 @@ int iid = atoi(p); //scr_LogPrint(LPRINT_DEBUG, "iid = %d", iid); - if (iid == s_id) { + if (iid == s_id) { // Authentication if (jstate == STATE_GETAUTH) { if ((x = xmlnode_get_tag(xmldata, "query")) != NULL) if (!xmlnode_get_tag(x, "digest")) { @@ -183,12 +183,10 @@ x = xmlnode_get_firstchild(xmldata); if (!x) x = xmldata; - //jhook.gotvcard(ic, x); TODO - scr_LogPrint(LPRINT_LOGNORM, "Got VCARD"); + scr_LogPrint(LPRINT_LOGNORM, "Got VCARD"); // TODO return; } else if (!strcmp(p, "versionreq")) { - // jhook.gotversion(ic, xmldata); TODO - scr_LogPrint(LPRINT_LOGNORM, "Got version"); + scr_LogPrint(LPRINT_LOGNORM, "Got version"); // TODO return; } } @@ -208,11 +206,9 @@ if (!id) id = ""; if (!strcmp(id, "Agent info")) { - // jhook.gotagentinfo(xmldata); TODO - scr_LogPrint(LPRINT_LOGNORM, "Got agent info"); + scr_LogPrint(LPRINT_LOGNORM, "Got agent info"); // TODO } else if (!strcmp(id, "Lookup")) { - // jhook.gotsearchresults(xmldata); TODO - scr_LogPrint(LPRINT_LOGNORM, "Got search results"); + scr_LogPrint(LPRINT_LOGNORM, "Got search results"); // TODO } else if (!strcmp(id, "Register")) { if (!from) return; @@ -222,7 +218,6 @@ jab_send(conn, x); xmlnode_free(x); } - } } @@ -236,23 +231,39 @@ // Nothing implemented yet. x = xmlnode_new_tag("iq"); - xmlnode_put_attrib(x, "type", "result"); xmlnode_put_attrib(x, "to", from); xmlnode_put_attrib(x, "id", id); xmlnode_put_attrib(x, "type", TMSG_ERROR); y = xmlnode_insert_tag(x, TMSG_ERROR); - xmlnode_put_attrib(y, "code", "503"); + xmlnode_put_attrib(y, "code", "501"); xmlnode_put_attrib(y, "type", "cancel"); z = xmlnode_insert_tag(y, "feature-not-implemented"); - xmlnode_put_attrib(z, "xmlns", - "urn:ietf:params:xml:ns:xmpp-stanzas"); + xmlnode_put_attrib(z, "xmlns", NS_XMPP_STANZAS); jab_send(conn, x); xmlnode_free(x); } static void handle_iq_set(jconn conn, char *from, xmlnode xmldata) { - /* FIXME: send error */ + char *id; + xmlnode x, y, z; + + id = xmlnode_get_attrib(xmldata, "id"); + if (!id) return; + + /* Not implemented yet: send an error stanza */ + x = xmlnode_new_tag("iq"); + xmlnode_put_attrib(x, "to", from); + xmlnode_put_attrib(x, "id", id); + xmlnode_put_attrib(x, "type", TMSG_ERROR); + y = xmlnode_insert_tag(x, TMSG_ERROR); + xmlnode_put_attrib(y, "code", "501"); + xmlnode_put_attrib(y, "type", "cancel"); + z = xmlnode_insert_tag(y, "feature-not-implemented"); + xmlnode_put_attrib(z, "xmlns", NS_XMPP_STANZAS); + + jab_send(conn, x); + xmlnode_free(x); } void handle_packet_iq(jconn conn, char *type, char *from, xmlnode xmldata)