comparison src/protocols/msn/notification.c @ 5363:ebebc833cf77

[gaim-migrate @ 5739] You can now set your home, work, and mobile phone numbers. Trust me, I'm going somewhere with all this. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 13 May 2003 08:03:27 +0000
parents 953aa05279f4
children 379beab3d157
comparison
equal deleted inserted replaced
5362:a206742d470d 5363:ebebc833cf77
429 429
430 static gboolean 430 static gboolean
431 __bpr_cmd(MsnServConn *servconn, const char *command, const char **params, 431 __bpr_cmd(MsnServConn *servconn, const char *command, const char **params,
432 size_t param_count) 432 size_t param_count)
433 { 433 {
434 struct gaim_connection *gc = servconn->session->account->gc; 434 MsnSession *session = servconn->session;
435 struct gaim_connection *gc = session->account->gc;
435 struct buddy *b; 436 struct buddy *b;
436 const char *passport, *type, *value; 437 const char *passport, *type, *value;
437 int status = 0; 438 int status = 0;
439 MsnUser *user;
438 440
439 passport = params[1]; 441 passport = params[1];
440 type = params[2]; 442 type = params[2];
441 value = params[3]; 443 value = params[3];
442 444
443 if (!strcmp(type, "MOB")) { 445 user = msn_users_find_with_passport(session->users, passport);
444 if (value != NULL && !strcmp(value, "Y")) { 446
445 gaim_debug(GAIM_DEBUG_MISC, "msn", 447 if (value != NULL) {
446 "%s has a pager\n", passport); 448 if (!strcmp(type, "MOB")) {
447 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) { 449 if (!strcmp(value, "Y")) {
448 status = b->uc | (1 << 5); 450 gaim_debug(GAIM_DEBUG_MISC, "msn",
449 451 "%s has a pager\n", passport);
450 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); 452 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
453 status = b->uc | (1 << 5);
454
455 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
456 }
451 } 457 }
452 } 458 }
459 else if (!strcmp(type, "PHH"))
460 msn_user_set_home_phone(user, msn_url_decode(value));
461 else if (!strcmp(type, "PHW"))
462 msn_user_set_work_phone(user, msn_url_decode(value));
463 else if (!strcmp(type, "PHM"))
464 msn_user_set_mobile_phone(user, msn_url_decode(value));
453 } 465 }
454 466
455 return TRUE; 467 return TRUE;
456 } 468 }
457 469
694 } 706 }
695 707
696 b = gaim_buddy_new(gc->account, 708 b = gaim_buddy_new(gc->account,
697 msn_user_get_passport(user), NULL); 709 msn_user_get_passport(user), NULL);
698 710
711 b->proto_data = user;
712
699 gaim_blist_add_buddy(b, g, NULL); 713 gaim_blist_add_buddy(b, g, NULL);
700 } 714 }
701 715
702 serv_got_alias(gc, (char *)msn_user_get_passport(user), 716 serv_got_alias(gc, (char *)msn_user_get_passport(user),
703 (char *)msn_user_get_name(user)); 717 (char *)msn_user_get_name(user));
704
705 msn_user_destroy(user);
706 } 718 }
707 } 719 }
708 720
709 return TRUE; 721 return TRUE;
710 } 722 }
738 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); 750 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
739 else if (!g_ascii_strcasecmp(state, "LUN")) 751 else if (!g_ascii_strcasecmp(state, "LUN"))
740 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); 752 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
741 753
742 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); 754 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
755
756 return TRUE;
757 }
758
759 static gboolean
760 __prp_cmd(MsnServConn *servconn, const char *command, const char **params,
761 size_t param_count)
762 {
763 MsnSession *session = servconn->session;
764 const char *type, *value;
765
766 type = params[2];
767 value = params[3];
768
769 if (param_count == 4) {
770 if (!strcmp(type, "PHH"))
771 msn_user_set_home_phone(session->user, msn_url_decode(value));
772 else if (!strcmp(type, "PHW"))
773 msn_user_set_work_phone(session->user, msn_url_decode(value));
774 else if (!strcmp(type, "PHM"))
775 msn_user_set_mobile_phone(session->user, msn_url_decode(value));
776 }
743 777
744 return TRUE; 778 return TRUE;
745 } 779 }
746 780
747 static gboolean 781 static gboolean
1194 hide_login_progress(gc, _("Unable to write to server")); 1228 hide_login_progress(gc, _("Unable to write to server"));
1195 signoff(gc); 1229 signoff(gc);
1196 return FALSE; 1230 return FALSE;
1197 } 1231 }
1198 1232
1233 session->user = msn_user_new(session, gc->username, NULL);
1234
1199 set_login_progress(session->account->gc, 4, _("Syncing with server")); 1235 set_login_progress(session->account->gc, 4, _("Syncing with server"));
1200 1236
1201 return TRUE; 1237 return TRUE;
1202 } 1238 }
1203 1239
1239 msn_servconn_register_command(notification, "LSG", __lsg_cmd); 1275 msn_servconn_register_command(notification, "LSG", __lsg_cmd);
1240 msn_servconn_register_command(notification, "LST", __lst_cmd); 1276 msn_servconn_register_command(notification, "LST", __lst_cmd);
1241 msn_servconn_register_command(notification, "MSG", __msg_cmd); 1277 msn_servconn_register_command(notification, "MSG", __msg_cmd);
1242 msn_servconn_register_command(notification, "NLN", __nln_cmd); 1278 msn_servconn_register_command(notification, "NLN", __nln_cmd);
1243 msn_servconn_register_command(notification, "OUT", __out_cmd); 1279 msn_servconn_register_command(notification, "OUT", __out_cmd);
1244 msn_servconn_register_command(notification, "PRP", __blank_cmd); 1280 msn_servconn_register_command(notification, "PRP", __prp_cmd);
1245 msn_servconn_register_command(notification, "QNG", __blank_cmd); 1281 msn_servconn_register_command(notification, "QNG", __blank_cmd);
1246 msn_servconn_register_command(notification, "QRY", __blank_cmd); 1282 msn_servconn_register_command(notification, "QRY", __blank_cmd);
1247 msn_servconn_register_command(notification, "REA", __rea_cmd); 1283 msn_servconn_register_command(notification, "REA", __rea_cmd);
1248 msn_servconn_register_command(notification, "REG", __reg_cmd); 1284 msn_servconn_register_command(notification, "REG", __reg_cmd);
1249 msn_servconn_register_command(notification, "REM", __rem_cmd); 1285 msn_servconn_register_command(notification, "REM", __rem_cmd);