I am trying to display the current status of another person on the SIMPLE network (Microsoft Office Communicator). I use libpurple, built a C ++ wrapper around libpurple, and I can send / receive IM with other users on the SIMPLE network. I still need to get the current status of other users.
Here is my current attempt to restore the status of another user.
Previously defined and initialized:
PurpleAccount * CommonIM :: m_account β I can send messages using this account
// the username of the person I want to get the status of, eg username = "sip: blah@blah.blah.com "; //TEST instance 1 PurpleBuddy* newbody1 = purple_buddy_new(m_account, username.c_str(), NULL); sleep(5); PurplePresence *p1 = purple_buddy_get_presence(newbody1); PurpleStatus *status1 = purple_presence_get_active_status(p1); PurpleStatusType *statusType1 = purple_status_get_type(status1); PurpleStatusPrimitive prim1 = purple_status_type_get_primitive(statusType1); switch(prim1) { case PURPLE_STATUS_UNSET: { status = "unset"; } break; case PURPLE_STATUS_OFFLINE: { status = "offline"; } break; case PURPLE_STATUS_AVAILABLE: { status = "available"; } break; case PURPLE_STATUS_UNAVAILABLE: { status = "unavailable"; } break; case PURPLE_STATUS_INVISIBLE: { status = "invisible"; } break; case PURPLE_STATUS_AWAY: { status = "away"; } break; case PURPLE_STATUS_EXTENDED_AWAY: { status = "extended away"; } break; case PURPLE_STATUS_MOBILE: { status = "mobile"; } break; case PURPLE_STATUS_TUNE: { status = "tune"; } break; case PURPLE_STATUS_NUM_PRIMITIVES: default: { status = "unknown"; } break; } //TEST instance 1 complete cout << _TAG << "Test instance 1: Status for " << username << " is reported as " << status << endl;
This code always returns offline status. As if purple does not update a buddy after creating a new instance, it always remains "autonomous". I dived into libpurple and pidgin to try to find this over the last few days, but cannot find the βrightβ way to get the status.
source share