* 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" #define SEND_TYPED_TIMEOUT 5000 static GList *conversations = NULL; static GList *ims = NULL; static GList *chats = NULL; static GaimConversationUiOps *default_ops = NULL; gaim_conversations_set_ui_ops(GaimConversationUiOps *ops) reset_typing(gpointer data) GaimConversation *c = (GaimConversation *)data; if (!g_list_find(conversations, c)) gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); gaim_conv_im_update_typing(im); gaim_conv_im_stop_typing_timeout(im); send_typed(gpointer data) GaimConversation *conv = (GaimConversation *)data; gc = gaim_conversation_get_gc(conv); name = gaim_conversation_get_name(conv); if (conv != NULL && gc != NULL && name != NULL) { gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), TRUE); serv_send_typing(gc, name, GAIM_TYPED); gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n"); common_send(GaimConversation *conv, const char *message, GaimMessageFlags msgflags) GaimConversationType type; GaimConversationUiOps *ops; char *displayed = NULL, *sent = NULL; if (strlen(message) == 0) account = gaim_conversation_get_account(conv); gc = gaim_conversation_get_gc(conv); g_return_if_fail(account != NULL); g_return_if_fail(gc != NULL); type = gaim_conversation_get_type(conv); ops = gaim_conversation_get_ui_ops(conv); /* Always linkfy the text for display */ displayed = gaim_markup_linkify(message); if ((conv->features & GAIM_CONNECTION_HTML) && !(msgflags & GAIM_MESSAGE_RAW)) sent = g_strdup(displayed); sent = g_strdup(message); msgflags |= GAIM_MESSAGE_SEND; if (type == GAIM_CONV_TYPE_IM) { GaimConvIm *im = GAIM_CONV_IM(conv); gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg", gaim_conversation_get_name(conv), &sent); if (sent != NULL && sent[0] != '\0') { err = serv_send_im(gc, gaim_conversation_get_name(conv), if ((err > 0) && (displayed != NULL)) gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL)); gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg", gaim_conversation_get_name(conv), sent); gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg", gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); if (sent != NULL && sent[0] != '\0') { err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent, msgflags); gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg", gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); who = gaim_conversation_get_name(conv); msg = _("Unable to send message: The message is too large."); if (!gaim_conv_present_error(who, account, msg)) { char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); gaim_notify_error(gc, NULL, msg2, _("The message is too large.")); else if (err == -ENOTCONN) { gaim_debug(GAIM_DEBUG_ERROR, "conversation", msg = _("Unable to send message."); if (!gaim_conv_present_error(who, account, msg)) { char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); gaim_notify_error(gc, NULL, msg2, NULL); open_log(GaimConversation *conv) conv->logs = g_list_append(NULL, gaim_log_new(conv->type == GAIM_CONV_TYPE_CHAT ? GAIM_LOG_CHAT : GAIM_LOG_IM, conv->name, conv->account, conv, time(NULL), NULL)); /************************************************************************** **************************************************************************/ gaim_conversation_chat_cleanup_for_rejoin(GaimConversation *conv) account = gaim_conversation_get_account(conv); gaim_conversation_close_logs(conv); gc = gaim_account_get_connection(account); if ((disp = gaim_connection_get_display_name(gc)) != NULL) gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), disp); gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), gaim_account_get_username(account)); gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv)); gaim_conv_chat_set_topic(GAIM_CONV_CHAT(conv), NULL, NULL); GAIM_CONV_CHAT(conv)->left = FALSE; gaim_conversation_update(conv, GAIM_CONV_UPDATE_CHATLEFT); gaim_conversation_new(GaimConversationType type, GaimAccount *account, GaimConversationUiOps *ops; g_return_val_if_fail(type != GAIM_CONV_TYPE_UNKNOWN, NULL); g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); /* Check if this conversation already exists. */ if ((conv = gaim_find_conversation_with_account(type, name, account)) != NULL) if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT || gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) gaim_conversation_chat_cleanup_for_rejoin(conv); gc = gaim_account_get_connection(account); g_return_val_if_fail(gc != NULL, NULL); conv = g_new0(GaimConversation, 1); GAIM_DBUS_REGISTER_POINTER(conv, GaimConversation); conv->name = g_strdup(name); conv->title = g_strdup(name); conv->send_history = g_list_append(NULL, NULL); conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, /* copy features from the connection. */ conv->features = gc->flags; if (type == GAIM_CONV_TYPE_IM) conv->u.im = g_new0(GaimConvIm, 1); GAIM_DBUS_REGISTER_POINTER(conv->u.im, GaimConvIm); ims = g_list_append(ims, conv); if ((icon = gaim_buddy_icons_find(account, name))) gaim_conv_im_set_icon(conv->u.im, icon); if (gaim_prefs_get_bool("/core/logging/log_ims")) gaim_conversation_set_logging(conv, TRUE); else if (type == GAIM_CONV_TYPE_CHAT) conv->u.chat = g_new0(GaimConvChat, 1); conv->u.chat->conv = conv; GAIM_DBUS_REGISTER_POINTER(conv->u.chat, GaimConvChat); chats = g_list_append(chats, conv); if ((disp = gaim_connection_get_display_name(account->gc))) gaim_conv_chat_set_nick(conv->u.chat, disp); gaim_conv_chat_set_nick(conv->u.chat, gaim_account_get_username(account)); if (gaim_prefs_get_bool("/core/logging/log_chats")) gaim_conversation_set_logging(conv, TRUE); conversations = g_list_append(conversations, conv); /* Auto-set the title. */ gaim_conversation_autoset_title(conv); /* Don't move this.. it needs to be one of the last things done otherwise * it causes mysterious crashes on my system. ops = conv->ui_ops = default_ops; if (ops != NULL && ops->create_conversation != NULL) ops->create_conversation(conv); gaim_signal_emit(gaim_conversations_get_handle(), "conversation-created", conv); gaim_conversation_destroy(GaimConversation *conv) GaimPluginProtocolInfo *prpl_info = NULL; GaimConversationUiOps *ops; g_return_if_fail(conv != NULL); ops = gaim_conversation_get_ui_ops(conv); gc = gaim_conversation_get_gc(conv); name = gaim_conversation_get_name(conv); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) if (gaim_prefs_get_bool("/core/conversations/im/send_typing")) serv_send_typing(gc, name, GAIM_NOT_TYPING); if (gc && prpl_info->convo_closed != NULL) prpl_info->convo_closed(gc, name); else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) int chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); * This is unfortunately necessary, because calling * serv_chat_leave() calls this gaim_conversation_destroy(), * which leads to two calls here.. We can't just return after * this, because then it'll return on the next pass. So, since * serv_got_chat_left(), which is eventually called from the * prpl that serv_chat_leave() calls, removes this conversation * from the gc's buddy_chats list, we're going to check to see * if this exists in the list. If so, we want to return after * calling this, because it'll be called again. If not, fall * through, because it'll have already been removed, and we'd * Long paragraph. <-- Short sentence. if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { serv_chat_leave(gc, chat_id); * Instead of all of that, lets just close the window when * the user tells us to, and let the prpl deal with the * internals on it's own time. Don't do this if the prpl already * knows it left the chat. if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) serv_chat_leave(gc, chat_id); * If they didn't call serv_got_chat_left by now, it's too late. * So we better do it for them before we destroy the thing. if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) serv_got_chat_left(gc, chat_id); /* remove from conversations and im/chats lists prior to emit */ conversations = g_list_remove(conversations, conv); if(conv->type==GAIM_CONV_TYPE_IM) ims = g_list_remove(ims, conv); else if(conv->type==GAIM_CONV_TYPE_CHAT) chats = g_list_remove(chats, conv); gaim_signal_emit(gaim_conversations_get_handle(), "deleting-conversation", conv); for (node = g_list_first(conv->send_history); node = g_list_next(node)) { g_list_free(g_list_first(conv->send_history)); if (conv->type == GAIM_CONV_TYPE_IM) { gaim_conv_im_stop_typing_timeout(conv->u.im); gaim_conv_im_stop_type_again_timeout(conv->u.im); if (conv->u.im->icon != NULL) gaim_buddy_icon_unref(conv->u.im->icon); GAIM_DBUS_UNREGISTER_POINTER(conv->u.im); else if (conv->type == GAIM_CONV_TYPE_CHAT) { for (node = conv->u.chat->in_room; node != NULL; node = node->next) { gaim_conv_chat_cb_destroy((GaimConvChatBuddy *)node->data); for (node = conv->u.chat->ignored; node != NULL; node = node->next) { g_list_free(conv->u.chat->in_room); g_list_free(conv->u.chat->ignored); conv->u.chat->in_room = NULL; conv->u.chat->ignored = NULL; if (conv->u.chat->who != NULL) g_free(conv->u.chat->who); conv->u.chat->who = NULL; if (conv->u.chat->topic != NULL) g_free(conv->u.chat->topic); conv->u.chat->topic = NULL; g_free(conv->u.chat->nick); GAIM_DBUS_UNREGISTER_POINTER(conv->u.chat); g_hash_table_destroy(conv->data); if (ops != NULL && ops->destroy_conversation != NULL) ops->destroy_conversation(conv); gaim_conversation_close_logs(conv); GAIM_DBUS_UNREGISTER_POINTER(conv); gaim_conversation_present(GaimConversation *conv) { GaimConversationUiOps *ops; g_return_if_fail(conv != NULL); ops = gaim_conversation_get_ui_ops(conv); gaim_conversation_set_features(GaimConversation *conv, GaimConnectionFlags features) g_return_if_fail(conv != NULL); conv->features = features; gaim_conversation_update(conv, GAIM_CONV_UPDATE_FEATURES); gaim_conversation_get_features(GaimConversation *conv) g_return_val_if_fail(conv != NULL, 0); gaim_conversation_get_type(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, GAIM_CONV_TYPE_UNKNOWN); gaim_conversation_set_ui_ops(GaimConversation *conv, GaimConversationUiOps *ops) g_return_if_fail(conv != NULL); if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) conv->ui_ops->destroy_conversation(conv); gaim_conversation_get_ui_ops(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); gaim_conversation_set_account(GaimConversation *conv, GaimAccount *account) g_return_if_fail(conv != NULL); if (account == gaim_conversation_get_account(conv)) gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT); gaim_conversation_get_account(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); gaim_conversation_get_gc(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); account = gaim_conversation_get_account(conv); gaim_conversation_set_title(GaimConversation *conv, const char *title) g_return_if_fail(conv != NULL); g_return_if_fail(title != NULL); conv->title = g_strdup(title); gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE); gaim_conversation_get_title(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); gaim_conversation_autoset_title(GaimConversation *conv) const char *text = NULL, *name; g_return_if_fail(conv != NULL); account = gaim_conversation_get_account(conv); name = gaim_conversation_get_name(conv); if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { if(account && ((b = gaim_find_buddy(account, name)) != NULL)) text = gaim_buddy_get_contact_alias(b); } else if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { if(account && ((chat = gaim_blist_find_chat(account, name)) != NULL)) gaim_conversation_set_title(conv, text); gaim_conversation_foreach(void (*func)(GaimConversation *conv)) g_return_if_fail(func != NULL); for (l = gaim_get_conversations(); l != NULL; l = l->next) { conv = (GaimConversation *)l->data; gaim_conversation_set_name(GaimConversation *conv, const char *name) g_return_if_fail(conv != NULL); conv->name = (name == NULL ? NULL : g_strdup(name)); gaim_conversation_autoset_title(conv); gaim_conversation_get_name(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); gaim_conversation_set_logging(GaimConversation *conv, gboolean log) g_return_if_fail(conv != NULL); if (conv->logging != log) gaim_conversation_update(conv, GAIM_CONV_UPDATE_LOGGING); gaim_conversation_is_logging(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, FALSE); gaim_conversation_close_logs(GaimConversation *conv) g_return_if_fail(conv != NULL); g_list_foreach(conv->logs, (GFunc)gaim_log_free, NULL); gaim_conversation_get_send_history(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); return conv->send_history; gaim_conversation_get_im_data(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) gaim_conversation_get_chat_data(const GaimConversation *conv) g_return_val_if_fail(conv != NULL, NULL); if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) gaim_conversation_set_data(GaimConversation *conv, const char *key, g_return_if_fail(conv != NULL); g_return_if_fail(key != NULL); g_hash_table_replace(conv->data, g_strdup(key), data); gaim_conversation_get_data(GaimConversation *conv, const char *key) g_return_val_if_fail(conv != NULL, NULL); g_return_val_if_fail(key != NULL, NULL); return g_hash_table_lookup(conv->data, key); gaim_get_conversations(void) gaim_find_conversation_with_account(GaimConversationType type, const GaimAccount *account) GaimConversation *c = NULL; g_return_val_if_fail(name != NULL, NULL); name1 = g_strdup(gaim_normalize(account, name)); for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { c = (GaimConversation *)cnv->data; name2 = gaim_normalize(account, gaim_conversation_get_name(c)); if (((type == GAIM_CONV_TYPE_ANY) || (type == gaim_conversation_get_type(c))) && (account == gaim_conversation_get_account(c)) && !gaim_utf8_strcasecmp(name1, name2)) { gaim_conversation_write(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, GaimPluginProtocolInfo *prpl_info = NULL; GaimConnection *gc = NULL; GaimConversationUiOps *ops; GaimConversationType type; /* int logging_font_options = 0; */ g_return_if_fail(conv != NULL); g_return_if_fail(message != NULL); ops = gaim_conversation_get_ui_ops(conv); if (ops == NULL || ops->write_conv == NULL) account = gaim_conversation_get_account(conv); type = gaim_conversation_get_type(conv); gc = gaim_account_get_connection(account); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && (gc == NULL || !g_slist_find(gc->buddy_chats, conv))) if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM && !g_list_find(gaim_get_conversations(), conv)) displayed = g_strdup(message); GPOINTER_TO_INT(gaim_signal_emit_return_1( gaim_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), account, who, &displayed, conv, flags)); if (who == NULL || *who == '\0') who = gaim_conversation_get_name(conv); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account))); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM || !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if (flags & GAIM_MESSAGE_SEND) { b = gaim_find_buddy(account, gaim_account_get_username(account)); if (gaim_account_get_alias(account) != NULL) else if (b != NULL && strcmp(b->name, gaim_buddy_get_contact_alias(b))) alias = gaim_buddy_get_contact_alias(b); else if (gaim_connection_get_display_name(gc) != NULL) alias = gaim_connection_get_display_name(gc); alias = gaim_account_get_username(account); b = gaim_find_buddy(account, who); alias = gaim_buddy_get_contact_alias(b); if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_conversation_is_logging(conv)) { gaim_log_write((GaimLog *)log->data, flags, alias, mtime, displayed); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV) { gaim_conv_im_set_typing_state(GAIM_CONV_IM(conv), GAIM_NOT_TYPING); ops->write_conv(conv, who, alias, displayed, flags, mtime); gaim_signal_emit(gaim_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), account, who, displayed, conv, flags); gaim_conversation_has_focus(GaimConversation *conv) GaimConversationUiOps *ops; g_return_val_if_fail(conv != NULL, FALSE); ops = gaim_conversation_get_ui_ops(conv); if (ops != NULL && ops->has_focus != NULL) ret = ops->has_focus(conv); * TODO: Need to make sure calls to this function happen in the core * instead of the UI. That way UIs have less work to do, and the * core/UI split is cleaner. Also need to make sure this is called * when chats are added/removed from the blist. gaim_conversation_update(GaimConversation *conv, GaimConvUpdateType type) g_return_if_fail(conv != NULL); gaim_signal_emit(gaim_conversations_get_handle(), "conversation-updated", conv, type); /************************************************************************** **************************************************************************/ gaim_conv_im_get_conversation(const GaimConvIm *im) g_return_val_if_fail(im != NULL, NULL); gaim_conv_im_set_icon(GaimConvIm *im, GaimBuddyIcon *icon) g_return_if_fail(im != NULL); gaim_buddy_icon_unref(im->icon); im->icon = (icon == NULL ? NULL : gaim_buddy_icon_ref(icon)); gaim_conversation_update(gaim_conv_im_get_conversation(im), gaim_conv_im_get_icon(const GaimConvIm *im) g_return_val_if_fail(im != NULL, NULL); gaim_conv_im_set_typing_state(GaimConvIm *im, GaimTypingState state) g_return_if_fail(im != NULL); if (im->typing_state != state) im->typing_state = state; if (state == GAIM_TYPING) gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing", im->conv->account, im->conv->name); gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing-stopped", im->conv->account, im->conv->name); gaim_conv_im_get_typing_state(const GaimConvIm *im) g_return_val_if_fail(im != NULL, 0); gaim_conv_im_start_typing_timeout(GaimConvIm *im, int timeout) g_return_if_fail(im != NULL); if (im->typing_timeout > 0) gaim_conv_im_stop_typing_timeout(im); conv = gaim_conv_im_get_conversation(im); name = gaim_conversation_get_name(conv); im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing, conv); gaim_conv_im_stop_typing_timeout(GaimConvIm *im) g_return_if_fail(im != NULL); if (im->typing_timeout == 0) gaim_timeout_remove(im->typing_timeout); gaim_conv_im_get_typing_timeout(const GaimConvIm *im) g_return_val_if_fail(im != NULL, 0); return im->typing_timeout; gaim_conv_im_set_type_again(GaimConvIm *im, time_t val) g_return_if_fail(im != NULL); gaim_conv_im_get_type_again(const GaimConvIm *im) g_return_val_if_fail(im != NULL, 0); gaim_conv_im_start_type_again_timeout(GaimConvIm *im) g_return_if_fail(im != NULL); im->type_again_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed, gaim_conv_im_get_conversation(im)); gaim_conv_im_stop_type_again_timeout(GaimConvIm *im) g_return_if_fail(im != NULL); if (im->type_again_timeout == 0) gaim_timeout_remove(im->type_again_timeout); im->type_again_timeout = 0; gaim_conv_im_get_type_again_timeout(const GaimConvIm *im) g_return_val_if_fail(im != NULL, 0); return im->type_again_timeout; gaim_conv_im_update_typing(GaimConvIm *im) g_return_if_fail(im != NULL); gaim_conversation_update(gaim_conv_im_get_conversation(im), GAIM_CONV_UPDATE_TYPING); gaim_conv_im_write(GaimConvIm *im, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) g_return_if_fail(im != NULL); g_return_if_fail(message != NULL); c = gaim_conv_im_get_conversation(im); /* Raise the window, if specified in prefs. */ if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) c->ui_ops->write_im(c, who, message, flags, mtime); gaim_conversation_write(c, who, message, flags, mtime); gboolean gaim_conv_present_error(const char *who, GaimAccount *account, const char *what) g_return_val_if_fail(who != NULL, FALSE); g_return_val_if_fail(account !=NULL, FALSE); g_return_val_if_fail(what != NULL, FALSE); conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, account); gaim_conversation_write(conv, NULL, what, GAIM_MESSAGE_ERROR, time(NULL)); gaim_conv_im_send(GaimConvIm *im, const char *message) gaim_conv_im_send_with_flags(im, message, 0); gaim_conv_im_send_with_flags(GaimConvIm *im, const char *message, GaimMessageFlags flags) g_return_if_fail(im != NULL); g_return_if_fail(message != NULL); common_send(gaim_conv_im_get_conversation(im), message, flags); gaim_conv_custom_smiley_add(GaimConversation *conv, const char *smile, const char *cksum_type, const char *chksum, if (conv == NULL || smile == NULL || !*smile) { /* TODO: check if the icon is in the cache and return false if so */ /* TODO: add an icon cache (that doesn't suck) */ if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) { return conv->ui_ops->custom_smiley_add(conv, smile, remote); gaim_debug_info("conversation", "Could not find add custom smiley function"); gaim_conv_custom_smiley_write(GaimConversation *conv, const char *smile, const guchar *data, gsize size) g_return_if_fail(conv != NULL); g_return_if_fail(smile != NULL && *smile); if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) conv->ui_ops->custom_smiley_write(conv, smile, data, size); gaim_debug_info("conversation", "Could not find the smiley write function"); gaim_conv_custom_smiley_close(GaimConversation *conv, const char *smile) g_return_if_fail(conv != NULL); g_return_if_fail(smile != NULL && *smile); if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) conv->ui_ops->custom_smiley_close(conv, smile); gaim_debug_info("conversation", "Could not find custom smiley close function"); /************************************************************************** **************************************************************************/ gaim_conv_chat_get_conversation(const GaimConvChat *chat) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_set_users(GaimConvChat *chat, GList *users) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_get_users(const GaimConvChat *chat) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_ignore(GaimConvChat *chat, const char *name) g_return_if_fail(chat != NULL); g_return_if_fail(name != NULL); /* Make sure the user isn't already ignored. */ if (gaim_conv_chat_is_user_ignored(chat, name)) gaim_conv_chat_set_ignored(chat, g_list_append(gaim_conv_chat_get_ignored(chat), g_strdup(name))); gaim_conv_chat_unignore(GaimConvChat *chat, const char *name) g_return_if_fail(chat != NULL); g_return_if_fail(name != NULL); /* Make sure the user is actually ignored. */ if (!gaim_conv_chat_is_user_ignored(chat, name)) item = g_list_find(gaim_conv_chat_get_ignored(chat), gaim_conv_chat_get_ignored_user(chat, name)); gaim_conv_chat_set_ignored(chat, g_list_remove_link(gaim_conv_chat_get_ignored(chat), item)); gaim_conv_chat_set_ignored(GaimConvChat *chat, GList *ignored) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_get_ignored(const GaimConvChat *chat) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_get_ignored_user(const GaimConvChat *chat, const char *user) g_return_val_if_fail(chat != NULL, NULL); g_return_val_if_fail(user != NULL, NULL); for (ignored = gaim_conv_chat_get_ignored(chat); ignored = ignored->next) { const char *ign = (const char *)ignored->data; if (!gaim_utf8_strcasecmp(user, ign) || ((*ign == '+' || *ign == '%') && !gaim_utf8_strcasecmp(user, ign + 1))) if ((*ign == '+' && !gaim_utf8_strcasecmp(user, ign + 1)) || (*ign != '+' && !gaim_utf8_strcasecmp(user, ign))) gaim_conv_chat_is_user_ignored(const GaimConvChat *chat, const char *user) g_return_val_if_fail(chat != NULL, FALSE); g_return_val_if_fail(user != NULL, FALSE); return (gaim_conv_chat_get_ignored_user(chat, user) != NULL); gaim_conv_chat_set_topic(GaimConvChat *chat, const char *who, const char *topic) g_return_if_fail(chat != NULL); if (chat->who != NULL) g_free(chat->who); if (chat->topic != NULL) g_free(chat->topic); chat->who = (who == NULL ? NULL : g_strdup(who)); chat->topic = (topic == NULL ? NULL : g_strdup(topic)); gaim_conversation_update(gaim_conv_chat_get_conversation(chat), gaim_signal_emit(gaim_conversations_get_handle(), "chat-topic-changed", chat->conv, chat->who, chat->topic); gaim_conv_chat_get_topic(const GaimConvChat *chat) g_return_val_if_fail(chat != NULL, NULL); gaim_conv_chat_set_id(GaimConvChat *chat, int id) g_return_if_fail(chat != NULL); gaim_conv_chat_get_id(const GaimConvChat *chat) g_return_val_if_fail(chat != NULL, -1); gaim_conv_chat_write(GaimConvChat *chat, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) GaimPluginProtocolInfo *prpl_info; g_return_if_fail(chat != NULL); g_return_if_fail(who != NULL); g_return_if_fail(message != NULL); conv = gaim_conv_chat_get_conversation(chat); gc = gaim_conversation_get_gc(conv); account = gaim_connection_get_account(gc); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); /* Don't display this if the person who wrote it is ignored. */ if (gaim_conv_chat_is_user_ignored(chat, who)) if (!(flags & GAIM_MESSAGE_WHISPER)) { str = g_strdup(gaim_normalize(account, who)); if (!strcmp(str, gaim_normalize(account, chat->nick))) { flags |= GAIM_MESSAGE_SEND; flags |= GAIM_MESSAGE_RECV; if (gaim_utf8_has_word(message, chat->nick)) flags |= GAIM_MESSAGE_NICK; /* Pass this on to either the ops structure or the default write func. */ if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) conv->ui_ops->write_chat(conv, who, message, flags, mtime); gaim_conversation_write(conv, who, message, flags, mtime); gaim_conv_chat_send(GaimConvChat *chat, const char *message) gaim_conv_chat_send_with_flags(chat, message, 0); gaim_conv_chat_send_with_flags(GaimConvChat *chat, const char *message, GaimMessageFlags flags) g_return_if_fail(chat != NULL); g_return_if_fail(message != NULL); common_send(gaim_conv_chat_get_conversation(chat), message, flags); gaim_conv_chat_add_user(GaimConvChat *chat, const char *user, const char *extra_msg, GaimConvChatBuddyFlags flags, GList *users = g_list_append(NULL, (char *)user); GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); gaim_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival); gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *extra_msgs, GList *flags, gboolean new_arrivals) GaimConversationUiOps *ops; GaimPluginProtocolInfo *prpl_info; g_return_if_fail(chat != NULL); g_return_if_fail(users != NULL); conv = gaim_conv_chat_get_conversation(chat); ops = gaim_conversation_get_ui_ops(conv); gc = gaim_conversation_get_gc(conv); g_return_if_fail(gc != NULL); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); g_return_if_fail(prpl_info != NULL); while ((ul != NULL) && (fl != NULL)) { const char *user = (const char *)ul->data; const char *alias = user; GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data); const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); if (!strcmp(chat->nick, gaim_normalize(conv->account, user))) { const char *alias2 = gaim_account_get_alias(conv->account); const char *display_name = gaim_connection_get_display_name(gc); if (display_name != NULL) } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if ((buddy = gaim_find_buddy(gc->account, user)) != NULL) alias = gaim_buddy_get_contact_alias(buddy); quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(), "chat-buddy-joining", conv, user, flags)) | gaim_conv_chat_is_user_ignored(chat, user); cb = gaim_conv_chat_cb_new(user, flags); gaim_conv_chat_set_users(chat, g_list_prepend(gaim_conv_chat_get_users(chat), cb)); /* We reverse this later to keep it in the same order as users. */ aliases = g_list_prepend(aliases, (char *)alias); if (!quiet && new_arrivals) { char *escaped = g_markup_escape_text(alias, -1); tmp = g_strdup_printf(_("%s entered the room."), escaped); char *escaped2 = g_markup_escape_text(extra_msg, -1); tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."), gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-joined", conv, user, flags, new_arrivals); extra_msgs = extra_msgs->next; /* This needs to be in the same order as users, but it's faster * to prepend, so we do that above. */ aliases = g_list_reverse(aliases); if (ops != NULL && ops->chat_add_users != NULL) ops->chat_add_users(conv, users, flags, aliases, new_arrivals); gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user, GaimConversationUiOps *ops; GaimPluginProtocolInfo *prpl_info; GaimConvChatBuddyFlags flags; const char *new_alias = new_user; g_return_if_fail(chat != NULL); g_return_if_fail(old_user != NULL); g_return_if_fail(new_user != NULL); conv = gaim_conv_chat_get_conversation(chat); ops = gaim_conversation_get_ui_ops(conv); gc = gaim_conversation_get_gc(conv); g_return_if_fail(gc != NULL); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); g_return_if_fail(prpl_info != NULL); flags = gaim_conv_chat_user_get_flags(chat, old_user); cb = gaim_conv_chat_cb_new(new_user, flags); gaim_conv_chat_set_users(chat, g_list_prepend(gaim_conv_chat_get_users(chat), cb)); if (!strcmp(chat->nick, gaim_normalize(conv->account, old_user))) { /* Note this for later. */ alias = gaim_account_get_alias(conv->account); const char *display_name = gaim_connection_get_display_name(gc); if (display_name != NULL) } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if ((buddy = gaim_find_buddy(gc->account, new_user)) != NULL) new_alias = gaim_buddy_get_contact_alias(buddy); if (ops != NULL && ops->chat_rename_user != NULL) ops->chat_rename_user(conv, old_user, new_user, new_alias); cb = gaim_conv_chat_cb_find(chat, old_user); gaim_conv_chat_set_users(chat, g_list_remove(gaim_conv_chat_get_users(chat), cb)); gaim_conv_chat_cb_destroy(cb); if (gaim_conv_chat_is_user_ignored(chat, old_user)) { gaim_conv_chat_unignore(chat, old_user); gaim_conv_chat_ignore(chat, new_user); else if (gaim_conv_chat_is_user_ignored(chat, new_user)) gaim_conv_chat_unignore(chat, new_user); gaim_conv_chat_set_nick(chat, new_user); if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change") && !gaim_conv_chat_is_user_ignored(chat, new_user)) { char *escaped = g_markup_escape_text(new_user, -1); g_snprintf(tmp, sizeof(tmp), _("You are now known as %s"), escaped); const char *old_alias = old_user; const char *new_alias = new_user; if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if ((buddy = gaim_find_buddy(gc->account, old_user)) != NULL) old_alias = gaim_buddy_get_contact_alias(buddy); if ((buddy = gaim_find_buddy(gc->account, new_user)) != NULL) new_alias = gaim_buddy_get_contact_alias(buddy); escaped = g_markup_escape_text(old_alias, -1); escaped2 = g_markup_escape_text(new_alias, -1); g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), escaped, escaped2); gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); gaim_conv_chat_remove_user(GaimConvChat *chat, const char *user, const char *reason) GList *users = g_list_append(NULL, (char *)user); gaim_conv_chat_remove_users(chat, users, reason); gaim_conv_chat_remove_users(GaimConvChat *chat, GList *users, const char *reason) GaimPluginProtocolInfo *prpl_info; GaimConversationUiOps *ops; g_return_if_fail(chat != NULL); g_return_if_fail(users != NULL); conv = gaim_conv_chat_get_conversation(chat); gc = gaim_conversation_get_gc(conv); g_return_if_fail(gc != NULL); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); g_return_if_fail(prpl_info != NULL); ops = gaim_conversation_get_ui_ops(conv); for (l = users; l != NULL; l = l->next) { const char *user = (const char *)l->data; quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(), "chat-buddy-leaving", conv, user, reason)) | gaim_conv_chat_is_user_ignored(chat, user); cb = gaim_conv_chat_cb_find(chat, user); gaim_conv_chat_set_users(chat, g_list_remove(gaim_conv_chat_get_users(chat), cb)); gaim_conv_chat_cb_destroy(cb); /* NOTE: Don't remove them from ignored in case they re-enter. */ const char *alias = user; if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if ((buddy = gaim_find_buddy(gc->account, user)) != NULL) alias = gaim_buddy_get_contact_alias(buddy); escaped = g_markup_escape_text(alias, -1); if (reason == NULL || !*reason) tmp = g_strdup_printf(_("%s left the room."), escaped); char *escaped2 = g_markup_escape_text(reason, -1); tmp = g_strdup_printf(_("%s left the room (%s)."), gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left", if (ops != NULL && ops->chat_remove_users != NULL) ops->chat_remove_users(conv, users); gaim_conv_chat_clear_users(GaimConvChat *chat) GaimConversationUiOps *ops; GList *users, *names = NULL; g_return_if_fail(chat != NULL); conv = gaim_conv_chat_get_conversation(chat); ops = gaim_conversation_get_ui_ops(conv); users = gaim_conv_chat_get_users(chat); if (ops != NULL && ops->chat_remove_users != NULL) { for (l = users; l; l = l->next) { GaimConvChatBuddy *cb = l->data; names = g_list_append(names, cb->name); ops->chat_remove_users(conv, names); for (l = users; l; l = l->next) GaimConvChatBuddy *cb = l->data; gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-leaving", conv, cb->name, NULL); gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left", conv, cb->name, NULL); gaim_conv_chat_cb_destroy(cb); gaim_conv_chat_set_users(chat, NULL); gaim_conv_chat_find_user(GaimConvChat *chat, const char *user) g_return_val_if_fail(chat != NULL, FALSE); g_return_val_if_fail(user != NULL, FALSE); return (gaim_conv_chat_cb_find(chat, user) != NULL); gaim_conv_chat_user_set_flags(GaimConvChat *chat, const char *user, GaimConvChatBuddyFlags flags) GaimConversationUiOps *ops; GaimConvChatBuddyFlags oldflags; g_return_if_fail(chat != NULL); g_return_if_fail(user != NULL); cb = gaim_conv_chat_cb_find(chat, user); conv = gaim_conv_chat_get_conversation(chat); ops = gaim_conversation_get_ui_ops(conv); if (ops != NULL && ops->chat_update_user != NULL) ops->chat_update_user(conv, user); gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-flags", conv, user, oldflags, flags); gaim_conv_chat_user_get_flags(GaimConvChat *chat, const char *user) g_return_val_if_fail(chat != NULL, 0); g_return_val_if_fail(user != NULL, 0); cb = gaim_conv_chat_cb_find(chat, user); return GAIM_CBFLAGS_NONE; void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) { g_return_if_fail(chat != NULL); chat->nick = g_strdup(gaim_normalize(chat->conv->account, nick)); const char *gaim_conv_chat_get_nick(GaimConvChat *chat) { g_return_val_if_fail(chat != NULL, NULL); gaim_find_chat(const GaimConnection *gc, int id) for (l = gaim_get_chats(); l != NULL; l = l->next) { conv = (GaimConversation *)l->data; if (gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)) == id && gaim_conversation_get_gc(conv) == gc) gaim_conv_chat_left(GaimConvChat *chat) g_return_if_fail(chat != NULL); gaim_conversation_update(chat->conv, GAIM_CONV_UPDATE_CHATLEFT); gaim_conv_chat_has_left(GaimConvChat *chat) g_return_val_if_fail(chat != NULL, TRUE); gaim_conv_chat_cb_new(const char *name, GaimConvChatBuddyFlags flags) g_return_val_if_fail(name != NULL, NULL); cb = g_new0(GaimConvChatBuddy, 1); cb->name = g_strdup(name); GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy); gaim_conv_chat_cb_find(GaimConvChat *chat, const char *name) GaimConvChatBuddy *cb = NULL; g_return_val_if_fail(chat != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); for (l = gaim_conv_chat_get_users(chat); l; l = l->next) { if (!gaim_utf8_strcasecmp(cb->name, name)) gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb) g_return_if_fail(cb != NULL); GAIM_DBUS_UNREGISTER_POINTER(cb); gaim_conv_chat_cb_get_name(GaimConvChatBuddy *cb) g_return_val_if_fail(cb != NULL, NULL); gaim_conversations_get_handle(void) gaim_conversations_init(void) void *handle = gaim_conversations_get_handle(); /********************************************************************** **********************************************************************/ gaim_prefs_add_none("/core/conversations"); /* Conversations -> Chat */ gaim_prefs_add_none("/core/conversations/chat"); gaim_prefs_add_bool("/core/conversations/chat/show_nick_change", TRUE); /* Conversations -> IM */ gaim_prefs_add_none("/core/conversations/im"); gaim_prefs_add_bool("/core/conversations/im/send_typing", TRUE); /********************************************************************** **********************************************************************/ gaim_signal_register(handle, "writing-im-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "wrote-im-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "sending-im-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING)); gaim_signal_register(handle, "sent-im-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "receiving-im-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new_outgoing(GAIM_TYPE_UINT)); gaim_signal_register(handle, "received-im-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "writing-chat-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "wrote-chat-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "sending-chat-msg", gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "sent-chat-msg", gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "receiving-chat-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new_outgoing(GAIM_TYPE_UINT)); gaim_signal_register(handle, "received-chat-msg", gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "conversation-created", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION)); gaim_signal_register(handle, "conversation-updated", gaim_marshal_VOID__POINTER_UINT, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "deleting-conversation", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION)); gaim_signal_register(handle, "buddy-typing", gaim_marshal_VOID__POINTER_POINTER, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "buddy-typing-stopped", gaim_marshal_VOID__POINTER_POINTER, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "chat-buddy-joining", gaim_marshal_BOOLEAN__POINTER_POINTER_UINT, gaim_value_new(GAIM_TYPE_BOOLEAN), 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "chat-buddy-joined", gaim_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT), gaim_value_new(GAIM_TYPE_BOOLEAN)); gaim_signal_register(handle, "chat-buddy-flags", gaim_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT), gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "chat-buddy-leaving", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "chat-buddy-left", gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "chat-inviting-user", gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING)); gaim_signal_register(handle, "chat-invited-user", gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "chat-invited", gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_SUBTYPE, gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_POINTER)); gaim_signal_register(handle, "chat-joined", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION)); gaim_signal_register(handle, "chat-left", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION)); gaim_signal_register(handle, "chat-topic-changed", gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); gaim_conversations_uninit(void) gaim_conversation_destroy((GaimConversation*)conversations->data); gaim_signals_unregister_by_instance(gaim_conversations_get_handle());