comparison libpurple/protocols/msn/notification.c @ 20402:00e7d8ded567

propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-pidgin' (head 8cfbe223ca6e514146a4d46aeab4c7816de17b79) to branch 'im.pidgin.cpw.khc.msnp14' (head d64cf2078da03ec91620a88bb3408d3eb14a19e2)
author Richard Laager <rlaager@wiktel.com>
date Sun, 15 Apr 2007 05:01:55 +0000
parents 6f986caeab59
children 522ade544156
comparison
equal deleted inserted replaced
20401:4ddc27c18781 20402:00e7d8ded567
309 session = cmdproc->session; 309 session = cmdproc->session;
310 account = session->account; 310 account = session->account;
311 311
312 g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); 312 g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver);
313 313
314 for (i = 1; i < cmd->param_count; i++) 314 for (i = 1; i < cmd->param_count -1; i++)
315 { 315 {
316 if (!strcmp(cmd->params[i], proto_str)) 316 purple_debug_info("MaYuan","%s,proto_str:%s\n",cmd->params[i],proto_str);
317 if (strcmp(cmd->params[i], proto_str) >= 0)
317 { 318 {
318 protocol_supported = TRUE; 319 protocol_supported = TRUE;
319 break; 320 break;
320 } 321 }
321 } 322 }
322 323
323 if (!protocol_supported) 324 if (!protocol_supported){
324 {
325 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, 325 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL,
326 NULL); 326 NULL);
327 return; 327 return;
328 } 328 }
329 329
904 904
905 msn_user_set_friendly_name(user, friendly); 905 msn_user_set_friendly_name(user, friendly);
906 906
907 if (session->protocol_ver >= 9 && cmd->param_count == 8) 907 if (session->protocol_ver >= 9 && cmd->param_count == 8)
908 { 908 {
909 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); 909 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[6]));
910 msn_user_set_object(user, msnobj); 910 msn_user_set_object(user, msnobj);
911 } 911 }
912 912
913 msn_user_set_state(user, state); 913 msn_user_set_state(user, state);
914 msn_user_update(user); 914 msn_user_update(user);
961 961
962 if (session->protocol_ver >= 9) 962 if (session->protocol_ver >= 9)
963 { 963 {
964 if (cmd->param_count == 7) 964 if (cmd->param_count == 7)
965 { 965 {
966 msnobj = 966 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5]));
967 msn_object_new_from_string(purple_url_decode(cmd->params[4]));
968 msn_user_set_object(user, msnobj); 967 msn_user_set_object(user, msnobj);
969 } 968 }
970 else 969 else
971 { 970 {
972 msn_user_set_object(user, NULL); 971 msn_user_set_object(user, NULL);
1441 MsnSession *session; 1440 MsnSession *session;
1442 PurpleAccount *account; 1441 PurpleAccount *account;
1443 PurpleConnection *gc; 1442 PurpleConnection *gc;
1444 MsnUser *user; 1443 MsnUser *user;
1445 const char *passport; 1444 const char *passport;
1446 char *psm_str; 1445 char *psm_str, *currentmedia_str;
1447 1446
1448 /*get the payload content*/ 1447 /*get the payload content*/
1449 // purple_debug_info("MaYuan","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload); 1448 // purple_debug_info("MaYuan","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload);
1450 1449
1451 session = cmdproc->session; 1450 session = cmdproc->session;
1454 1453
1455 passport = cmd->params[0]; 1454 passport = cmd->params[0];
1456 user = msn_userlist_find_user(session->userlist, passport); 1455 user = msn_userlist_find_user(session->userlist, passport);
1457 1456
1458 psm_str = msn_get_psm(cmd->payload,len); 1457 psm_str = msn_get_psm(cmd->payload,len);
1458 currentmedia_str = msn_parse_currentmedia(
1459 msn_get_currentmedia(cmd->payload, len));
1460
1459 msn_user_set_statusline(user, psm_str); 1461 msn_user_set_statusline(user, psm_str);
1462 msn_user_set_currentmedia(user, currentmedia_str);
1460 msn_user_update(user); 1463 msn_user_update(user);
1461 1464
1462 g_free(psm_str); 1465 g_free(psm_str);
1466 g_free(currentmedia_str);
1463 } 1467 }
1464 1468
1465 static void 1469 static void
1466 ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 1470 ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
1467 { 1471 {
1494 1498
1495 if (strcmp(msg->remote_user, "Hotmail")) 1499 if (strcmp(msg->remote_user, "Hotmail"))
1496 /* This isn't an official message. */ 1500 /* This isn't an official message. */
1497 return; 1501 return;
1498 1502
1499 if ((value = msn_message_get_attr(msg, "kv")) != NULL) 1503 if ((value = msn_message_get_attr(msg, "kv")) != NULL){
1500 {
1501 if (session->passport_info.kv != NULL) 1504 if (session->passport_info.kv != NULL)
1502 g_free(session->passport_info.kv); 1505 g_free(session->passport_info.kv);
1503 1506
1504 session->passport_info.kv = g_strdup(value); 1507 session->passport_info.kv = g_strdup(value);
1505 } 1508 }
1506 1509
1507 if ((value = msn_message_get_attr(msg, "sid")) != NULL) 1510 if ((value = msn_message_get_attr(msg, "sid")) != NULL){
1508 {
1509 if (session->passport_info.sid != NULL) 1511 if (session->passport_info.sid != NULL)
1510 g_free(session->passport_info.sid); 1512 g_free(session->passport_info.sid);
1511 1513
1512 session->passport_info.sid = g_strdup(value); 1514 session->passport_info.sid = g_strdup(value);
1513 } 1515 }
1528 1530
1529 session->passport_info.client_ip = g_strdup(value); 1531 session->passport_info.client_ip = g_strdup(value);
1530 } 1532 }
1531 1533
1532 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) 1534 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL)
1533 { 1535 {
1534 session->passport_info.client_port = ntohs(atoi(value)); 1536 session->passport_info.client_port = ntohs(atoi(value));
1535 } 1537 }
1536 1538
1537 if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) 1539 if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL)
1538 session->passport_info.sl = atol(value); 1540 session->passport_info.sl = atol(value);
1539 1541
1540 /*starting retrieve the contact list*/ 1542 /*starting retrieve the contact list*/
1741 1743
1742 switch (type) 1744 switch (type)
1743 { 1745 {
1744 case 1: 1746 case 1:
1745 minutes = atoi(g_hash_table_lookup(table, "Arg1")); 1747 minutes = atoi(g_hash_table_lookup(table, "Arg1"));
1746 g_snprintf(buf, sizeof(buf), ngettext( 1748 g_snprintf(buf, sizeof(buf), dngettext(PACKAGE,
1747 "The MSN server will shut down for maintenance " 1749 "The MSN server will shut down for maintenance "
1748 "in %d minute. You will automatically be " 1750 "in %d minute. You will automatically be "
1749 "signed out at that time. Please finish any " 1751 "signed out at that time. Please finish any "
1750 "conversations in progress.\n\nAfter the " 1752 "conversations in progress.\n\nAfter the "
1751 "maintenance has been completed, you will be " 1753 "maintenance has been completed, you will be "