# HG changeset patch # User mikael # Date 1114804588 0 # Node ID 7571de4aed731075d31b34f83de6cdf87d1a73f8 # Parent 50f23c38743a3b85aa2121d1a3da2022a7ac157b [/trunk] Changeset 159 by mikael * Fix a bug in buddylist_build() * We now lock the current buddy even not when being in chat mode. For example, if we're writing to s.o. and he leaves just before we press enter, we won't write to the wrong buddy... If the current_buddy is a group, we lock it too. * Remove MCABBER_TESTUNIT ifdef in roster.h (test program isn't up-to-date anymore...) diff -r 50f23c38743a -r 7571de4aed73 mcabber/src/TODO --- a/mcabber/src/TODO Fri Apr 29 18:35:05 2005 +0000 +++ b/mcabber/src/TODO Fri Apr 29 19:56:28 2005 +0000 @@ -5,12 +5,6 @@ * Messages in hidden (shrunk) groups are not visible. Maybe we should create "*_msg_[gs]etflag()" functions, which would update groups message flags too. (?) -* Small but perhaps annoying: when we are on a group entry, w/ - offline buddies hidden and this group is removed from the list. - Then the cursor goes back to the first item of the buddylist. -* We should lock the current buddy even not when being in chat mode. - For example, if you're writing to s.o. and he leaves just before you - press enter, you write to the wrong buddy. Baad. TODO: diff -r 50f23c38743a -r 7571de4aed73 mcabber/src/roster.c --- a/mcabber/src/roster.c Fri Apr 29 18:35:05 2005 +0000 +++ b/mcabber/src/roster.c Fri Apr 29 19:56:28 2005 +0000 @@ -305,7 +305,6 @@ GSList *sl_roster_elt = groups; roster *roster_elt; roster *roster_current_buddy = NULL; - int pending_group; int shrunk_group; // We need to remember which buddy is selected. @@ -323,14 +322,16 @@ while (sl_roster_elt) { GSList *sl_roster_usrelt; roster *roster_usrelt; + guint pending_group = FALSE; roster_elt = (roster*) sl_roster_elt->data; // Add the group now unless hide_offline_buddies is set, // in which case we'll add it only if an online buddy belongs to it. - if (!hide_offline_buddies) + // We take care to keep the current_buddy in the list, too. + if (!hide_offline_buddies || roster_elt == roster_current_buddy) buddylist = g_list_append(buddylist, roster_elt); else - pending_group = TRUE; + pending_group = TRUE; shrunk_group = roster_elt->flags & ROSTER_FLAG_HIDE; @@ -344,12 +345,14 @@ // - buddy has a lock (for example the buddy window is currently open) // - buddy has a pending (non-read) message // - group isn't hidden (shrunk) - if (!hide_offline_buddies || + // - this is the current_buddy + if (!hide_offline_buddies || roster_usrelt == roster_current_buddy || (buddy_getstatus((gpointer)roster_usrelt) != offline) || (buddy_getflags((gpointer)roster_usrelt) & (ROSTER_FLAG_LOCK | ROSTER_FLAG_MSG))) { // This user should be added. Maybe the group hasn't been added yet? - if (hide_offline_buddies && pending_group) { + if (pending_group && + (hide_offline_buddies || roster_usrelt == roster_current_buddy)) { // It hasn't been done yet buddylist = g_list_append(buddylist, roster_elt); pending_group = FALSE; diff -r 50f23c38743a -r 7571de4aed73 mcabber/src/roster.h --- a/mcabber/src/roster.h Fri Apr 29 18:35:05 2005 +0000 +++ b/mcabber/src/roster.h Fri Apr 29 19:56:28 2005 +0000 @@ -3,11 +3,7 @@ #include -#ifdef MCABBER_TESTUNIT -# include "test_roster_main.h" -#else # include "jabglue.h" -#endif enum findwhat { jidsearch,