status
Paul Aurich
paul+pidgin at aurich.com
Mon Sep 22 15:54:56 EDT 2008
And squeak at poczta.onet.pl spake on 09/22/2008 12:21 PM, saying:
> How can I chenge the status ?
>
> I wrote something like this:
> const char *id = purple_primitive_get_id_from_type(g_status);
> PurpleStatusPrimitive psp = purple_primitive_get_type_from_id( id );
> PurpleStatusType *pst = purple_status_type_new( psp, id, 0, FALSE );
> PurplePresence *pp = purple_presence_new_for_account(pAccount.icq);
> PurpleStatus *ps = purple_status_new( pst, pp);
> purple_status_set_active( ps, TRUE );
>
> but it doesn't work
You don't want to call the purple_*_new functions -- libpurple takes
care of creating all the necessary objects itself. You should either use
something like the following (a simplified version of something that
works for me) or the SavedStatus API (which is what Pidgin uses).
This code is a simplified version of something that works for me:
PurpleStatusType *type =
purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AWAY);
if (purple_status_type_get_attr(type, "message")) {
purple_account_set_status(account, purple_status_type_get_id(type),
TRUE, "message", "Food time. Be back by 13:30.", NULL);
} else {
purple_account_set_status(account, purple_status_type_get_id(type),
TRUE, NULL);
}
~Paul
More information about the Devel
mailing list