Buddy Status

Mark Doliner mark at kingant.net
Mon Mar 15 02:19:32 EDT 2010


On Sun, Mar 14, 2010 at 11:43 AM, Giuseppe Santoro
<giuseppesantoro87 at gmail.com> wrote:
> Hi Pidgin Developers,
>
> I'm studying libpurple and pidgin to give my contribution in this project.
>
> I have a question:
>
> if I have a PurpleBuddy, how do I get his state?
> I tried this code but state is ever "OFFLINE":
>
>             presence = purple_buddy_get_presence(buddy);
>             status = purple_presence_get_active_status(presence);
>             printf("%s\n", purple_status_get_name(status));
>
> where am I wrong?

That looks correct to me.  Are you sure you're using the right buddy
object?  Are you sure the buddy is online?  Are you sure you're
printing the status while the buddy is online?

The PurpleStatus name is actually the PurpleStatusType name.  And the
PurpleStatusType name comes from the prpl.  It's possible the prpl
mistakenly sets the name of the status type to "OFFLINE."  You could
try printing purple_primitive_get_id_from_type(purple_status_type_get_primitive(purple_status_get_type(status)))
to verify that the status type really is offline.

--Mark




More information about the Devel mailing list