comparison mcabber/src/roster.c @ 331:1510dda4ad71

Don't loose alternate_buddy when the buddy is moved ("/move")
author Mikael Berthe <mikael@lilotux.net>
date Sun, 17 Jul 2005 22:21:51 +0100
parents a9013124ede6
children eb994ee40029
comparison
equal deleted inserted replaced
330:a9013124ede6 331:1510dda4ad71
529 { 529 {
530 roster *roster_usr = rosterdata; 530 roster *roster_usr = rosterdata;
531 GSList **sl_group; 531 GSList **sl_group;
532 GSList *sl_clone; 532 GSList *sl_clone;
533 roster *roster_clone; 533 roster *roster_clone;
534 int is_alternate;
534 535
535 // A group has no group :) 536 // A group has no group :)
536 if (roster_usr->type & ROSTER_TYPE_GROUP) return; 537 if (roster_usr->type & ROSTER_TYPE_GROUP) return;
537 538
538 // Remove the buddy from current group 539 // Remove the buddy from current group
555 // If new new group is folded, the curren_buddy will be lost, and the 556 // If new new group is folded, the curren_buddy will be lost, and the
556 // chat window won't be correctly refreshed. So we make sure it isn't... 557 // chat window won't be correctly refreshed. So we make sure it isn't...
557 ((roster*)((GSList*)roster_clone->list)->data)->flags &= ~ROSTER_FLAG_HIDE; 558 ((roster*)((GSList*)roster_clone->list)->data)->flags &= ~ROSTER_FLAG_HIDE;
558 559
559 // Little trick to have current_body pointing to the cloned buddy 560 // Little trick to have current_body pointing to the cloned buddy
561 is_alternate = (alternate_buddy == current_buddy);
560 buddylist = g_list_append(buddylist, roster_clone); 562 buddylist = g_list_append(buddylist, roster_clone);
561 current_buddy = g_list_find(buddylist, roster_clone); 563 current_buddy = g_list_find(buddylist, roster_clone);
564 if (is_alternate)
565 alternate_buddy = current_buddy;
562 566
563 buddylist_build(); 567 buddylist_build();
564 } 568 }
565 569
566 void buddy_setname(gpointer rosterdata, char *newname) 570 void buddy_setname(gpointer rosterdata, char *newname)