* Gaim is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "conversation.h" /**************************************************************************/ /** @name Protocol Plugin API */ /**************************************************************************/ gaim_prpl_got_account_idle(GaimAccount *account, gboolean idle, g_return_if_fail(account != NULL); g_return_if_fail(gaim_account_is_connected(account)); gaim_presence_set_idle(gaim_account_get_presence(account), gaim_prpl_got_account_login_time(GaimAccount *account, time_t login_time) g_return_if_fail(account != NULL); g_return_if_fail(gaim_account_is_connected(account)); presence = gaim_account_get_presence(account); gaim_presence_set_login_time(presence, login_time); gaim_prpl_got_account_status(GaimAccount *account, const char *status_id, ...) g_return_if_fail(account != NULL); g_return_if_fail(status_id != NULL); g_return_if_fail(gaim_account_is_connected(account)); presence = gaim_account_get_presence(account); status = gaim_presence_get_status(presence, status_id); g_return_if_fail(status != NULL); va_start(args, status_id); gaim_status_set_active_with_attrs(status, TRUE, args); gaim_prpl_got_user_idle(GaimAccount *account, const char *name, gboolean idle, time_t idle_time) g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(gaim_account_is_connected(account)); if ((buddy = gaim_find_buddy(account, name)) == NULL) presence = gaim_buddy_get_presence(buddy); gaim_presence_set_idle(presence, idle, idle_time); gaim_prpl_got_user_login_time(GaimAccount *account, const char *name, g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); if ((buddy = gaim_find_buddy(account, name)) == NULL) presence = gaim_buddy_get_presence(buddy); gaim_presence_set_login_time(presence, login_time); gaim_prpl_got_user_status(GaimAccount *account, const char *name, const char *status_id, ...) g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); g_return_if_fail(status_id != NULL); g_return_if_fail(gaim_account_is_connected(account) || gaim_account_is_connecting(account)); if ((buddy = gaim_find_buddy(account, name)) == NULL) presence = gaim_buddy_get_presence(buddy); status = gaim_presence_get_status(presence, status_id); g_return_if_fail(status != NULL); old_status = gaim_presence_get_active_status(presence); va_start(args, status_id); gaim_status_set_active_with_attrs(status, TRUE, args); list = gaim_find_buddies(account, name); for (iter = list; iter != NULL; iter = iter->next) buddy = (GaimBuddy *)iter->data; gaim_blist_update_buddy_status(buddy, old_status); if (!gaim_status_is_online(status)) serv_got_typing_stopped(gaim_account_get_connection(account), name); do_prpl_change_account_status(GaimAccount *account, GaimStatus *old_status, GaimStatus *new_status) GaimPluginProtocolInfo *prpl_info; if (gaim_status_is_online(new_status) && gaim_account_is_disconnected(account)) gaim_account_connect(account); if (gaim_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 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); if (!gaim_account_is_disconnected(account) && prpl_info->set_status != NULL) prpl_info->set_status(account, new_status); if (!gaim_status_is_online(new_status)) if (!gaim_account_is_disconnected(account)) gaim_account_disconnect(account); gaim_prpl_change_account_status(GaimAccount *account, GaimStatus *old_status, GaimStatus *new_status) g_return_if_fail(account != NULL); g_return_if_fail(old_status != NULL); g_return_if_fail(new_status != NULL); do_prpl_change_account_status(account, old_status, new_status); gaim_signal_emit(gaim_accounts_get_handle(), "account-status-changed", account, old_status, new_status); gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence) GaimPluginProtocolInfo *prpl_info; g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(presence != NULL, NULL); prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); if (prpl_info == NULL || prpl_info->status_types == NULL) for (l = list = prpl_info->status_types(account); l != NULL; l = l->next) status = gaim_status_new((GaimStatusType *)l->data, presence); statuses = g_list_append(statuses, status); /************************************************************************** * Protocol Plugin Subsystem API **************************************************************************/ gaim_find_prpl(const char *id) g_return_val_if_fail(id != NULL, NULL); for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) { plugin = (GaimPlugin *)l->data; if (!strcmp(plugin->info->id, id))