pidgin: b6af9a8c: Properly send rejection to initiator if ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Jul 15 22:26:13 EDT 2009


-----------------------------------------------------------------
Revision: b6af9a8cf6b4f3824e7cc3cb85bc8c1677155304
Ancestor: 815271fc2711a7da97c54f6d049c6f434632fe38
Author: darkrain42 at pidgin.im
Date: 2009-07-15T18:27:37
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b6af9a8cf6b4f3824e7cc3cb85bc8c1677155304

Modified files:
        libpurple/protocols/jabber/si.c

ChangeLog: 

Properly send rejection to initiator if we reject a transfer.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	636a46ac9b0bd11397007a979e14d842ed3dfaee
+++ libpurple/protocols/jabber/si.c	f520500ba5bc9a90ff7fa192058afca8fb96c5c7
@@ -1379,6 +1379,31 @@ static void jabber_si_xfer_request_denie
 
 static void jabber_si_xfer_request_denied(PurpleXfer *xfer)
 {
+	JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+	JabberStream *js = jsx->js;
+
+	/*
+	 * TODO: It's probably an error if jsx->iq_id == NULL. g_return_if_fail
+	 * might be warranted.
+	 */
+	if (jsx->iq_id && !jsx->accepted) {
+		JabberIq *iq;
+		xmlnode *error, *child;
+		iq = jabber_iq_new(js, JABBER_IQ_ERROR);
+		xmlnode_set_attrib(iq->node, "to", xfer->who);
+		jabber_iq_set_id(iq, jsx->iq_id);
+
+		error = xmlnode_new_child(iq->node, "error");
+		xmlnode_set_attrib(error, "type", "cancel");
+		child = xmlnode_new_child(error, "forbidden");
+		xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		child = xmlnode_new_child(error, "text");
+		xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_insert_data(child, "Offer Declined", -1);
+
+		jabber_iq_send(iq);
+	}
+
 	jabber_si_xfer_free(xfer);
 	purple_debug(PURPLE_DEBUG_INFO, "jabber", "in jabber_si_xfer_request_denied\n");
 }
@@ -1555,6 +1580,8 @@ static void jabber_si_xfer_init(PurpleXf
 		xmlnode_set_attrib(iq->node, "to", xfer->who);
 		if(jsx->iq_id)
 			jabber_iq_set_id(iq, jsx->iq_id);
+		else
+			purple_debug_error("jabber", "Sending SI result with new IQ id.\n");
 
 		jsx->accepted = TRUE;
 


More information about the Commits mailing list