comparison src/protocols/msn/notification.c @ 9194:364aa73323b5

[gaim-migrate @ 9989] A few things here. First, some spelling corrections. Second, make sure we always send a group ID when we add somebody. Default to 0 if nothing else. We were sending an ADD in some cases without a group ID, and then MSN sent back a 224 - Invalid Group (I swear that never happened before?), and we misinterpreted the error and figured the passport was invalid. Third, don't spit out the "Unhandled command 'BLP'" errors. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 03:19:41 +0000
parents 502707ca1836
children ec417d2f9666
comparison
equal deleted inserted replaced
9193:502707ca1836 9194:364aa73323b5
442 MsnSession *session; 442 MsnSession *session;
443 GaimConnection *gc; 443 GaimConnection *gc;
444 MsnUser *user; 444 MsnUser *user;
445 MsnObject *msnobj; 445 MsnObject *msnobj;
446 int status = 0; 446 int status = 0;
447 int idle = 0;
447 const char *state, *passport, *friendly; 448 const char *state, *passport, *friendly;
448 GaimBuddy *b; 449 GaimBuddy *b;
449 450
450 session = cmdproc->session; 451 session = cmdproc->session;
451 gc = session->account->gc; 452 gc = session->account->gc;
471 status |= ((((b->uc) >> 1) & 0xF0) << 1); 472 status |= ((((b->uc) >> 1) & 0xF0) << 1);
472 473
473 if (!g_ascii_strcasecmp(state, "BSY")) 474 if (!g_ascii_strcasecmp(state, "BSY"))
474 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); 475 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
475 else if (!g_ascii_strcasecmp(state, "IDL")) 476 else if (!g_ascii_strcasecmp(state, "IDL"))
477 {
476 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); 478 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
479 idle = -1;
480 }
477 else if (!g_ascii_strcasecmp(state, "BRB")) 481 else if (!g_ascii_strcasecmp(state, "BRB"))
478 status |= UC_UNAVAILABLE | (MSN_BRB << 1); 482 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
479 else if (!g_ascii_strcasecmp(state, "AWY")) 483 else if (!g_ascii_strcasecmp(state, "AWY"))
480 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); 484 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
481 else if (!g_ascii_strcasecmp(state, "PHN")) 485 else if (!g_ascii_strcasecmp(state, "PHN"))
482 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); 486 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
483 else if (!g_ascii_strcasecmp(state, "LUN")) 487 else if (!g_ascii_strcasecmp(state, "LUN"))
484 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); 488 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
485 489
486 serv_got_update(gc, passport, 1, 0, 0, 0, status); 490 serv_got_update(gc, passport, 1, 0, 0, idle, status);
487 } 491 }
488 492
489 static void 493 static void
490 ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) 494 ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
491 { 495 {
510 MsnObject *msnobj; 514 MsnObject *msnobj;
511 const char *state; 515 const char *state;
512 const char *passport; 516 const char *passport;
513 const char *friendly; 517 const char *friendly;
514 int status = 0; 518 int status = 0;
519 int idle = 0;
515 520
516 session = cmdproc->session; 521 session = cmdproc->session;
517 gc = session->account->gc; 522 gc = session->account->gc;
518 523
519 state = cmd->params[0]; 524 state = cmd->params[0];
534 } 539 }
535 540
536 if (!g_ascii_strcasecmp(state, "BSY")) 541 if (!g_ascii_strcasecmp(state, "BSY"))
537 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); 542 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
538 else if (!g_ascii_strcasecmp(state, "IDL")) 543 else if (!g_ascii_strcasecmp(state, "IDL"))
544 {
539 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); 545 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
546 idle = -1;
547 }
540 else if (!g_ascii_strcasecmp(state, "BRB")) 548 else if (!g_ascii_strcasecmp(state, "BRB"))
541 status |= UC_UNAVAILABLE | (MSN_BRB << 1); 549 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
542 else if (!g_ascii_strcasecmp(state, "AWY")) 550 else if (!g_ascii_strcasecmp(state, "AWY"))
543 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); 551 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
544 else if (!g_ascii_strcasecmp(state, "PHN")) 552 else if (!g_ascii_strcasecmp(state, "PHN"))
545 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); 553 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
546 else if (!g_ascii_strcasecmp(state, "LUN")) 554 else if (!g_ascii_strcasecmp(state, "LUN"))
547 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); 555 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
548 556
549 serv_got_update(gc, passport, 1, 0, 0, 0, status); 557 serv_got_update(gc, passport, 1, 0, 0, idle, status);
550 } 558 }
551 559
552 static void 560 static void
553 chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 561 chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
554 { 562 {
1128 int group_id) 1136 int group_id)
1129 { 1137 {
1130 MsnCmdProc *cmdproc; 1138 MsnCmdProc *cmdproc;
1131 cmdproc = notification->servconn->cmdproc; 1139 cmdproc = notification->servconn->cmdproc;
1132 1140
1133 if (group_id >= 0) 1141 if (group_id < 0)
1134 { 1142 group_id = 0;
1135 msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", list, who, 1143
1136 store_name, group_id); 1144 msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d",
1137 } 1145 list, who, store_name, group_id);
1138 else
1139 {
1140 msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who,
1141 store_name);
1142 }
1143 } 1146 }
1144 1147
1145 void 1148 void
1146 msn_notification_rem_buddy(MsnNotification *notification, const char *list, 1149 msn_notification_rem_buddy(MsnNotification *notification, const char *list,
1147 const char *who, int group_id) 1150 const char *who, int group_id)
1179 msn_table_add_cmd(cbs_table, "INF", "INF", inf_cmd); 1182 msn_table_add_cmd(cbs_table, "INF", "INF", inf_cmd);
1180 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); 1183 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd);
1181 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); 1184 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd);
1182 /* msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); */ 1185 /* msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); */
1183 /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */ 1186 /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */
1187 msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL);
1184 msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); 1188 msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd);
1185 msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); 1189 msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd);
1186 msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); 1190 msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd);
1187 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); 1191 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd);
1188 1192
1202 msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); 1206 msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd);
1203 msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); 1207 msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd);
1204 msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); 1208 msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd);
1205 1209
1206 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); 1210 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd);
1207 1211
1208 /* msn_table_add_cmd(cbs_table, NULL, "XFR", xfr_cmd); */ 1212 /* msn_table_add_cmd(cbs_table, NULL, "XFR", xfr_cmd); */
1209 1213
1210 msn_table_add_error(cbs_table, "ADD", add_error); 1214 msn_table_add_error(cbs_table, "ADD", add_error);
1211 /* msn_table_add_error(cbs_table, "REA", rea_error); */ 1215 /* msn_table_add_error(cbs_table, "REA", rea_error); */
1212 1216