comparison src/server.c @ 6695:0c5637b5462e

[gaim-migrate @ 7221] This is contact support. Really. It has a few bugs left in it, like sorting not working, and stuff like that, but it's pretty solid for the most part. I'm not in the mood to do a whole lot of typing, so just use and enjoy. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 02 Sep 2003 03:41:10 +0000
parents 314111e7b601
children faa491042c66
comparison
equal deleted inserted replaced
6694:2d2f04c5c7d2 6695:0c5637b5462e
514 } 514 }
515 515
516 /* 516 /*
517 * Set buddy's alias on server roster/list 517 * Set buddy's alias on server roster/list
518 */ 518 */
519 void serv_alias_buddy(struct buddy *b) 519 void serv_alias_buddy(GaimBuddy *b)
520 { 520 {
521 GaimPluginProtocolInfo *prpl_info = NULL; 521 GaimPluginProtocolInfo *prpl_info = NULL;
522 522
523 if (b != NULL && b->account->gc->prpl != NULL) 523 if (b != NULL && b->account->gc->prpl != NULL)
524 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); 524 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
527 prpl_info->alias_buddy(b->account->gc, b->name, b->alias); 527 prpl_info->alias_buddy(b->account->gc, b->name, b->alias);
528 } 528 }
529 } 529 }
530 530
531 void serv_got_alias(GaimConnection *gc, const char *who, const char *alias) { 531 void serv_got_alias(GaimConnection *gc, const char *who, const char *alias) {
532 struct buddy *b = gaim_find_buddy(gc->account, who); 532 GaimBuddy *b = gaim_find_buddy(gc->account, who);
533 533
534 if(!b) 534 if(!b)
535 return; 535 return;
536 536
537 gaim_blist_server_alias_buddy(b, alias); 537 gaim_blist_server_alias_buddy(b, alias);
541 * Move a buddy from one group to another on server. 541 * Move a buddy from one group to another on server.
542 * 542 *
543 * Note: For now we'll not deal with changing gc's at the same time, but 543 * Note: For now we'll not deal with changing gc's at the same time, but
544 * it should be possible. Probably needs to be done, someday. 544 * it should be possible. Probably needs to be done, someday.
545 */ 545 */
546 void serv_move_buddy(struct buddy *b, struct group *og, struct group *ng) 546 void serv_move_buddy(GaimBuddy *b, GaimGroup *og, GaimGroup *ng)
547 { 547 {
548 GaimPluginProtocolInfo *prpl_info = NULL; 548 GaimPluginProtocolInfo *prpl_info = NULL;
549 549
550 if (b->account->gc != NULL && b->account->gc->prpl != NULL) 550 if (b->account->gc != NULL && b->account->gc->prpl != NULL)
551 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); 551 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
558 } 558 }
559 559
560 /* 560 /*
561 * Rename a group on server roster/list. 561 * Rename a group on server roster/list.
562 */ 562 */
563 void serv_rename_group(GaimConnection *g, struct group *old_group, 563 void serv_rename_group(GaimConnection *g, GaimGroup *old_group,
564 const char *new_name) 564 const char *new_name)
565 { 565 {
566 GaimPluginProtocolInfo *prpl_info = NULL; 566 GaimPluginProtocolInfo *prpl_info = NULL;
567 567
568 if (g != NULL && g->prpl != NULL) 568 if (g != NULL && g->prpl != NULL)
569 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 569 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
570 570
571 if (prpl_info && old_group && new_name) { 571 if (prpl_info && old_group && new_name) {
572 GList *tobemoved = NULL; 572 GList *tobemoved = NULL;
573 GaimBlistNode *b = ((GaimBlistNode*)old_group)->child; 573 GaimBlistNode *cnode, *bnode;
574 574
575 while (b) { 575 for(cnode = ((GaimBlistNode*)old_group)->child; cnode; cnode = cnode->next) {
576 if(GAIM_BLIST_NODE_IS_BUDDY(b)) { 576 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
577 struct buddy *bd = (struct buddy *)b; 577 continue;
578 if (bd->account == g->account) 578 for(bnode = cnode->child; bnode; bnode = bnode->next) {
579 tobemoved = g_list_append(tobemoved, bd->name); 579 GaimBuddy *b;
580 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
581 continue;
582 b = (GaimBuddy*)bnode;
583
584 if(b->account == g->account)
585 tobemoved = g_list_append(tobemoved, b->name);
586
580 } 587 }
581 b = b->next; 588
582 } 589 }
583 590
584 if (prpl_info->rename_group) { 591 if (prpl_info->rename_group) {
585 /* prpl's might need to check if the group already 592 /* prpl's might need to check if the group already
586 * exists or not, and handle that differently */ 593 * exists or not, and handle that differently */
888 * things we have to do for each. 895 * things we have to do for each.
889 */ 896 */
890 if (gc->away) { 897 if (gc->away) {
891 time_t t = time(NULL); 898 time_t t = time(NULL);
892 char *tmpmsg; 899 char *tmpmsg;
893 struct buddy *b = gaim_find_buddy(gc->account, name); 900 GaimBuddy *b = gaim_find_buddy(gc->account, name);
894 char *alias = b ? gaim_get_buddy_alias(b) : name; 901 const char *alias = b ? gaim_get_buddy_alias(b) : name;
895 int row; 902 int row;
896 struct last_auto_response *lar; 903 struct last_auto_response *lar;
897 904
898 /* 905 /*
899 * Either we're going to queue it or not. Because of the way 906 * Either we're going to queue it or not. Because of the way
1071 void serv_got_update(GaimConnection *gc, const char *name, int loggedin, 1078 void serv_got_update(GaimConnection *gc, const char *name, int loggedin,
1072 int evil, time_t signon, time_t idle, int type) 1079 int evil, time_t signon, time_t idle, int type)
1073 { 1080 {
1074 GaimAccount *account; 1081 GaimAccount *account;
1075 GaimConversation *c; 1082 GaimConversation *c;
1076 struct buddy *b; 1083 GaimBuddy *b;
1077 GSList *buddies; 1084 GSList *buddies;
1078 1085
1079 account = gaim_connection_get_account(gc); 1086 account = gaim_connection_get_account(gc);
1080 b = gaim_find_buddy(account, name); 1087 b = gaim_find_buddy(account, name);
1081 1088
1231 } 1238 }
1232 1239
1233 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, 1240 void serv_got_typing(GaimConnection *gc, const char *name, int timeout,
1234 GaimTypingState state) { 1241 GaimTypingState state) {
1235 1242
1236 struct buddy *b; 1243 GaimBuddy *b;
1237 GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account); 1244 GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account);
1238 GaimIm *im; 1245 GaimIm *im;
1239 1246
1240 if (!cnv) 1247 if (!cnv)
1241 return; 1248 return;
1263 1270
1264 void serv_got_typing_stopped(GaimConnection *gc, const char *name) { 1271 void serv_got_typing_stopped(GaimConnection *gc, const char *name) {
1265 1272
1266 GaimConversation *c = gaim_find_conversation_with_account(name, gc->account); 1273 GaimConversation *c = gaim_find_conversation_with_account(name, gc->account);
1267 GaimIm *im; 1274 GaimIm *im;
1268 struct buddy *b; 1275 GaimBuddy *b;
1269 1276
1270 if (!c) 1277 if (!c)
1271 return; 1278 return;
1272 1279
1273 im = GAIM_IM(c); 1280 im = GAIM_IM(c);