All buddies are offline

Sadrul Habib Chowdhury imadil at gmail.com
Fri Aug 1 11:45:30 EDT 2008


* Nicholas Guarracino had this to say on [01 Aug 2008, 11:21:54 -0400]:
> I'm just starting a basic libpurple client and I'm having trouble with
> all of my buddies showing Offline. This is what I'm doing in my "show"
> callback within PurpleBlistUiOps. Does it seem right or am I missing
> something?
> 
> static void show_buddies (PurpleBuddyList * buddy_list)
> {
>   syslog (LOG_INFO, "show_buddies");
>   
>   PurpleBlistNode * buddy_node = purple_blist_get_root();
>   while (buddy_node)
>   {
>     if (!PURPLE_BLIST_NODE_IS_BUDDY (buddy_node)) continue;
>     
>     const PurpleBuddy * buddy = (PurpleBuddy*) (buddy_node);
>     PurplePresence * pres = purple_buddy_get_presence (buddy);
>     PurpleStatus * status = purple_presence_get_active_status (pres);
>     syslog (LOG_INFO, "\tStatus: %s", purple_status_get_name (status));
>   }
>   buddy_node = purple_blist_node_next (buddy_node, TRUE);

Your loop is incorrect. You need to advance buddy_node within the loop
(also before continue-ing from the first check within the loop). A for
loop is usually better in such cases.

Sadrul

> }
> 
> Thanks,
> --Nick
> 
> 
> 
[snip annoying Disclaimer notice]




More information about the Devel mailing list