[Pidgin] #1725: proposed patch to prevent buddy list from disappearing

Pidgin trac at pidgin.im
Sat Jun 16 16:06:43 EDT 2007


#1725: proposed patch to prevent buddy list from disappearing
------------------------+---------------------------------------------------
  Reporter:  truxton    |       Owner:  deryni
      Type:  defect     |      Status:  new   
  Priority:  minor      |   Milestone:  2.1.0 
 Component:  libpurple  |     Version:  2.0.1 
Resolution:             |    Keywords:        
   Pending:  0          |  
------------------------+---------------------------------------------------
Changes (by rlaager):

  * owner:  => deryni
  * milestone:  => 2.1.0

Old description:

> Hi,
>
> I just started using Pidgin, and my workplace has a jabber server.  There
> are some server-defined groups, such as the
> list of all engineers.  When I try to create a special buddy
> list, and move/copy some of the engineers to my buddy list,
> it looks good, and when I exit pidgin, the blist.xml has
> my buddy list correct.
>
> However when I reconnect, the server sends the whole engineering list
> again, and jabber_roster_parse() in roster.c blows away my existing list
> of buddies.  I debugged through the code, and found out it was because
> the contact exists in multiple groups.
>
> I made this change to add_purple_buddies_to_groups() in
> libpurple/protocols/jabber/roster.c and now it works for me.  Please
> consider this patch :
>
> --- ../../pidgin-2.0.1/libpurple/protocols/jabber/roster.c      Fri May
> 25 09:28:21 2007
> +++ protocols/jabber/roster.c   Fri Jun 15 16:11:05 2007
> @@ -75,22 +75,22 @@
>         while(buddies) {
>                 PurpleBuddy *b = buddies->data;
>                 PurpleGroup *g = purple_buddy_get_group(b);
> +               const char *servernick;
>
>                 buddies = g_slist_remove(buddies, b);
>
> -               if((l = g_slist_find_custom(g2, g->name,
> (GCompareFunc)strcmp))) {
> -                       const char *servernick;
> -
> -                       if((servernick =
> purple_blist_node_get_string((PurpleBlistNode*)b, "servernick")))
> -                               serv_got_alias(js->gc, jid, servernick);
> +                if((servernick =
> purple_blist_node_get_string((PurpleBlistNode*)b, "servernick")))
> +                  serv_got_alias(js->gc, jid, servernick);
> +
> +                if(alias && (!b->alias || strcmp(b->alias, alias)))
> +                  purple_blist_alias_buddy(b, alias);
>
> -                       if(alias && (!b->alias || strcmp(b->alias,
> alias)))
> -                               purple_blist_alias_buddy(b, alias);
> +               if((l = g_slist_find_custom(g2, g->name,
> (GCompareFunc)strcmp))) {
>                         g_free(l->data);
>                         g2 = g_slist_delete_link(g2, l);
> -               } else {
> -                       purple_blist_remove_buddy(b);
>                 }
> +
> +                // purple_blist_remove_buddy(b);
>         }
>

> Thanks,
>
> -Truxton

New description:

 Hi,

 I just started using Pidgin, and my workplace has a jabber server.  There
 are some server-defined groups, such as the
 list of all engineers.  When I try to create a special buddy
 list, and move/copy some of the engineers to my buddy list,
 it looks good, and when I exit pidgin, the blist.xml has
 my buddy list correct.

 However when I reconnect, the server sends the whole engineering list
 again, and jabber_roster_parse() in roster.c blows away my existing list
 of buddies.  I debugged through the code, and found out it was because the
 contact exists in multiple groups.

 I made this change to add_purple_buddies_to_groups() in
 libpurple/protocols/jabber/roster.c and now it works for me.  Please
 consider this patch.

 Thanks,
 -Truxton

Comment:

 I don't really understand what's going on here, so this is probably
 something for deryni or nwalp to review.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/1725#comment:4>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list