comparison libpurple/protocols/msn/msg.c @ 30446:538ca314c5f8

More minor fixes. Spelling, extra variables, etc.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 19 Apr 2010 07:11:46 +0000
parents 119bd7b072eb
children 0b22c840f4f4
comparison
equal deleted inserted replaced
30445:ec3bbe476cc1 30446:538ca314c5f8
1122 command = g_hash_table_lookup(body, "Invitation-Command"); 1122 command = g_hash_table_lookup(body, "Invitation-Command");
1123 cookie = g_hash_table_lookup(body, "Invitation-Cookie"); 1123 cookie = g_hash_table_lookup(body, "Invitation-Cookie");
1124 1124
1125 if (command == NULL || cookie == NULL) { 1125 if (command == NULL || cookie == NULL) {
1126 purple_debug_warning("msn", 1126 purple_debug_warning("msn",
1127 "Invalid invitation message: " 1127 "Invalid invitation message: either Invitation-Command "
1128 "either Invitation-Command or Invitation-Cookie is missing or invaild" 1128 "or Invitation-Cookie is missing or invalid.\n"
1129 ); 1129 );
1130 return; 1130 return;
1131 1131
1132 } else if (!strcmp(command, "INVITE")) { 1132 } else if (!strcmp(command, "INVITE")) {
1133
1134 const gchar *guid = g_hash_table_lookup(body, "Application-GUID"); 1133 const gchar *guid = g_hash_table_lookup(body, "Application-GUID");
1135 1134
1136 if (guid == NULL) { 1135 if (guid == NULL) {
1137 const gchar *cmd = g_hash_table_lookup( 1136 if (!strcmp(command, "CANCEL")) {
1138 body, "Invitation-Command");
1139
1140 if (cmd && !strcmp(cmd, "CANCEL")) {
1141 const gchar *code = g_hash_table_lookup( 1137 const gchar *code = g_hash_table_lookup(
1142 body, "Cancel-Code"); 1138 body, "Cancel-Code");
1143 purple_debug_info("msn", 1139 purple_debug_info("msn",
1144 "MSMSGS invitation cancelled: %s.\n", 1140 "MSMSGS invitation cancelled: %s.\n",
1145 code ? code : "no reason given"); 1141 code ? code : "no reason given");
1146 } else 1142 } else
1147 purple_debug_warning("msn", "Invite msg missing " 1143 purple_debug_warning("msn",
1148 "Application-GUID.\n"); 1144 "Invite msg missing Application-GUID.\n");
1149 1145
1150 accepted = TRUE; 1146 accepted = TRUE;
1151 1147
1152 } else if (!strcmp(guid, MSN_FT_GUID)) { 1148 } else if (!strcmp(guid, MSN_FT_GUID)) {
1153 1149
1177 } 1173 }
1178 } 1174 }
1179 } else { 1175 } else {
1180 const gchar *application = g_hash_table_lookup(body, "Application-Name"); 1176 const gchar *application = g_hash_table_lookup(body, "Application-Name");
1181 purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", 1177 purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n",
1182 guid, application ? application : "(null)"); 1178 guid, application ? application : "(null)");
1183 } 1179 }
1184 1180
1185 if (!accepted) { 1181 if (!accepted) {
1186 MsnSwitchBoard *swboard = cmdproc->data; 1182 MsnSwitchBoard *swboard = cmdproc->data;
1187 char *text; 1183 char *text;
1191 msn_message_set_content_type(cancel, "text/x-msmsgsinvite"); 1187 msn_message_set_content_type(cancel, "text/x-msmsgsinvite");
1192 msn_message_set_charset(cancel, "UTF-8"); 1188 msn_message_set_charset(cancel, "UTF-8");
1193 msn_message_set_flag(cancel, 'U'); 1189 msn_message_set_flag(cancel, 'U');
1194 1190
1195 text = g_strdup_printf("Invitation-Command: CANCEL\r\n" 1191 text = g_strdup_printf("Invitation-Command: CANCEL\r\n"
1196 "Invitation-Cookie: %s\r\n" 1192 "Invitation-Cookie: %s\r\n"
1197 "Cancel-Code: REJECT_NOT_INSTALLED\r\n", 1193 "Cancel-Code: REJECT_NOT_INSTALLED\r\n",
1198 cookie); 1194 cookie);
1199 msn_message_set_bin_data(cancel, text, strlen(text)); 1195 msn_message_set_bin_data(cancel, text, strlen(text));
1200 g_free(text); 1196 g_free(text);
1201 1197
1202 msn_switchboard_send_msg(swboard, cancel, TRUE); 1198 msn_switchboard_send_msg(swboard, cancel, TRUE);
1203 msn_message_destroy(cancel); 1199 msn_message_destroy(cancel);
1204 } 1200 }
1205 1201
1206 } else { 1202 } else {
1207 /* 1203 /*
1208 * Some other already estabilished invitation session. 1204 * Some other already established invitation session.
1209 * Can be retrieved by Invitation-Cookie. 1205 * Can be retrieved by Invitation-Cookie.
1210 */ 1206 */
1211 } 1207 }
1212 1208
1213 g_hash_table_destroy(body); 1209 g_hash_table_destroy(body);