diff mcabber/src/roster.c @ 81:0bd578421ce9

[/trunk] Changeset 95 by mikael * Switch from buddies.* to roster.* Seems to work fine...
author mikael
date Sat, 16 Apr 2005 22:28:55 +0000
parents 7fb661f19a77
children d39f15683c34
line wrap: on
line diff
--- a/mcabber/src/roster.c	Sat Apr 16 21:13:59 2005 +0000
+++ b/mcabber/src/roster.c	Sat Apr 16 22:28:55 2005 +0000
@@ -247,8 +247,14 @@
 {
   GSList *sl_roster_elt = groups;
   roster *roster_elt;
+  roster *roster_current_buddy = NULL;
   int pending_group;
 
+  // We need to remember which buddy is selected.
+  if (current_buddy)
+    roster_current_buddy = BUDDATA(current_buddy);
+  current_buddy = NULL;
+
   // Destroy old buddylist
   if (buddylist) {
     g_list_free(buddylist);
@@ -296,9 +302,12 @@
     sl_roster_elt = g_slist_next(sl_roster_elt);
   }
 
+  // Check if we can find our saved current_buddy...
+  if (roster_current_buddy)
+    current_buddy = g_list_find(buddylist, roster_current_buddy);
   // current_buddy initialization
   if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1))
-    current_buddy = buddylist;
+    current_buddy = g_list_first(buddylist);
 }
 
 //  buddy_hide_group(roster, hide)