mcabber/src/roster.c
changeset 330 a9013124ede6
parent 318 45076d02eeef
child 331 1510dda4ad71
equal deleted inserted replaced
329:7c53bf62a2a2 330:a9013124ede6
    44 static int hide_offline_buddies;
    44 static int hide_offline_buddies;
    45 static GSList *groups;
    45 static GSList *groups;
    46 static GSList *unread_list;
    46 static GSList *unread_list;
    47 GList *buddylist;
    47 GList *buddylist;
    48 GList *current_buddy;
    48 GList *current_buddy;
       
    49 GList *alternate_buddy;
    49 
    50 
    50 
    51 
    51 /* ### Roster functions ### */
    52 /* ### Roster functions ### */
    52 
    53 
    53 // Comparison function used to search in the roster (compares jids and types)
    54 // Comparison function used to search in the roster (compares jids and types)
   417 void buddylist_build(void)
   418 void buddylist_build(void)
   418 {
   419 {
   419   GSList *sl_roster_elt = groups;
   420   GSList *sl_roster_elt = groups;
   420   roster *roster_elt;
   421   roster *roster_elt;
   421   roster *roster_current_buddy = NULL;
   422   roster *roster_current_buddy = NULL;
       
   423   roster *roster_alternate_buddy = NULL;
   422   int shrunk_group;
   424   int shrunk_group;
   423 
   425 
   424   // We need to remember which buddy is selected.
   426   // We need to remember which buddy is selected.
   425   if (current_buddy)
   427   if (current_buddy)
   426     roster_current_buddy = BUDDATA(current_buddy);
   428     roster_current_buddy = BUDDATA(current_buddy);
   427   current_buddy = NULL;
   429   current_buddy = NULL;
       
   430   if (alternate_buddy)
       
   431     roster_alternate_buddy = BUDDATA(alternate_buddy);
       
   432   alternate_buddy = NULL;
   428 
   433 
   429   // Destroy old buddylist
   434   // Destroy old buddylist
   430   if (buddylist) {
   435   if (buddylist) {
   431     g_list_free(buddylist);
   436     g_list_free(buddylist);
   432     buddylist = NULL;
   437     buddylist = NULL;
   485   }
   490   }
   486 
   491 
   487   // Check if we can find our saved current_buddy...
   492   // Check if we can find our saved current_buddy...
   488   if (roster_current_buddy)
   493   if (roster_current_buddy)
   489     current_buddy = g_list_find(buddylist, roster_current_buddy);
   494     current_buddy = g_list_find(buddylist, roster_current_buddy);
       
   495   if (roster_alternate_buddy)
       
   496     alternate_buddy = g_list_find(buddylist, roster_alternate_buddy);
   490   // current_buddy initialization
   497   // current_buddy initialization
   491   if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1))
   498   if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1))
   492     current_buddy = g_list_first(buddylist);
   499     current_buddy = g_list_first(buddylist);
   493   // XXX Maybe we should set update_roster to TRUE there?
   500   // XXX Maybe we should set update_roster to TRUE there?
   494 }
   501 }