comparison libpurple/protocols/msn/notification.c @ 31558:ce968e115c95

propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64) to branch 'im.pidgin.pidgin' (head 92f47f4e8b0cbb107fd97e1ab814d1cedbf109ad)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 06 May 2011 06:25:14 +0000
parents 7b021b6a09af
children 747c5be08e81
comparison
equal deleted inserted replaced
31557:f021d93a1f9b 31558:ce968e115c95
1097 } 1097 }
1098 g_free(friendly); 1098 g_free(friendly);
1099 1099
1100 msn_user_set_object(user, msnobj); 1100 msn_user_set_object(user, msnobj);
1101 1101
1102 user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+'); 1102 user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
1103 msn_user_set_clientid(user, clientid); 1103 msn_user_set_clientid(user, clientid);
1104 msn_user_set_extcaps(user, extcaps); 1104 msn_user_set_extcaps(user, extcaps);
1105 msn_user_set_network(user, networkid); 1105 msn_user_set_network(user, networkid);
1106 1106
1107 msn_user_set_state(user, state); 1107 msn_user_set_state(user, state);
1184 who = user->passport; 1184 who = user->passport;
1185 } 1185 }
1186 1186
1187 id = xmlnode_get_attrib(msg, "id"); 1187 id = xmlnode_get_attrib(msg, "id");
1188 1188
1189 if (id && !strcmp(id, "407")) { 1189 if (id && strcmp(id, "1")) {
1190 PurpleConversation *conv 1190 PurpleConversation *conv
1191 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, 1191 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
1192 who, gc->account); 1192 who, gc->account);
1193 if (conv != NULL) { 1193 if (conv != NULL) {
1194 purple_conversation_write(conv, NULL, 1194 const char *error;
1195 _("Mobile message was not sent because it was too long."), 1195 if (!strcmp(id, "407"))
1196 error = _("Mobile message was not sent because it was too long.");
1197 else
1198 error = _("Mobile message was not sent because an unknown error occurred.");
1199
1200 purple_conversation_write(conv, NULL, error,
1196 PURPLE_MESSAGE_ERROR, time(NULL)); 1201 PURPLE_MESSAGE_ERROR, time(NULL));
1197 1202
1198 if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) { 1203 if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) {
1199 unsigned int trId = atol(id); 1204 unsigned int trId = atol(id);
1200 MsnTransaction *trans; 1205 MsnTransaction *trans;
1201 MsnMessage *msg;
1202 1206
1203 trans = msn_history_find(cmdproc->history, trId); 1207 trans = msn_history_find(cmdproc->history, trId);
1204 msg = (MsnMessage *)trans->data; 1208 if (trans) {
1205 1209 MsnMessage *msg = (MsnMessage *)trans->data;
1206 if (msg) { 1210
1207 char *body_str = msn_message_to_string(msg); 1211 if (msg) {
1208 char *body_enc = g_markup_escape_text(body_str, -1); 1212 char *body_str = msn_message_to_string(msg);
1209 1213 char *body_enc = g_markup_escape_text(body_str, -1);
1210 purple_conversation_write(conv, NULL, body_enc, 1214
1211 PURPLE_MESSAGE_RAW, time(NULL)); 1215 purple_conversation_write(conv, NULL, body_enc,
1212 1216 PURPLE_MESSAGE_RAW, time(NULL));
1213 g_free(body_str); 1217
1214 g_free(body_enc); 1218 g_free(body_str);
1215 msn_message_unref(msg); 1219 g_free(body_enc);
1216 trans->data = NULL; 1220 msn_message_unref(msg);
1221 trans->data = NULL;
1222 }
1217 } 1223 }
1218 } 1224 }
1219 } 1225 }
1220 } else { 1226 } else {
1221 serv_got_im(gc, who, text, 0, time(NULL)); 1227 serv_got_im(gc, who, text, 0, time(NULL));
1272 if (session->protocol_ver >= 16 && extcap_str && *extcap_str) 1278 if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
1273 extcaps = strtoul(extcap_str+1, NULL, 10); 1279 extcaps = strtoul(extcap_str+1, NULL, 10);
1274 else 1280 else
1275 extcaps = 0; 1281 extcaps = 0;
1276 1282
1277 user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+'); 1283 user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
1278 1284
1279 msn_user_set_clientid(user, clientid); 1285 msn_user_set_clientid(user, clientid);
1280 msn_user_set_extcaps(user, extcaps); 1286 msn_user_set_extcaps(user, extcaps);
1281 msn_user_set_network(user, networkid); 1287 msn_user_set_network(user, networkid);
1282 1288
2214 2220
2215 g_hash_table_destroy(table); 2221 g_hash_table_destroy(table);
2216 } 2222 }
2217 2223
2218 /************************************************************************** 2224 /**************************************************************************
2219 * Dispatch server list management 2225 * Dispatch server list management
2220 **************************************************************************/ 2226 **************************************************************************/
2221 typedef struct MsnAddRemoveListData { 2227 typedef struct MsnAddRemoveListData {
2222 MsnCmdProc *cmdproc; 2228 MsnCmdProc *cmdproc;
2223 MsnUser *user; 2229 MsnUser *user;
2224 MsnListOp list_op; 2230 MsnListOp list_op;