Revision fea00266488c85ba94e735d5885d991298e8f9d7
Jeff Connelly
shellreef at gmail.com
Sat Aug 25 01:20:33 EDT 2007
On 8/24/07, Etan Reisner <pidgin at unreliablesource.net> wrote:
> It seems to me that the bug [#2752] is about PurpleGroup:s that have been created
> with purple_group_new being used in the purple_blist_add_{chat,buddy}
> functions before having been added to the buddy list with
> purple_blist_add_group, is that correct?
Right.
> Assuming that is the problem
> wouldn't it have been just as effective (and significantly more friendly)
> to just *add* the group in add_{chat,buddy} if it isn't in the buddy list
> already?
I suppose so, how about this patch?
#
# old_revision [b1a0340ea0f3e2adf428695c63bf6f5c526b375f]
#
# patch "libpurple/blist.c"
# from [53ea0c69ae6b3c9b7fb6fa7c9e7f2b9ca16e2b5c]
# to [f92e642465f8aca73dfcf5cf0f5df7a1d48cdc02]
#
============================================================
--- libpurple/blist.c 53ea0c69ae6b3c9b7fb6fa7c9e7f2b9ca16e2b5c
+++ libpurple/blist.c f92e642465f8aca73dfcf5cf0f5df7a1d48cdc02
@@ -1191,8 +1191,11 @@ void purple_blist_add_chat(PurpleChat *c
purple_blist_add_group(group,
purple_blist_get_last_sibling(purplebuddylist->root));
} else {
- /* Fail if tried to add buddy to a group that
isn't on the blist. #2752. */
- g_return_if_fail(purple_find_group(group->name));
+ /* Add group to blist if isn't already on it.
Fixes #2752. */
+ if (!purple_find_group(group->name)) {
+ purple_blist_add_group(group,
+
purple_blist_get_last_sibling(purplebuddylist->root));
+ }
}
} else {
group = (PurpleGroup*)node->parent;
@@ -1287,9 +1290,11 @@ void purple_blist_add_buddy(PurpleBuddy
g = (PurpleGroup *)((PurpleBlistNode *)c)->parent;
} else {
if (group) {
- /* Fail if trying to add buddy to a group
that is not on the buddy list.
- * Fix for #2752. */
- g_return_if_fail(purple_find_group(group->name));
+ /* Add chat to blist if isn't already on it.
Fixes #2752. */
+ if (!purple_find_group(group->name)) {
+ purple_blist_add_group(group,
+
purple_blist_get_last_sibling(purplebuddylist->root));
+ }
g = group;
} else {
> Even if that isn't a more reasonable solution I think the bug is in fact
> in pidgin and not in libpurple in that it displays a group more than once
> (when that group isn't added correctly at least), no?
Well, I'd say that it's a bug that libpurple allows this to happen.
> Ignoring all of the above, even if the current 'fix' is the right one
> (which as I've said I doubt since, if for no other reason, we silently
> create a 'Buddies' and 'Chats' group if no group is given), having left
> the g = group line is wrong.
Why's that? If the assertion fails, 'g = group' won't be executed. If
it doesn't, it will.
-Jeff
More information about the Devel
mailing list