void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name, const char *status_id) { GSList *list, *l; PurpleBuddy *buddy; PurplePresence *presence; PurpleStatus *status; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(status_id != NULL); g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); if((list = purple_find_buddies(account, name)) == NULL) return; for(l = list; l != NULL; l = l->next) { buddy = l->data; presence = purple_buddy_get_presence(buddy); status = purple_presence_get_status(presence, status_id); if(NULL == status) continue; if (purple_status_is_active(status)) { purple_status_set_active(status, FALSE); purple_blist_update_buddy_status(buddy, status); } } g_slist_free(list); }
void purple_prpl_got_user_status(PurpleAccount *account, const char *name, const char *status_id, ...) { GSList *list, *l; PurpleBuddy *buddy; PurplePresence *presence; PurpleStatus *status; PurpleStatus *old_status; va_list args; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(status_id != NULL); g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); if((list = purple_find_buddies(account, name)) == NULL) return; for(l = list; l != NULL; l = l->next) { buddy = l->data; presence = purple_buddy_get_presence(buddy); status = purple_presence_get_status(presence, status_id); if(NULL == status) /* * TODO: This should never happen, right? We should call * g_warning() or something. */ continue; old_status = purple_presence_get_active_status(presence); va_start(args, status_id); purple_status_set_active_with_attrs(status, TRUE, args); va_end(args); purple_blist_update_buddy_status(buddy, old_status); } g_slist_free(list); /* The buddy is no longer online, they are therefore by definition not * still typing to us. */ if (!purple_status_is_online(status)) { serv_got_typing_stopped(purple_account_get_connection(account), name); purple_prpl_got_media_caps(account, name); } }
static void do_prpl_change_account_status(PurpleAccount *account, PurpleStatus *old_status, PurpleStatus *new_status) { PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; if (purple_status_is_online(new_status) && purple_account_is_disconnected(account) && purple_network_is_available()) { purple_account_connect(account); return; } if (!purple_status_is_online(new_status)) { if (!purple_account_is_disconnected(account)) purple_account_disconnect(account); /* Clear out the unsaved password if we're already disconnected and we switch to offline status */ else if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); return; } if (purple_account_is_connecting(account)) /* * We don't need to call the set_status PRPL function because * the PRPL will take care of setting its status during the * connection process. */ return; prpl = purple_find_prpl(purple_account_get_protocol_id(account)); if (prpl == NULL) return; prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (!purple_account_is_disconnected(account) && prpl_info->set_status != NULL) { prpl_info->set_status(account, new_status); } }
void purple_prpl_got_user_status(PurpleAccount *account, const char *name, const char *status_id, ...) { GSList *list, *l; PurpleBuddy *buddy; PurplePresence *presence; PurpleStatus *status; PurpleStatus *old_status; va_list args; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(status_id != NULL); g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); if((list = purple_find_buddies(account, name)) == NULL) return; for(l = list; l != NULL; l = l->next) { buddy = l->data; presence = purple_buddy_get_presence(buddy); status = purple_presence_get_status(presence, status_id); if(NULL == status) continue; old_status = purple_presence_get_active_status(presence); va_start(args, status_id); purple_status_set_active_with_attrs(status, TRUE, args); va_end(args); purple_blist_update_buddy_status(buddy, old_status); } g_slist_free(list); /* we get to re-use the last status we found */ if (!purple_status_is_online(status)) serv_got_typing_stopped(purple_account_get_connection(account), name); }
void purple_prpl_got_user_idle(PurpleAccount *account, const char *name, gboolean idle, time_t idle_time) { PurplePresence *presence; GSList *list; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); if ((list = purple_find_buddies(account, name)) == NULL) return; while (list) { presence = purple_buddy_get_presence(list->data); list = g_slist_delete_link(list, list); purple_presence_set_idle(presence, idle, idle_time); } }