pidgin: 9705e192: Send a cancel message for any unknown te...

qulogic at pidgin.im qulogic at pidgin.im
Mon Aug 10 00:45:36 EDT 2009


-----------------------------------------------------------------
Revision: 9705e1920ecbaa8827ea0cb054fa03be736847c0
Ancestor: 4e33c2f89c7681c06acd63a305040db3f59f1497
Author: qulogic at pidgin.im
Date: 2009-08-10T04:16:40
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9705e1920ecbaa8827ea0cb054fa03be736847c0

Modified files:
        libpurple/protocols/msn/msg.c

ChangeLog: 

Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
your buddies won't be wondering why you never answered their invitation.
This is used for stuff like Whiteboard and Application Sharing.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	e9e4225cbb9324072003f75fac3f40dd0570e4d5
+++ libpurple/protocols/msn/msg.c	795b1a623db46112fd23481325996a6714691973
@@ -1102,6 +1102,7 @@ msn_invite_msg(MsnCmdProc *cmdproc, MsnM
 {
 	GHashTable *body;
 	const gchar *guid;
+	gboolean accepted = FALSE;
 
 	g_return_if_fail(cmdproc != NULL);
 	g_return_if_fail(msg != NULL);
@@ -1129,6 +1130,9 @@ msn_invite_msg(MsnCmdProc *cmdproc, MsnM
 		} else
 			purple_debug_warning("msn", "Invite msg missing "
 					"Application-GUID.\n");
+
+		accepted = TRUE;
+
 	} else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) {
 		purple_debug_info("msn", "Computer call\n");
 
@@ -1160,6 +1164,30 @@ msn_invite_msg(MsnCmdProc *cmdproc, MsnM
 		                     guid, application ? application : "(null)");
 	}
 
+	if (!accepted) {
+		const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie");
+		if (cookie) {
+			MsnSwitchBoard *swboard = cmdproc->data;
+			char *text;
+			MsnMessage *cancel;
+
+			cancel = msn_message_new(MSN_MSG_TEXT);
+			msn_message_set_content_type(cancel, "text/x-msmsgsinvite");
+			msn_message_set_charset(cancel, "UTF-8");
+			msn_message_set_flag(cancel, 'U');
+
+			text = g_strdup_printf("Invitation-Command: CANCEL\r\n"
+			                       "Invitation-Cookie: %s\r\n"
+			                       "Cancel-Code: REJECT_NOT_INSTALLED\r\n",
+			                       cookie);
+			msn_message_set_bin_data(cancel, text, strlen(text));
+			g_free(text);
+
+			msn_switchboard_send_msg(swboard, cancel, TRUE);
+			msn_message_destroy(cancel);
+		}
+	}
+
 	g_hash_table_destroy(body);
 }
 


More information about the Commits mailing list