How Pidgin retrieves status messages on friends/buddies from libpurple

Travis Taylor trdtaylor at
Fri Aug 5 00:22:41 EDT 2011

Hello everyone. I am currently trying to retrieve a status of another user
on a SIMPLE network. I can send IMs to them fine through lib purple but I
cannot retrieve their status.
Here is the specific block of code where I am trying to access the status of
the user

PurpleAccount m_account = (my account details)

string username = username of the user I want to check the status of

string status = empty string used for retrieval

void GetStatus(string& username, string& status)


PurpleBuddy* newbody(purple_buddy_new(m_account, username.c_str(), NULL));
PurplePresence *p = purple_buddy_get_presence(newbody);
PurpleStatus *active = purple_presence_get_active_status(p);
PurpleStatusType *statusType = purple_status_get_type(active);
PurpleStatusPrimitive prim = purple_status_type_get_primitive(statusType);


I then iterate through with a switch statement for each of the possible
primative types, and print their reflected value.


case(prim equals each of the possible purple status types)


status = "Whatever that status type is contextually"


m_account is the account from where I want the buddy from, in this case it's
my SIMPLE account login. username.c_str() is the username of the person
who's status I want. I've looked through both pidgins and purples source
code and cannot figure out what I am doing wrong in accessing statuses of
friends. They are always reported back as "offline", indicating I am calling
the right functions but possibly the wrong syntax. If anyone knows about how
pidgin calls for status information from friends/buddies and knows what I am
doing wrong, that info would be much appreciated. For reference, this block
of code always returns a status as offline.  After diving into the code, it
seems like I am properly creating a buddy to retrieve a status, but never
refreshing the buddies status.

Just to be clear, I do have a proper connection, I can send IMs to people
over a SIMPLE network, I can receive IMs.  I cannot retrieve the status of a
user. Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Devel mailing list