libpurple/protocols/msn/msg.c

changeset 28146
796c252c735e
parent 28145
95c36b80165a
child 28264
d57edb4145aa
child 29457
15f977c9ac76
equal deleted inserted replaced
28145:95c36b80165a 28146:796c252c735e
1100 void 1100 void
1101 msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 1101 msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
1102 { 1102 {
1103 GHashTable *body; 1103 GHashTable *body;
1104 const gchar *guid; 1104 const gchar *guid;
1105 gboolean accepted = FALSE;
1105 1106
1106 g_return_if_fail(cmdproc != NULL); 1107 g_return_if_fail(cmdproc != NULL);
1107 g_return_if_fail(msg != NULL); 1108 g_return_if_fail(msg != NULL);
1108 1109
1109 body = msn_message_get_hashtable_from_body(msg); 1110 body = msn_message_get_hashtable_from_body(msg);
1127 "MSMSGS invitation cancelled: %s.\n", 1128 "MSMSGS invitation cancelled: %s.\n",
1128 code ? code : "no reason given"); 1129 code ? code : "no reason given");
1129 } else 1130 } else
1130 purple_debug_warning("msn", "Invite msg missing " 1131 purple_debug_warning("msn", "Invite msg missing "
1131 "Application-GUID.\n"); 1132 "Application-GUID.\n");
1133
1134 accepted = TRUE;
1135
1132 } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { 1136 } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) {
1133 purple_debug_info("msn", "Computer call\n"); 1137 purple_debug_info("msn", "Computer call\n");
1134 1138
1135 if (cmdproc->session) { 1139 if (cmdproc->session) {
1136 PurpleConversation *conv = NULL; 1140 PurpleConversation *conv = NULL;
1158 const gchar *application = g_hash_table_lookup(body, "Application-Name"); 1162 const gchar *application = g_hash_table_lookup(body, "Application-Name");
1159 purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", 1163 purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n",
1160 guid, application ? application : "(null)"); 1164 guid, application ? application : "(null)");
1161 } 1165 }
1162 1166
1167 if (!accepted) {
1168 const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie");
1169 if (cookie) {
1170 MsnSwitchBoard *swboard = cmdproc->data;
1171 char *text;
1172 MsnMessage *cancel;
1173
1174 cancel = msn_message_new(MSN_MSG_TEXT);
1175 msn_message_set_content_type(cancel, "text/x-msmsgsinvite");
1176 msn_message_set_charset(cancel, "UTF-8");
1177 msn_message_set_flag(cancel, 'U');
1178
1179 text = g_strdup_printf("Invitation-Command: CANCEL\r\n"
1180 "Invitation-Cookie: %s\r\n"
1181 "Cancel-Code: REJECT_NOT_INSTALLED\r\n",
1182 cookie);
1183 msn_message_set_bin_data(cancel, text, strlen(text));
1184 g_free(text);
1185
1186 msn_switchboard_send_msg(swboard, cancel, TRUE);
1187 msn_message_destroy(cancel);
1188 }
1189 }
1190
1163 g_hash_table_destroy(body); 1191 g_hash_table_destroy(body);
1164 } 1192 }
1165 1193
1166 /* Only called from chats. Handwritten messages for IMs come as a SLP message */ 1194 /* Only called from chats. Handwritten messages for IMs come as a SLP message */
1167 void 1195 void

mercurial