changeset 8399:681b1661ee8b

[gaim-migrate @ 9128] the /* XXX */ cleanup continues committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 05 Mar 2004 16:37:37 +0000
parents 66db94ff619c
children 0383e55cd658
files src/protocols/jabber/jabber.c src/protocols/jabber/oob.c
diffstat 2 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Fri Mar 05 16:24:05 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Fri Mar 05 16:37:37 2004 +0000
@@ -1219,7 +1219,7 @@
 	jabber_roster_group_change,
 	jabber_roster_group_rename,
 	NULL,
-	NULL, /* convo_closed */ /* XXX: thread_ids */
+	NULL, /* convo_closed */
 	jabber_normalize,
 	NULL, /* set_buddy_icon */
 	NULL, /* remove_group */
--- a/src/protocols/jabber/oob.c	Fri Mar 05 16:24:05 2004 +0000
+++ b/src/protocols/jabber/oob.c	Fri Mar 05 16:37:37 2004 +0000
@@ -117,24 +117,38 @@
 	return 0;
 }
 
-static void jabber_oob_xfer_cancel_recv(GaimXfer *xfer) {
+static void jabber_oob_xfer_recv_error(GaimXfer *xfer, const char *code) {
 	JabberOOBXfer *jox = xfer->data;
 	JabberIq *iq;
-	xmlnode *y;
+	xmlnode *y, *z;
 
 	iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR);
 	xmlnode_set_attrib(iq->node, "to", xfer->who);
 	jabber_iq_set_id(iq, jox->iq_id);
 	y = xmlnode_new_child(iq->node, "error");
-	/* FIXME: need to handle other kinds of errors here */
-	xmlnode_set_attrib(y, "code", "406");
-	xmlnode_insert_data(y, "File Transfer Refused", -1);
-
+	xmlnode_set_attrib(y, "code", code);
+	if(!strcmp(code, "406")) {
+		z = xmlnode_new_child(y, "not-acceptable");
+		xmlnode_set_attrib(y, "type", "modify");
+		xmlnode_set_attrib(z, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas");
+	} else if(!strcmp(code, "404")) {
+		z = xmlnode_new_child(y, "not-found");
+		xmlnode_set_attrib(y, "type", "cancel");
+		xmlnode_set_attrib(z, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas");
+	}
 	jabber_iq_send(iq);
 
 	jabber_oob_xfer_free(xfer);
 }
 
+static void jabber_oob_xfer_recv_denied(GaimXfer *xfer) {
+	jabber_oob_xfer_recv_error(xfer, "406");
+}
+
+static void jabber_oob_xfer_recv_canceled(GaimXfer *xfer) {
+	jabber_oob_xfer_recv_error(xfer, "404");
+}
+
 void jabber_oob_parse(JabberStream *js, xmlnode *packet) {
 	JabberOOBXfer *jox;
 	GaimXfer *xfer;
@@ -170,8 +184,8 @@
 
 	gaim_xfer_set_init_fnc(xfer,   jabber_oob_xfer_init);
 	gaim_xfer_set_end_fnc(xfer,    jabber_oob_xfer_end);
-	gaim_xfer_set_request_denied_fnc(xfer, jabber_oob_xfer_cancel_recv); /* XXX */
-	gaim_xfer_set_cancel_recv_fnc(xfer, jabber_oob_xfer_cancel_recv);
+	gaim_xfer_set_request_denied_fnc(xfer, jabber_oob_xfer_recv_denied);
+	gaim_xfer_set_cancel_recv_fnc(xfer, jabber_oob_xfer_recv_canceled);
 	gaim_xfer_set_read_fnc(xfer,   jabber_oob_xfer_read);
 	gaim_xfer_set_start_fnc(xfer,  jabber_oob_xfer_start);