purple_blist_add_buddy() and purple_account_add_buddy() inconsistency

John Bailey rekkanoryo at rekkanoryo.org
Mon Jun 25 13:55:31 EDT 2007

Hash: SHA1

As many of the people on this list know, I am responsible for the List Handler
plugin (http://plugins.guifications.org/trac/wiki/listhandler) existing.
Recently, I received a a feature request to enable the plugin's
protocol-agnostic (i.e. XML) export format to save the notes generated by Stu's
Buddy Notes plugin.  In implementing and testing this feature, I've found some
inconsistency in the handling of calls to purple_blist_add_buddy() and

If I export a list from a Yahoo! account, then import it to another account, all
the buddies are added to the local list and the server list.  I don't see status
yet because these additions are pending authorization from the buddy.  As soon
as a buddy authorizes me, the status is shown correctly as expected.  The major
point here is that the next time the debug window says that it's flushing
blist.xml to disk, I can immediately look at blist.xml and confirm that the
buddies are there.  The alias and buddy notes that were imported are also present.

Such is not the case on AIM, however.  The behavior I see here is that the
buddies appear in the Pidgin blist but always have an offline status, even
though I know at least four of these people are online.  Looking at blist.xml
after the next shown flush in the debug window shows that nothing has been added
to the local list.  The alias and buddy notes are not added, either.  The status
remains incorrect until I restart Pidgin, disable and enable the account, or
switch to the offline status and then back to an online status.  At this point,
the buddies are finally shown in blist.xml and statuses are correct; however,
the alias and notes string that were set at import are missing.  Behavior is
identical on ICQ when importing a list of AIM buddies (which to my limited
knowledge does not require authorization).

It seems to me that all the prpls should behave consistently when buddies are
added.  How should this work though?  Should I be losing the alias and notes
that I've tried to set on the buddy or should oscar and other prpls not behaving
like Yahoo! be made to behave correctly, as Yahoo! does?

Here is the code in question, sans comment and purple_debug_info calls for clarity:

void lh_util_add_buddy(const gchar *group, PurpleGroup *purple_group, const
gchar *buddy, const gchar *alias, PurpleAccount *account, const gchar *buddynotes)
	PurpleBuddy *purple_buddy = purple_buddy_new(account, buddy, alias);
	purple_blist_add_buddy(purple_buddy, NULL, purple_group, NULL);
	purple_account_add_buddy(account, purple_buddy);

		purple_blist_node_set_string((PurpleBlistNode *)purple_buddy, "notes",

Version: GnuPG v1.4.6 (GNU/Linux)


More information about the Devel mailing list