diff options
author | Gary Kramlich <grim@reaperworld.com> | 2021-05-18 02:04:53 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2021-05-18 02:04:53 -0500 |
commit | e1d343b9543787cfc900dd9762e2061b343c02f2 (patch) | |
tree | 03b034fe406ca9d9f0633eadacf83e42e13da2f6 | |
parent | 784e1683a89d43de6a5ae4047ead6c0f8d8f9229 (diff) | |
download | pidgin-e1d343b9543787cfc900dd9762e2061b343c02f2.tar.gz |
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Testing Done:
Tested a bonjour im and irc chat.
Reviewed at https://reviews.imfreedom.org/r/646/
38 files changed, 358 insertions, 345 deletions
diff --git a/finch/gntblist.c b/finch/gntblist.c index 48b306ffac..e519d0b989 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -612,16 +612,16 @@ join_chat(PurpleChat *chat) { PurpleAccount *account = purple_chat_get_account(chat); const char *name; - PurpleChatConversation *conv; + PurpleConversation *conv; name = purple_chat_get_name_only(chat); conv = purple_conversations_find_chat_with_account(name, account); - if (!conv || purple_chat_conversation_has_left(conv)) { + if (!conv || purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(conv))) { purple_serv_join_chat(purple_account_get_connection(account), purple_chat_get_components(chat)); } else if (conv) { - purple_conversation_present(PURPLE_CONVERSATION(conv)); + purple_conversation_present(conv); } } @@ -916,17 +916,17 @@ selection_activate(GntWidget *widget, FinchBuddyList *ggblist) if (PURPLE_IS_BUDDY(node)) { PurpleBuddy *buddy = (PurpleBuddy *)node; - PurpleIMConversation *im; + PurpleConversation *im; im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (!im) { im = purple_im_conversation_new(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); } else { - FinchConv *ggconv = FINCH_CONV(PURPLE_CONVERSATION(im)); + FinchConv *ggconv = FINCH_CONV(im); gnt_window_present(ggconv->window); } - finch_conversation_set_active(PURPLE_CONVERSATION(im)); + finch_conversation_set_active(im); } else if (PURPLE_IS_CHAT(node)) { @@ -2602,13 +2602,13 @@ send_im_select_cb(gpointer data, PurpleRequestFields *fields) { PurpleAccount *account; const char *username; - PurpleIMConversation *im; + PurpleConversation *im; account = purple_request_fields_get_account(fields, "account"); username = purple_request_fields_get_string(fields, "screenname"); im = purple_im_conversation_new(account, username); - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); } static void @@ -2652,7 +2652,7 @@ join_chat_select_cb(gpointer data, PurpleRequestFields *fields) PurpleConnection *gc; PurpleChat *chat; GHashTable *hash = NULL; - PurpleChatConversation *conv; + PurpleConversation *conv; account = purple_request_fields_get_account(fields, "account"); name = purple_request_fields_get_string(fields, "chat"); @@ -2666,9 +2666,9 @@ join_chat_select_cb(gpointer data, PurpleRequestFields *fields) * a new conversation window will pop up when we finally join the chat. */ if (!(conv = purple_conversations_find_chat_with_account(name, account))) { conv = purple_chat_conversation_new(account, name); - purple_chat_conversation_leave(conv); + purple_chat_conversation_leave(PURPLE_CHAT_CONVERSATION(conv)); } else { - purple_conversation_present(PURPLE_CONVERSATION(conv)); + purple_conversation_present(conv); } chat = purple_blist_find_chat(account, name); diff --git a/finch/gntconv.c b/finch/gntconv.c index 767b9d66f4..57474025d0 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -190,12 +190,12 @@ save_position_cb(GntWidget *w, int x, int y) purple_prefs_set_int(PREF_ROOT "/position/y", y); } -static PurpleIMConversation * +static PurpleConversation * find_im_with_contact(PurpleAccount *account, const char *name) { PurpleBlistNode *node; PurpleBuddy *buddy = purple_blist_find_buddy(account, name); - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; if (!buddy) return NULL; @@ -224,16 +224,16 @@ static void update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) { FinchConv *ggc; - PurpleIMConversation *im; PurpleConversation *conv; + PurpleIMConversation *im; char *title, *str; - im = purple_conversations_find_im_with_account(who, account); + conv = purple_conversations_find_im_with_account(who, account); - if (!im) + if (!conv) return; - conv = PURPLE_CONVERSATION(im); + im = PURPLE_IM_CONVERSATION(conv); ggc = FINCH_CONV(conv); if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_TYPING) { @@ -270,10 +270,10 @@ chat_left_cb(PurpleConversation *conv, gpointer null) static void buddy_signed_on_off(PurpleBuddy *buddy, gpointer null) { - PurpleIMConversation *im = find_im_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); + PurpleConversation *im = find_im_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); if (im == NULL) return; - generate_send_to_menu(FINCH_CONV(PURPLE_CONVERSATION(im))); + generate_send_to_menu(FINCH_CONV(im)); } static void @@ -282,10 +282,10 @@ account_signed_on_off(PurpleConnection *gc, gpointer null) GList *list = purple_conversations_get_ims(); while (list) { PurpleConversation *conv = list->data; - PurpleIMConversation *cc = find_im_with_contact( + PurpleConversation *cc = find_im_with_contact( purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (cc) - generate_send_to_menu(FINCH_CONV(PURPLE_CONVERSATION(cc))); + generate_send_to_menu(FINCH_CONV(cc)); list = list->next; } @@ -462,8 +462,8 @@ send_to_cb(GntMenuItem *m, gpointer n) { PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account"); gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name"); - PurpleIMConversation *im = purple_im_conversation_new(account, buddy); - finch_conversation_set_active(PURPLE_CONVERSATION(im)); + PurpleConversation *im = purple_im_conversation_new(account, buddy); + finch_conversation_set_active(im); } static void @@ -736,7 +736,7 @@ finch_create_conversation(PurpleConversation *conv) } account = purple_conversation_get_account(conv); - cc = PURPLE_CONVERSATION(find_im_with_contact(account, purple_conversation_get_name(conv))); + cc = find_im_with_contact(account, purple_conversation_get_name(conv)); if (cc && FINCH_CONV(cc)) ggc = FINCH_CONV(cc); else diff --git a/libpurple/buddy.c b/libpurple/buddy.c index 2b0d7317ef..5422c9faca 100644 --- a/libpurple/buddy.c +++ b/libpurple/buddy.c @@ -436,7 +436,7 @@ void purple_buddy_set_local_alias(PurpleBuddy *buddy, const gchar *alias) { PurpleBuddyList *blist = NULL; PurpleBuddyPrivate *priv = NULL; - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; gchar *old_alias = NULL, *new_alias = NULL; g_return_if_fail(PURPLE_IS_BUDDY(buddy)); @@ -469,7 +469,7 @@ purple_buddy_set_local_alias(PurpleBuddy *buddy, const gchar *alias) { im = purple_conversations_find_im_with_account(priv->name, priv->account); if(PURPLE_IS_IM_CONVERSATION(im)) { - purple_conversation_autoset_title(PURPLE_CONVERSATION(im)); + purple_conversation_autoset_title(im); } purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy, @@ -492,7 +492,7 @@ void purple_buddy_set_server_alias(PurpleBuddy *buddy, const gchar *alias) { PurpleBuddyList *blist = NULL; PurpleBuddyPrivate *priv = NULL; - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; gchar *old_alias = NULL, *new_alias = NULL; g_return_if_fail(PURPLE_IS_BUDDY(buddy)); @@ -527,7 +527,7 @@ purple_buddy_set_server_alias(PurpleBuddy *buddy, const gchar *alias) { im = purple_conversations_find_im_with_account(priv->name, priv->account); if(PURPLE_IS_IM_CONVERSATION(im)) { - purple_conversation_autoset_title(PURPLE_CONVERSATION(im)); + purple_conversation_autoset_title(im); } purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy, diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index 969afeebff..1aa5a7275e 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -378,7 +378,7 @@ purple_buddy_icon_unref(PurpleBuddyIcon *icon) void purple_buddy_icon_update(PurpleBuddyIcon *icon) { - PurpleIMConversation *im; + PurpleConversation *im; PurpleAccount *account; const char *username; PurpleBuddyIcon *icon_to_set; @@ -441,9 +441,10 @@ purple_buddy_icon_update(PurpleBuddyIcon *icon) } im = purple_conversations_find_im_with_account(username, account); - - if (im != NULL) - purple_im_conversation_set_icon(im, icon_to_set); + if(PURPLE_IS_IM_CONVERSATION(im)) { + purple_im_conversation_set_icon(PURPLE_IM_CONVERSATION(im), + icon_to_set); + } /* icon's refcount was incremented above */ purple_buddy_icon_unref(icon); @@ -914,7 +915,7 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, child = purple_blist_node_get_sibling_next(child)) { PurpleBuddy *buddy; - PurpleIMConversation *im; + PurpleConversation *im; if (!PURPLE_IS_BUDDY(child)) continue; @@ -923,7 +924,7 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (im) - purple_conversation_update(PURPLE_CONVERSATION(im), PURPLE_CONVERSATION_UPDATE_ICON); + purple_conversation_update(im, PURPLE_CONVERSATION_UPDATE_ICON); /* Is this call necessary anymore? Can the buddies * themselves need updating when the custom buddy @@ -932,11 +933,11 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, PURPLE_BLIST_NODE(buddy)); } } else if (PURPLE_IS_CHAT(node)) { - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; chat = purple_conversations_find_chat_with_account(purple_chat_get_name((PurpleChat*)node), purple_chat_get_account((PurpleChat*)node)); if (chat) { - purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_ICON); + purple_conversation_update(chat, PURPLE_CONVERSATION_UPDATE_ICON); } } diff --git a/libpurple/contact.c b/libpurple/contact.c index 43a83d4496..0a1e01c1cb 100644 --- a/libpurple/contact.c +++ b/libpurple/contact.c @@ -113,7 +113,7 @@ void purple_contact_set_alias(PurpleContact *contact, const char *alias) { PurpleContactPrivate *priv = NULL; - PurpleIMConversation *im; + PurpleConversation *im; PurpleBlistNode *bnode; char *old_alias; char *new_alias = NULL; @@ -153,7 +153,7 @@ purple_contact_set_alias(PurpleContact *contact, const char *alias) im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (im) - purple_conversation_autoset_title(PURPLE_CONVERSATION(im)); + purple_conversation_autoset_title(im); } purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", diff --git a/libpurple/conversations.c b/libpurple/conversations.c index 50c63513f7..58a84d9040 100644 --- a/libpurple/conversations.c +++ b/libpurple/conversations.c @@ -184,11 +184,11 @@ purple_conversations_find_with_account(const char *name, return c; } -PurpleIMConversation * +PurpleConversation * purple_conversations_find_im_with_account(const char *name, PurpleAccount *account) { - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; struct _purple_hconv hc; g_return_val_if_fail(name != NULL, NULL); @@ -202,11 +202,11 @@ purple_conversations_find_im_with_account(const char *name, return im; } -PurpleChatConversation * +PurpleConversation * purple_conversations_find_chat_with_account(const char *name, PurpleAccount *account) { - PurpleChatConversation *c = NULL; + PurpleConversation *c = NULL; struct _purple_hconv hc; g_return_val_if_fail(name != NULL, NULL); @@ -220,17 +220,17 @@ purple_conversations_find_chat_with_account(const char *name, return c; } -PurpleChatConversation * +PurpleConversation * purple_conversations_find_chat(const PurpleConnection *gc, int id) { GList *l; - PurpleChatConversation *chat; + PurpleConversation *chat; for (l = purple_conversations_get_chats(); l != NULL; l = l->next) { - chat = (PurpleChatConversation *)l->data; + chat = (PurpleConversation *)l->data; - if (purple_chat_conversation_get_id(chat) == id && - purple_conversation_get_connection(PURPLE_CONVERSATION(chat)) == gc) + if (purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)) == id && + purple_conversation_get_connection(chat) == gc) return chat; } diff --git a/libpurple/conversations.h b/libpurple/conversations.h index 9df58c213f..5f0d15245d 100644 --- a/libpurple/conversations.h +++ b/libpurple/conversations.h @@ -33,7 +33,7 @@ * @see_also: <link linkend="chapter-signals-conversation">Conversation signals</link> */ -#include "purplechatconversation.h" +#include <purpleconversation.h> #include "server.h" G_BEGIN_DECLS @@ -108,8 +108,7 @@ PurpleConversation *purple_conversations_find_with_account(const char *name, * * Returns: (transfer none): The conversation if found, or %NULL otherwise. */ -PurpleIMConversation *purple_conversations_find_im_with_account(const char *name, - PurpleAccount *account); +PurpleConversation *purple_conversations_find_im_with_account(const char *name, PurpleAccount *account); /** * purple_conversations_find_chat_with_account: @@ -120,8 +119,7 @@ PurpleIMConversation *purple_conversations_find_im_with_account(const char *name * * Returns: (transfer none): The conversation if found, or %NULL otherwise. */ -PurpleChatConversation *purple_conversations_find_chat_with_account(const char *name, - PurpleAccount *account); +PurpleConversation *purple_conversations_find_chat_with_account(const char *name, PurpleAccount *account); /** * purple_conversations_find_chat: @@ -132,7 +130,7 @@ PurpleChatConversation *purple_conversations_find_chat_with_account(const char * * * Returns: (transfer none): The chat conversation. */ -PurpleChatConversation *purple_conversations_find_chat(const PurpleConnection *gc, int id); +PurpleConversation *purple_conversations_find_chat(const PurpleConnection *gc, int id); /** * purple_conversations_set_ui_ops: diff --git a/libpurple/plugins/psychic.c b/libpurple/plugins/psychic.c index 025e369ce5..bdc9bbccd4 100644 --- a/libpurple/plugins/psychic.c +++ b/libpurple/plugins/psychic.c @@ -38,7 +38,7 @@ static void buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { - PurpleIMConversation *im; + PurpleConversation *im; if(purple_prefs_get_bool(PREF_STATUS) && ! purple_status_is_available(purple_account_get_active_status(acct))) { @@ -63,7 +63,7 @@ buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { im = purple_im_conversation_new(acct, name); if(purple_prefs_get_bool(PREF_RAISE)) { - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); } if(purple_prefs_get_bool(PREF_NOTICE)) { @@ -72,13 +72,14 @@ buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { translate it literally. If you can't find a fitting cultural reference in your language, consider translating something like this instead: "You feel a new message coming." */ - purple_conversation_write_system_message(PURPLE_CONVERSATION(im), + purple_conversation_write_system_message(im, _("You feel a disturbance in the force..."), PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY); } /* Necessary because we may be creating a new conversation window. */ - purple_im_conversation_set_typing_state(im, PURPLE_IM_TYPING); + purple_im_conversation_set_typing_state(PURPLE_IM_CONVERSATION(im), + PURPLE_IM_TYPING); } } diff --git a/libpurple/plugins/statenotify.c b/libpurple/plugins/statenotify.c index b5b036a499..56b6fd0c89 100644 --- a/libpurple/plugins/statenotify.c +++ b/libpurple/plugins/statenotify.c @@ -25,7 +25,7 @@ static void write_status(PurpleBuddy *buddy, const char *message) { PurpleAccount *account = NULL; - PurpleIMConversation *im; + PurpleConversation *im; const char *who; char buf[256]; char *escaped; @@ -49,7 +49,7 @@ write_status(PurpleBuddy *buddy, const char *message) g_snprintf(buf, sizeof(buf), message, escaped); g_free(escaped); - purple_conversation_write_system_message(PURPLE_CONVERSATION(im), buf, + purple_conversation_write_system_message(im, buf, PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY); } diff --git a/libpurple/protocols.c b/libpurple/protocols.c index 2918ff53bf..26366d8fa5 100644 --- a/libpurple/protocols.c +++ b/libpurple/protocols.c @@ -363,7 +363,7 @@ purple_protocol_send_attention(PurpleConnection *gc, const char *who, guint type PurpleAttentionType *attn; PurpleProtocol *protocol; PurpleProtocolManager *manager; - PurpleIMConversation *im; + PurpleConversation *im; PurpleBuddy *buddy; const char *alias; gchar *description; diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c index 75762eb813..2b6214712c 100644 --- a/libpurple/protocols/facebook/facebook.c +++ b/libpurple/protocols/facebook/facebook.c @@ -390,7 +390,7 @@ fb_cb_api_events(FbApi *api, GSList *events, gpointer data) GHashTableIter iter; GSList *l; PurpleAccount *acct; - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleConnection *gc; gc = fb_data_get_connection(fata); @@ -411,7 +411,7 @@ fb_cb_api_events(FbApi *api, GSList *events, gpointer data) switch (event->type) { case FB_API_EVENT_TYPE_THREAD_TOPIC: - purple_chat_conversation_set_topic(chat, uid, + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), uid, event->text); break; @@ -431,12 +431,12 @@ fb_cb_api_events(FbApi *api, GSList *events, gpointer data) } } - purple_chat_conversation_add_user(chat, uid, NULL, 0, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), uid, NULL, 0, TRUE); break; case FB_API_EVENT_TYPE_THREAD_USER_REMOVED: - purple_chat_conversation_remove_user(chat, uid, event->text); + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), uid, event->text); break; } } @@ -506,7 +506,7 @@ fb_cb_api_messages(FbApi *api, GSList *msgs, gpointer data) gint64 tstamp; GSList *l; PurpleAccount *acct; - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleConnection *gc; PurpleMessageFlags flags; @@ -577,7 +577,7 @@ fb_cb_api_messages(FbApi *api, GSList *msgs, gpointer data) purple_serv_got_joined_chat(gc, id, tid); fb_api_thread(api, msg->tid); } else { - id = purple_chat_conversation_get_id(chat); + id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)); } if (mark && !isself) { @@ -631,6 +631,7 @@ fb_cb_api_thread(FbApi *api, FbApiThread *thrd, gpointer data) gint id; GSList *l; PurpleAccount *acct; + PurpleConversation *conv; PurpleChatConversation *chat; PurpleConnection *gc; @@ -639,10 +640,10 @@ fb_cb_api_thread(FbApi *api, FbApiThread *thrd, gpointer data) id = fb_id_hash(&thrd->tid); FB_ID_TO_STR(thrd->tid, tid); - chat = purple_conversations_find_chat_with_account(tid, acct); - - if ((chat == NULL) || purple_chat_conversation_has_left(chat)) { - chat = purple_serv_got_joined_chat(gc, id, tid); + conv = purple_conversations_find_chat_with_account(tid, acct); + if((conv == NULL) || purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(conv))) { + conv = purple_serv_got_joined_chat(gc, id, tid); + chat = PURPLE_CHAT_CONVERSATION(conv); active = FALSE; } else { /* If there are no users in the group chat, including @@ -650,6 +651,7 @@ fb_cb_api_thread(FbApi *api, FbApiThread *thrd, gpointer data) * setup by this function. As a result, any group chat * without users is inactive. */ + chat = PURPLE_CHAT_CONVERSATION(conv); active = purple_chat_conversation_get_users_count(chat) > 0; } @@ -700,7 +702,7 @@ fb_cb_api_thread_kicked(FbApi *api, FbApiThread *thrd, gpointer data) gchar tid[FB_ID_STRMAX]; PurpleAccount *acct; PurpleConnection *gc; - PurpleChatConversation *chat; + PurpleConversation *chat; FB_ID_TO_STR(thrd->tid, tid); @@ -720,10 +722,10 @@ fb_cb_api_thread_kicked(FbApi *api, FbApiThread *thrd, gpointer data) return; } - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + purple_conversation_write_system_message(chat, _("You have been removed from this chat"), 0); - purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); + purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat))); } static void @@ -1305,7 +1307,7 @@ fb_chat_join(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, FbData *fata; FbId tid; gint id; - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleRequestCommonParameters *cpar; name = g_hash_table_lookup(data, "name"); @@ -1325,8 +1327,8 @@ fb_chat_join(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, id = fb_id_hash(&tid); chat = purple_conversations_find_chat(gc, id); - if ((chat != NULL) && !purple_chat_conversation_has_left(chat)) { - purple_conversation_present(PURPLE_CONVERSATION(chat)); + if ((chat != NULL) && !purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(chat))) { + purple_conversation_present(chat); return; } @@ -1355,7 +1357,7 @@ fb_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, FbData *fata; FbId tid; FbId uid; - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleRequestCommonParameters *cpar; if (!FB_ID_IS_STR(who)) { @@ -1372,7 +1374,7 @@ fb_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, api = fb_data_get_api(fata); chat = purple_conversations_find_chat(gc, id); - name = purple_conversation_get_name(PURPLE_CONVERSATION(chat)); + name = purple_conversation_get_name(chat); tid = FB_ID_FROM_STR(name); uid = FB_ID_FROM_STR(who); @@ -1390,14 +1392,14 @@ fb_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id, FbId tid; gchar *sext; PurpleAccount *acct; - PurpleChatConversation *chat; + PurpleConversation *chat; acct = purple_connection_get_account(gc); fata = purple_connection_get_protocol_data(gc); api = fb_data_get_api(fata); chat = purple_conversations_find_chat(gc, id); - name = purple_conversation_get_name(PURPLE_CONVERSATION(chat)); + name = purple_conversation_get_name(chat); tid = FB_ID_FROM_STR(name); text = purple_message_get_contents(msg); @@ -1421,13 +1423,13 @@ fb_chat_set_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, FbApi *api; FbData *fata; FbId tid; - PurpleChatConversation *chat; + PurpleConversation *chat; fata = purple_connection_get_protocol_data(gc); api = fb_data_get_api(fata); chat = purple_conversations_find_chat(gc, id); - name = purple_conversation_get_name(PURPLE_CONVERSATION(chat)); + name = purple_conversation_get_name(chat); tid = FB_ID_FROM_STR(name); fb_api_thread_topic(api, tid, topic); } diff --git a/libpurple/protocols/facebook/util.c b/libpurple/protocols/facebook/util.c index 7bd70d1c73..612c4a1c63 100644 --- a/libpurple/protocols/facebook/util.c +++ b/libpurple/protocols/facebook/util.c @@ -436,7 +436,7 @@ fb_util_serv_got_im(PurpleConnection *gc, const gchar *who, const gchar *text, GDateTime *dt = NULL; const gchar *name, *me; PurpleAccount *acct; - PurpleIMConversation *conv; + PurpleConversation *conv; PurpleMessage *msg; if (!(flags & PURPLE_MESSAGE_SEND)) { @@ -459,7 +459,7 @@ fb_util_serv_got_im(PurpleConnection *gc, const gchar *who, const gchar *text, purple_message_set_timestamp(msg, dt); g_date_time_unref(dt); - purple_conversation_write_message(PURPLE_CONVERSATION(conv), msg); + purple_conversation_write_message(conv, msg); g_object_unref(G_OBJECT(msg)); } @@ -472,7 +472,7 @@ fb_util_serv_got_chat_in(PurpleConnection *gc, gint id, const gchar *who, GDateTime *dt = NULL; const gchar *name; PurpleAccount *acct; - PurpleChatConversation *conv; + PurpleConversation *conv; PurpleMessage *msg; const gchar *me; @@ -493,7 +493,7 @@ fb_util_serv_got_chat_in(PurpleConnection *gc, gint id, const gchar *who, purple_message_set_timestamp(msg, dt); g_date_time_unref(dt); - purple_conversation_write_message(PURPLE_CONVERSATION(conv), msg); + purple_conversation_write_message(conv, msg); g_object_unref(G_OBJECT(msg)); } diff --git a/libpurple/protocols/gg/chat.c b/libpurple/protocols/gg/chat.c index 7be91ecfa5..5445cd0439 100644 --- a/libpurple/protocols/gg/chat.c +++ b/libpurple/protocols/gg/chat.c @@ -140,13 +140,15 @@ static ggp_chat_local_info * ggp_chat_get(PurpleConnection *gc, uint64_t id) static void ggp_chat_open_conv(ggp_chat_local_info *chat) { + PurpleConversation *conv; int i; if (chat->conv != NULL) return; - chat->conv = purple_serv_got_joined_chat(chat->gc, chat->local_id, + conv = purple_serv_got_joined_chat(chat->gc, chat->local_id, ggp_chat_get_name_from_id(chat->id)); + chat->conv = PURPLE_CHAT_CONVERSATION(conv); if (chat->previously_joined) { purple_conversation_write_system_message( PURPLE_CONVERSATION(chat->conv), @@ -486,7 +488,7 @@ ggp_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, { GGPInfo *info = purple_connection_get_protocol_data(gc); GDateTime *dt = NULL; - PurpleChatConversation *conv; + PurpleConversation *conv; ggp_chat_local_info *chat; gboolean succ = TRUE; const gchar *me; @@ -503,7 +505,7 @@ ggp_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, ggp_chat_get_name_from_id(chat->id), purple_connection_get_account(gc)); - gg_msg = ggp_message_format_to_gg(PURPLE_CONVERSATION(conv), + gg_msg = ggp_message_format_to_gg(conv, purple_message_get_contents(msg)); if (gg_chat_send_message(info->session, chat->id, gg_msg, TRUE) < 0) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index f2fb01425a..806bd0546f 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -612,7 +612,7 @@ gg_uri_handler(const gchar *scheme, const gchar *screenname, { GList *accounts; GList *account_node; - PurpleIMConversation *im; + PurpleConversation *im; g_return_val_if_fail(screenname != NULL, FALSE); @@ -635,7 +635,7 @@ gg_uri_handler(const gchar *scheme, const gchar *screenname, } im = purple_im_conversation_new(account_node->data, screenname); - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); return TRUE; } diff --git a/libpurple/protocols/gg/message-prpl.c b/libpurple/protocols/gg/message-prpl.c index 5ee6ee2253..356494c3ae 100644 --- a/libpurple/protocols/gg/message-prpl.c +++ b/libpurple/protocols/gg/message-prpl.c @@ -83,7 +83,7 @@ static ggp_font * ggp_font_new(void); static ggp_font * ggp_font_clone(ggp_font *font); static void ggp_font_free(gpointer font); -static PurpleIMConversation * ggp_message_get_conv(PurpleConnection *gc, +static PurpleConversation * ggp_message_get_conv(PurpleConnection *gc, uin_t uin); static void ggp_message_got_data_free(ggp_message_got_data *msg); static void ggp_message_got_display(PurpleConnection *gc, @@ -162,11 +162,11 @@ static void ggp_font_free(gpointer _font) /**/ -static PurpleIMConversation * ggp_message_get_conv(PurpleConnection *gc, +static PurpleConversation * ggp_message_get_conv(PurpleConnection *gc, uin_t uin) { PurpleAccount *account = purple_connection_get_account(gc); - PurpleIMConversation *im; + PurpleConversation *im; const gchar *who = ggp_uin_to_str(uin); im = purple_conversations_find_im_with_account(who, account); @@ -237,7 +237,7 @@ static void ggp_message_got_display(PurpleConnection *gc, } else if (msg->type == GGP_MESSAGE_GOT_TYPE_MULTILOGON) { GDateTime *dt = NULL; PurpleAccount *account = NULL; - PurpleIMConversation *im = ggp_message_get_conv(gc, msg->user); + PurpleConversation *im = ggp_message_get_conv(gc, msg->user); PurpleMessage *pmsg; const gchar *me = NULL; @@ -250,7 +250,7 @@ static void ggp_message_got_display(PurpleConnection *gc, purple_message_set_timestamp(pmsg, dt); g_date_time_unref(dt); - purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg); + purple_conversation_write_message(im, pmsg); g_object_unref(G_OBJECT(pmsg)); } else { @@ -646,7 +646,7 @@ int ggp_message_send_im(PurpleProtocolIM *pim, PurpleConnection *gc, PurpleMessage *msg) { GGPInfo *info = purple_connection_get_protocol_data(gc); - PurpleIMConversation *im; + PurpleConversation *im; ggp_buddy_data *buddy_data; gchar *gg_msg; gboolean succ; @@ -666,7 +666,7 @@ int ggp_message_send_im(PurpleProtocolIM *pim, PurpleConnection *gc, im = purple_conversations_find_im_with_account( rcpt, purple_connection_get_account(gc)); - gg_msg = ggp_message_format_to_gg(PURPLE_CONVERSATION(im), + gg_msg = ggp_message_format_to_gg(im, purple_message_get_contents(msg)); /* TODO: splitting messages */ diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c index 342c2086d2..456b41e097 100644 --- a/libpurple/protocols/irc/cmds.c +++ b/libpurple/protocols/irc/cmds.c @@ -520,14 +520,14 @@ int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, con int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args) { - PurpleIMConversation *im; + PurpleConversation *im; PurpleConnection *gc; if (!args || !args[0]) return 0; im = purple_im_conversation_new(irc->account, args[0]); - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); if (args[1]) { PurpleMessage *message = NULL; @@ -541,7 +541,7 @@ int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, con recipient = purple_connection_get_display_name(gc); message = purple_message_new_outgoing(me, recipient, args[1], 0); - purple_conversation_write_message(PURPLE_CONVERSATION(im), message); + purple_conversation_write_message(im, message); g_object_unref(G_OBJECT(message)); } @@ -601,7 +601,7 @@ int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, con { char *buf; const char *topic; - PurpleChatConversation *chat; + PurpleConversation *chat; if (!args) return 0; @@ -611,7 +611,7 @@ int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, con return 0; if (!args[0]) { - topic = purple_chat_conversation_get_topic (chat); + topic = purple_chat_conversation_get_topic (PURPLE_CHAT_CONVERSATION(chat)); if (topic) { char *tmp, *tmp2; @@ -623,7 +623,7 @@ int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, con } else buf = g_strdup(_("No topic is set")); purple_conversation_write_system_message( - PURPLE_CONVERSATION(chat), buf, PURPLE_MESSAGE_NO_LOG); + chat, buf, PURPLE_MESSAGE_NO_LOG); g_free(buf); return 0; diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index a69730e93c..e6e1da51b9 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -151,7 +151,7 @@ irc_uri_handler(const gchar *scheme, const gchar *uri, GHashTable *params) g_strfreev(target_tokens); if (isnick) { - PurpleIMConversation *im; + PurpleConversation *im; /* 'server' isn't needed here. Free it immediately. */ g_free(server); @@ -160,14 +160,13 @@ irc_uri_handler(const gchar *scheme, const gchar *uri, GHashTable *params) im = purple_im_conversation_new(account, target + 1); g_free(target); - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); if (params != NULL) { const gchar *msg = g_hash_table_lookup(params, "msg"); if (msg != NULL) { - purple_conversation_send_confirm( - PURPLE_CONVERSATION(im), msg); + purple_conversation_send_confirm(im, msg); } } diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index fb9f5ebc60..fdcde7df98 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -258,7 +258,7 @@ void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, c void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; chat = purple_conversations_find_chat_with_account(args[1], irc->account); @@ -278,7 +278,7 @@ void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char } if (chat) { purple_conversation_write_system_message( - PURPLE_CONVERSATION(chat), msg, PURPLE_MESSAGE_NO_LOG); + chat, msg, PURPLE_MESSAGE_NO_LOG); } else { purple_debug_info("irc", "%s\n", msg); } @@ -287,7 +287,7 @@ void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char if (!chat) return; /* End of ban list */ - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + purple_conversation_write_system_message(chat, _("End of ban list"), PURPLE_MESSAGE_NO_LOG); } } @@ -307,7 +307,7 @@ void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, ch void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; char *buf, *nick; chat = purple_conversations_find_chat_with_account(args[1], irc->account); @@ -317,14 +317,14 @@ void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, c nick = g_markup_escape_text(args[2], -1); buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); g_free(nick); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + purple_conversation_write_system_message(chat, buf, PURPLE_MESSAGE_NO_LOG); g_free(buf); } void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; char *buf, *escaped; chat = purple_conversations_find_chat_with_account(args[1], irc->account); @@ -333,7 +333,7 @@ void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL; buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : ""); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); + purple_conversation_write_system_message(chat, buf, 0); g_free(escaped); g_free(buf); } @@ -465,7 +465,7 @@ void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, void irc_msg_who(struct irc_conn *irc, const char *name, const char *from, char **args) { if (purple_strequal(name, "352")) { - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleChatUser *cb; char *cur, *userhost, *realname; @@ -478,7 +478,7 @@ void irc_msg_who(struct irc_conn *irc, const char *name, const char *from, char return; } - cb = purple_chat_conversation_find_user(chat, args[5]); + cb = purple_chat_conversation_find_user(PURPLE_CHAT_CONVERSATION(chat), args[5]); if (!cb) { purple_debug_error("irc", "Got a WHO response for %s who isn't a buddy.", args[5]); return; @@ -552,7 +552,7 @@ void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args) { char *chan, *topic, *msg, *nick, *tmp, *tmp2; - PurpleChatConversation *chat; + PurpleConversation *chat; if (purple_strequal(name, "topic")) { chan = args[0]; @@ -574,13 +574,13 @@ void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, cha tmp2 = purple_markup_linkify(tmp); g_free(tmp); if (purple_strequal(name, "topic")) { - const char *current_topic = purple_chat_conversation_get_topic(chat); + const char *current_topic = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(chat)); if (!(current_topic != NULL && purple_strequal(tmp2, current_topic))) { char *nick_esc; nick = irc_mask_nick(from); nick_esc = g_markup_escape_text(nick, -1); - purple_chat_conversation_set_topic(chat, nick, topic); + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), nick, topic); if (*tmp2) msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); else @@ -588,15 +588,15 @@ void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, cha g_free(nick_esc); g_free(nick); purple_conversation_write_system_message( - PURPLE_CONVERSATION(chat), msg, 0); + chat, msg, 0); g_free(msg); } } else { char *chan_esc = g_markup_escape_text(chan, -1); msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2); g_free(chan_esc); - purple_chat_conversation_set_topic(chat, NULL, topic); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), msg, 0); + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), NULL, topic); + purple_conversation_write_system_message(chat, msg, 0); g_free(msg); } g_free(tmp2); @@ -605,7 +605,7 @@ void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, cha void irc_msg_topicinfo(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; GDateTime *dt, *local; gint64 mtime; char *msg, *timestamp, *datestamp; @@ -634,7 +634,7 @@ void irc_msg_topicinfo(struct irc_conn *irc, const char *name, const char *from, timestamp = g_date_time_format(local, "%X"); datestamp = g_date_time_format(local, "%x"); msg = g_strdup_printf(_("Topic for %s set by %s at %s on %s"), args[1], args[2], timestamp, datestamp); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + purple_conversation_write_system_message(chat, msg, PURPLE_MESSAGE_NO_LINKIFY); g_free(timestamp); g_free(datestamp); @@ -821,11 +821,11 @@ void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, ch void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc; - PurpleChatConversation *chat; + PurpleConversation *chat; chat = purple_conversations_find_chat_with_account(args[1], irc->account); if (chat) { - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), args[2], + purple_conversation_write_system_message(chat, args[2], PURPLE_MESSAGE_NO_LOG); } else { if ((gc = purple_account_get_connection(irc->account)) == NULL) @@ -837,26 +837,26 @@ void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, ch void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat = purple_conversations_find_chat_with_account(args[1], irc->account); + PurpleConversation *chat = purple_conversations_find_chat_with_account(args[1], irc->account); purple_debug_info("irc", "We're apparently not in %s, but tried to use it", args[1]); if (chat) { /*g_slist_remove(irc->gc->buddy_chats, chat); purple_conversation_set_account(chat, NULL);*/ - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + purple_conversation_write_system_message(chat, args[2], PURPLE_MESSAGE_NO_LOG); } } void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; chat = purple_conversations_find_chat_with_account(args[1], irc->account); if (!chat) return; - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), args[2], 0); + purple_conversation_write_system_message(chat, args[2], 0); } void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) @@ -931,7 +931,7 @@ static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn * void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleChatUser *cb; char *nick, *userhost, *buf; @@ -976,9 +976,9 @@ void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char userhost = irc_mask_userhost(from); - purple_chat_conversation_add_user(chat, nick, userhost, PURPLE_CHAT_USER_NONE, TRUE); + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), nick, userhost, PURPLE_CHAT_USER_NONE, TRUE); - cb = purple_chat_conversation_find_user(chat, nick); + cb = purple_chat_conversation_find_user(PURPLE_CHAT_CONVERSATION(chat), nick); if (cb) { g_object_set_data_full(G_OBJECT(cb), "userhost", userhost, g_free); @@ -995,7 +995,7 @@ void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleChatConversation *chat = purple_conversations_find_chat_with_account(args[0], irc->account); + PurpleConversation *chat = purple_conversations_find_chat_with_account(args[0], irc->account); char *nick, *buf; g_return_if_fail(gc); @@ -1012,10 +1012,10 @@ void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]); purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); g_free(buf); - purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); + purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat))); } else { buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]); - purple_chat_conversation_remove_user(chat, args[1], buf); + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), args[1], buf); g_free(buf); } @@ -1024,7 +1024,7 @@ void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleChatConversation *chat; + PurpleConversation *chat; char *nick = irc_mask_nick(from), *buf; if (*args[0] == '#' || *args[0] == '&') { /* Channel */ @@ -1037,7 +1037,7 @@ void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char } escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL; buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); + purple_conversation_write_system_message(chat, buf, 0); g_free(escaped); g_free(buf); if(args[2]) { @@ -1057,7 +1057,7 @@ void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char if (!end) end = cur + strlen(cur); user = g_strndup(cur, end - cur); - cb = purple_chat_conversation_find_user(chat, user); + cb = purple_chat_conversation_find_user(PURPLE_CHAT_CONVERSATION(chat), user); flags = purple_chat_user_get_flags(cb); newflag = PURPLE_CHAT_USER_NONE; if (*mcur == 'o') @@ -1092,7 +1092,7 @@ void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleIMConversation *im; + PurpleConversation *im; GSList *chats; char *nick = irc_mask_nick(from); @@ -1119,7 +1119,7 @@ void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char im = purple_conversations_find_im_with_account(nick, irc->account); if (im != NULL) - purple_conversation_set_name(PURPLE_CONVERSATION(im), args[0]); + purple_conversation_set_name(im, args[0]); g_free(nick); } @@ -1201,7 +1201,7 @@ void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *fr void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleChatConversation *chat; + PurpleConversation *chat; char *nick, *msg, *channel; g_return_if_fail(gc); @@ -1223,12 +1223,12 @@ void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char (args[1] && *args[1]) ? ": " : "", (escaped && *escaped) ? escaped : ""); g_free(escaped); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), msg, 0); + purple_conversation_write_system_message(chat, msg, 0); g_free(msg); - purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); + purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat))); } else { msg = args[1] ? irc_mirc2txt(args[1]) : NULL; - purple_chat_conversation_remove_user(chat, nick, msg); + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), nick, msg); g_free(msg); } g_free(nick); @@ -1289,7 +1289,7 @@ void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, c static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, const char *rawmsg, gboolean notice) { PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleChatConversation *chat; + PurpleConversation *chat; char *tmp; char *msg; char *nick; @@ -1321,7 +1321,7 @@ static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const } else { chat = purple_conversations_find_chat_with_account(irc_nick_skip_mode(irc, to), irc->account); if (chat) { - purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat), + purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)), nick, PURPLE_MESSAGE_RECV, msg, time(NULL)); } else purple_debug_error("irc", "Got a %s on %s, which does not exist\n", diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 5b4c4f01f3..df313e4e6e 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3796,18 +3796,17 @@ xmpp_uri_handler(const char *proto, const char *user, GHashTable *params, /* params is NULL if the URI has no '?' (or anything after it) */ if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) { if (user && *user) { - PurpleIMConversation *im = - purple_im_conversation_new(acct, user); + PurpleConversation *im = purple_im_conversation_new(acct, user); const gchar *body = NULL; - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); if (params != NULL) { body = g_hash_table_lookup(params, "body"); } if (body && *body) - purple_conversation_send_confirm(PURPLE_CONVERSATION(im), body); + purple_conversation_send_confirm(im, body); return TRUE; } } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index f42588170c..ace92984fe 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -130,7 +130,7 @@ static void handle_chat(JabberMessage *jm) purple_serv_got_typing(gc, contact, 0, PURPLE_IM_TYPED); break; case JM_STATE_GONE: { - PurpleIMConversation *im = purple_conversations_find_im_with_account( + PurpleConversation *im = purple_conversations_find_im_with_account( contact, account); if (im && jid->node && jid->domain) { char buf[256]; @@ -152,8 +152,7 @@ static void handle_chat(JabberMessage *jm) /* At some point when we restructure PurpleConversation, * this should be able to be implemented by removing the * user from the conversation like we do with chats now. */ - purple_conversation_write_system_message( - PURPLE_CONVERSATION(im), buf, 0); + purple_conversation_write_system_message(im, buf, 0); } } purple_serv_got_typing_stopped(gc, contact); @@ -176,14 +175,14 @@ static void handle_chat(JabberMessage *jm) * This works because purple_im_conversation_send gets the name * from purple_conversation_get_name() */ - PurpleIMConversation *im; + PurpleConversation *im; im = purple_conversations_find_im_with_account(contact, account); if (im && !purple_strequal(contact, - purple_conversation_get_name(PURPLE_CONVERSATION(im)))) { + purple_conversation_get_name(im))) { purple_debug_info("jabber", "Binding conversation to %s\n", contact); - purple_conversation_set_name(PURPLE_CONVERSATION(im), contact); + purple_conversation_set_name(im, contact); } } diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index c5541c0833..a55ee1c0fb 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -575,9 +575,11 @@ handle_presence_chat(JabberStream *js, JabberPresence *presence, PurpleXmlNode * } if(!chat->conv) { + PurpleConversation *conv; char *room_jid = g_strdup_printf("%s@%s", presence->jid_from->node, presence->jid_from->domain); chat->id = i++; - chat->conv = purple_serv_got_joined_chat(js->gc, chat->id, room_jid); + conv = purple_serv_got_joined_chat(js->gc, chat->id, room_jid); + chat->conv = PURPLE_CHAT_CONVERSATION(conv); purple_chat_conversation_set_nick(chat->conv, chat->handle); jabber_chat_disco_traffic(chat); @@ -762,7 +764,7 @@ handle_presence_contact(JabberStream *js, JabberPresence *presence) PurpleAccount *account; PurpleBuddy *b; char *buddy_name; - PurpleIMConversation *im; + PurpleConversation *im; buddy_name = jabber_id_get_bare_jid(presence->jid_from); @@ -777,8 +779,8 @@ handle_presence_contact(JabberStream *js, JabberPresence *presence) im = purple_conversations_find_im_with_account(buddy_name, account); if (im) { purple_debug_info("jabber", "Changed conversation binding from %s to %s\n", - purple_conversation_get_name(PURPLE_CONVERSATION(im)), buddy_name); - purple_conversation_set_name(PURPLE_CONVERSATION(im), buddy_name); + purple_conversation_get_name(im), buddy_name); + purple_conversation_set_name(im, buddy_name); } if (b == NULL) { diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index d7392ab7af..e12da6ff5b 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -654,7 +654,7 @@ static void _join_conf_resp_cb(NMUser * user, NMERR_T ret_code, gpointer resp_data, gpointer user_data) { - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleConnection *gc; NMUserRecord *ur; NMConference *conference = user_data; @@ -678,7 +678,7 @@ _join_conf_resp_cb(NMUser * user, NMERR_T ret_code, ur = nm_conference_get_participant(conference, i); if (ur) { name = nm_user_record_get_display_id(ur); - purple_chat_conversation_add_user(chat, name, NULL, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), name, NULL, PURPLE_CHAT_USER_NONE, TRUE); } } @@ -1612,7 +1612,7 @@ _initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) NMUser *user; const char *conf_name; - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; NMUserRecord *user_record; NMConference *conference; @@ -1771,7 +1771,7 @@ _evt_receive_message(NMUser * user, NMEvent * event) { NMUserRecord *user_record = NULL; NMContact *contact = NULL; - PurpleIMConversation *im; + PurpleConversation *im; NMConference *conference; PurpleMessageFlags flags; char *text = NULL; @@ -1781,7 +1781,7 @@ _evt_receive_message(NMUser * user, NMEvent * event) conference = nm_event_get_conference(event); if (conference) { - PurpleChatConversation *chat = nm_conference_get_data(conference); + PurpleConversation *chat = nm_conference_get_data(conference); /* Is this a single person 'conversation' or a conference? */ if (chat == NULL && nm_conference_get_participant_count(conference) == 1) { @@ -1806,7 +1806,7 @@ _evt_receive_message(NMUser * user, NMEvent * event) contact = nm_find_contact(user, nm_event_get_source(event)); if (contact) { - purple_conversation_set_title(PURPLE_CONVERSATION(im), + purple_conversation_set_title(im, nm_contact_get_display_name(contact)); @@ -1818,7 +1818,7 @@ _evt_receive_message(NMUser * user, NMEvent * event) if (name == NULL) name = nm_user_record_get_userid(user_record); - purple_conversation_set_title(PURPLE_CONVERSATION(im), name); + purple_conversation_set_title(im, name); } } @@ -1849,7 +1849,7 @@ _evt_receive_message(NMUser * user, NMEvent * event) } purple_serv_got_chat_in(purple_account_get_connection(user->client_data), - purple_chat_conversation_get_id(chat), + purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)), name, PURPLE_MESSAGE_RECV, text, nm_event_get_gmt(event)); } } @@ -1948,7 +1948,7 @@ _evt_conference_invite(NMUser * user, NMEvent * event) static void _evt_conference_joined(NMUser * user, NMEvent * event) { - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; PurpleConnection *gc; NMConference *conference = NULL; NMUserRecord *ur = NULL; @@ -1973,7 +1973,7 @@ _evt_conference_joined(NMUser * user, NMEvent * event) nm_conference_set_data(conference, (gpointer) chat); name = nm_user_record_get_display_id(ur); - purple_chat_conversation_add_user(chat, name, NULL, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), name, NULL, PURPLE_CHAT_USER_NONE, TRUE); } @@ -1984,8 +1984,8 @@ _evt_conference_joined(NMUser * user, NMEvent * event) ur = nm_find_user_record(user, nm_event_get_source(event)); if (ur) { name = nm_user_record_get_display_id(ur); - if (!purple_chat_conversation_has_user(chat, name)) { - purple_chat_conversation_add_user(chat, name, NULL, + if (!purple_chat_conversation_has_user(PURPLE_CHAT_CONVERSATION(chat), name)) { + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), name, NULL, PURPLE_CHAT_USER_NONE, TRUE); } } @@ -2470,7 +2470,7 @@ novell_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id, PurpleMessage *msg) { NMConference *conference; - PurpleChatConversation *chat; + PurpleConversation *chat; GSList *cnode; NMMessage *message; NMUser *user; @@ -2492,7 +2492,7 @@ novell_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { conference = cnode->data; if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_chat_conversation_get_id(chat) == id) { + if (purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)) == id) { nm_message_set_conference(message, conference); @@ -2538,7 +2538,7 @@ novell_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, if (chat) { str = g_strdup(_("This conference has been closed." " No more messages can be sent.")); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), str, 0); + purple_conversation_write_system_message(chat, str, 0); g_free(str); } diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 01f944314e..3db125a416 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -116,12 +116,12 @@ static void foreach_null_gc(GcFunc fn, PurpleConnection *from, } -typedef void(*ChatFunc)(PurpleChatConversation *from, PurpleChatConversation *to, +typedef void(*ChatFunc)(PurpleConversation *from, PurpleConversation *to, int id, const char *room, gpointer userdata); typedef struct { ChatFunc fn; - PurpleChatConversation *from_chat; + PurpleConversation *from_chat; gpointer userdata; } ChatFuncData; @@ -129,16 +129,16 @@ static void call_chat_func(gpointer data, gpointer userdata) { PurpleConnection *to = (PurpleConnection *)data; ChatFuncData *cfdata = (ChatFuncData *)userdata; - int id = purple_chat_conversation_get_id(cfdata->from_chat); - PurpleChatConversation *chat = purple_conversations_find_chat(to, id); + int id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(cfdata->from_chat)); + PurpleConversation *chat = purple_conversations_find_chat(to, id); if (chat) cfdata->fn(cfdata->from_chat, chat, id, - purple_conversation_get_name(PURPLE_CONVERSATION(chat)), cfdata->userdata); + purple_conversation_get_name(chat), cfdata->userdata); } static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, int id, gpointer userdata) { - PurpleChatConversation *chat = purple_conversations_find_chat(from, id); + PurpleConversation *chat = purple_conversations_find_chat(from, id); ChatFuncData cfdata = { fn, chat, userdata }; @@ -718,13 +718,13 @@ static void null_set_permit_deny(PurpleProtocolPrivacy *privacy, PurpleConnectio */ } -static void joined_chat(PurpleChatConversation *from, PurpleChatConversation *to, +static void joined_chat(PurpleConversation *from, PurpleConversation *to, int id, const char *room, gpointer userdata) { /* tell their chat window that we joined */ purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", - purple_chat_conversation_get_nick(to), purple_chat_conversation_get_nick(from), room); - purple_chat_conversation_add_user(to, - purple_chat_conversation_get_nick(from), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room); + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(to), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), NULL, /* user-provided join message, IRC style */ PURPLE_CHAT_USER_NONE, TRUE); /* show a join message */ @@ -732,9 +732,9 @@ static void joined_chat(PurpleChatConversation *from, PurpleChatConversation *to if (from != to) { /* add them to our chat window */ purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", - purple_chat_conversation_get_nick(from), purple_chat_conversation_get_nick(to), room); - purple_chat_conversation_add_user(from, - purple_chat_conversation_get_nick(to), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), room); + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(from), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), NULL, /* user-provided join message, IRC style */ PURPLE_CHAT_USER_NONE, FALSE); /* show a join message */ @@ -805,15 +805,15 @@ null_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id, const gchar *message, const gchar *who) { const char *username = purple_account_get_username(purple_connection_get_account(gc)); - PurpleChatConversation *chat = purple_conversations_find_chat(gc, id); - const char *room = purple_conversation_get_name(PURPLE_CONVERSATION(chat)); + PurpleConversation *chat = purple_conversations_find_chat(gc, id); + const char *room = purple_conversation_get_name(chat); PurpleAccount *to_acct = purple_accounts_find(who, "null"); purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", username, who, room); if (to_acct) { - PurpleChatConversation *to_conv = purple_conversations_find_chat(purple_account_get_connection(to_acct), id); + PurpleConversation *to_conv = purple_conversations_find_chat(purple_account_get_connection(to_acct), id); if (to_conv) { char *tmp = g_strdup_printf("%s is already in chat room %s.", who, room); purple_debug_info("nullprpl", @@ -821,7 +821,7 @@ null_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, "ignoring invitation from %s\n", who, room, username); purple_notify_info(gc, _("Chat invitation"), _("Chat invitation"), tmp, - purple_request_cpar_from_conversation(PURPLE_CONVERSATION(to_conv))); + purple_request_cpar_from_conversation(to_conv)); g_free(tmp); } else { GHashTable *components; @@ -833,14 +833,14 @@ null_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, } } -static void left_chat_room(PurpleChatConversation *from, PurpleChatConversation *to, +static void left_chat_room(PurpleConversation *from, PurpleConversation *to, int id, const char *room, gpointer userdata) { if (from != to) { /* tell their chat window that we left */ purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", - purple_chat_conversation_get_nick(to), purple_chat_conversation_get_nick(from), room); - purple_chat_conversation_remove_user(to, - purple_chat_conversation_get_nick(from), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room); + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(to), + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), NULL); /* user-provided message, IRC style */ } } @@ -849,24 +849,24 @@ static void null_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id) { - PurpleChatConversation *chat = purple_conversations_find_chat(gc, id); + PurpleConversation *chat = purple_conversations_find_chat(gc, id); purple_debug_info("nullprpl", "%s is leaving chat room %s\n", purple_account_get_username(purple_connection_get_account(gc)), - purple_conversation_get_name(PURPLE_CONVERSATION(chat))); + purple_conversation_get_name(chat)); /* tell everyone that we left */ foreach_gc_in_chat(left_chat_room, gc, id, NULL); } -static void receive_chat_message(PurpleChatConversation *from, PurpleChatConversation *to, +static void receive_chat_message(PurpleConversation *from, PurpleConversation *to, int id, const char *room, gpointer userdata) { const char *message = (const char *)userdata; - PurpleConnection *to_gc = get_null_gc(purple_chat_conversation_get_nick(to)); + PurpleConnection *to_gc = get_null_gc(purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to))); purple_debug_info("nullprpl", "%s receives message from %s in chat room %s: %s\n", - purple_chat_conversation_get_nick(to), purple_chat_conversation_get_nick(from), room, message); - purple_serv_got_chat_in(to_gc, id, purple_chat_conversation_get_nick(from), PURPLE_MESSAGE_RECV, message, + purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room, message); + purple_serv_got_chat_in(to_gc, id, purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), PURPLE_MESSAGE_RECV, message, time(NULL)); } @@ -875,13 +875,13 @@ null_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id, PurpleMessage *msg) { const char *username = purple_account_get_username(purple_connection_get_account(gc)); - PurpleChatConversation *chat = purple_conversations_find_chat(gc, id); + PurpleConversation *chat = purple_conversations_find_chat(gc, id); const gchar *message = purple_message_get_contents(msg); if (chat) { purple_debug_info("nullprpl", "%s is sending message to chat room %s: %s\n", username, - purple_conversation_get_name(PURPLE_CONVERSATION(chat)), message); + purple_conversation_get_name(chat), message); /* send message to everyone in the chat room */ foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); @@ -966,21 +966,20 @@ null_remove_group(PurpleProtocolServer *protocol_server, PurpleConnection *gc, } -static void set_chat_topic_fn(PurpleChatConversation *from, PurpleChatConversation *to, +static void set_chat_topic_fn(PurpleConversation *from, PurpleConversation *to, int id, const char *room, gpointer userdata) { const char *topic = (const char *)userdata; const char *username = purple_account_get_username(purple_conversation_get_account(PURPLE_CONVERSATION(from))); char *msg; - purple_chat_conversation_set_topic(to, username, topic); + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(to), username, topic); if (topic && *topic) msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); else msg = g_strdup_printf(_("%s clears topic"), username); - purple_conversation_write_system_message(PURPLE_CONVERSATION(to), - msg, PURPLE_MESSAGE_NO_LOG); + purple_conversation_write_system_message(to, msg, PURPLE_MESSAGE_NO_LOG); g_free(msg); } @@ -988,7 +987,7 @@ static void null_set_chat_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gint id, const gchar *topic) { - PurpleChatConversation *chat = purple_conversations_find_chat(gc, id); + PurpleConversation *chat = purple_conversations_find_chat(gc, id); const char *last_topic; if (!chat) @@ -996,9 +995,9 @@ null_set_chat_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", purple_account_get_username(purple_connection_get_account(gc)), - purple_conversation_get_name(PURPLE_CONVERSATION(chat)), topic); + purple_conversation_get_name(chat), topic); - last_topic = purple_chat_conversation_get_topic(chat); + last_topic = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(chat)); if (purple_strequal(topic, last_topic)) return; /* topic is unchanged, this is a noop */ diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index f8e10cfa8b..69f39ac589 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -292,7 +292,7 @@ static void convo_data_free(struct convo_data *conv); static void convo_features(struct mwConversation *conv); -static PurpleIMConversation *convo_get_im(struct mwConversation *conv); +static PurpleConversation *convo_get_im(struct mwConversation *conv); /* name and id */ @@ -1771,7 +1771,7 @@ static void mw_session_announce(struct mwSession *s, const char *text) { struct mwPurpleProtocolData *pd; PurpleAccount *acct; - PurpleIMConversation *im; + PurpleConversation *im; PurpleBuddy *buddy; char *who = from->user_id; char *msg, *msg2; @@ -1791,7 +1791,7 @@ static void mw_session_announce(struct mwSession *s, else msg2 = g_strdup(who); - purple_conversation_write_system_message(PURPLE_CONVERSATION(im), msg2, 0); + purple_conversation_write_system_message(im, msg2, 0); g_free(who); g_free(msg); g_free(msg2); @@ -1919,7 +1919,7 @@ static void mw_conf_opened(struct mwConference *conf, GList *members) { struct mwSession *session; struct mwPurpleProtocolData *pd; PurpleConnection *gc; - PurpleChatConversation *g_conf; + PurpleConversation *g_conf; const char *n = mwConference_getName(conf); const char *t = mwConference_getTitle(conf); @@ -1938,7 +1938,7 @@ static void mw_conf_opened(struct mwConference *conf, GList *members) { for(; members; members = members->next) { struct mwLoginInfo *peer = members->data; - purple_chat_conversation_add_user(g_conf, peer->user_id, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(g_conf), peer->user_id, NULL, PURPLE_CHAT_USER_NONE, FALSE); } } @@ -2452,7 +2452,7 @@ static void convo_data_new(struct mwConversation *conv) { } -static PurpleIMConversation *convo_get_im(struct mwConversation *conv) { +static PurpleConversation *convo_get_im(struct mwConversation *conv) { struct mwServiceIm *srvc; struct mwSession *session; struct mwPurpleProtocolData *pd; @@ -2503,7 +2503,7 @@ static void convo_queue(struct mwConversation *conv, /* Does what it takes to get an error displayed for a conversation */ static void convo_error(struct mwConversation *conv, guint32 err) { - PurpleIMConversation *im; + PurpleConversation *im; PurpleConnection *pc; char *tmp, *text; struct mwIdBlock *idb; @@ -2515,13 +2515,12 @@ static void convo_error(struct mwConversation *conv, guint32 err) { im = convo_get_im(conv); if(im && !purple_conversation_present_error(idb->user, - purple_conversation_get_account(PURPLE_CONVERSATION(im)), text)) { + purple_conversation_get_account(im), text)) { g_free(text); text = g_strdup_printf(_("Unable to send message to %s:"), (idb->user)? idb->user: "(unknown)"); - pc = purple_account_get_connection(purple_conversation_get_account( - PURPLE_CONVERSATION(im))); + pc = purple_account_get_connection(purple_conversation_get_account(im)); purple_notify_error(pc, NULL, text, tmp, purple_request_cpar_from_connection(pc)); } @@ -2553,17 +2552,16 @@ static void convo_queue_send(struct mwConversation *conv) { inform the purple conversation that it's unsafe to offer any *cool* features. */ static void convo_nofeatures(struct mwConversation *conv) { - PurpleIMConversation *im; + PurpleConversation *im; PurpleConnection *gc; im = convo_get_im(conv); if(! im) return; - gc = purple_conversation_get_connection(PURPLE_CONVERSATION(im)); + gc = purple_conversation_get_connection(im); if(! gc) return; - purple_conversation_set_features(PURPLE_CONVERSATION(im), - purple_connection_get_flags(gc)); + purple_conversation_set_features(im, purple_connection_get_flags(gc)); } @@ -2571,13 +2569,13 @@ static void convo_nofeatures(struct mwConversation *conv) { to inform the purple conversation of what features to offer the user */ static void convo_features(struct mwConversation *conv) { - PurpleIMConversation *im; + PurpleConversation *im; PurpleConnectionFlags feat; im = convo_get_im(conv); if(! im) return; - feat = purple_conversation_get_features(PURPLE_CONVERSATION(im)); + feat = purple_conversation_get_features(im); if(mwConversation_isOpen(conv)) { if(mwConversation_supports(conv, mwImSend_HTML)) { @@ -2593,7 +2591,7 @@ static void convo_features(struct mwConversation *conv) { } DEBUG_INFO("conversation features set to 0x%04x\n", feat); - purple_conversation_set_features(PURPLE_CONVERSATION(im), feat); + purple_conversation_set_features(im, feat); } else { convo_nofeatures(conv); @@ -2872,7 +2870,7 @@ static void mw_place_opened(struct mwPlace *place) { struct mwSession *session; struct mwPurpleProtocolData *pd; PurpleConnection *gc; - PurpleChatConversation *gconf; + PurpleConversation *gconf; GList *members, *l; @@ -2896,7 +2894,7 @@ static void mw_place_opened(struct mwPlace *place) { for(l = members; l; l = l->next) { struct mwIdBlock *idb = l->data; - purple_chat_conversation_add_user(gconf, idb->user, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(gconf), idb->user, NULL, PURPLE_CHAT_USER_NONE, FALSE); } g_list_free(members); @@ -4039,14 +4037,14 @@ mw_protocol_set_idle(PurpleProtocolServer *protocol_server, static void notify_im(PurpleConnection *gc, GList *row, void *user_data) { PurpleAccount *acct; - PurpleIMConversation *im; + PurpleConversation *im; char *id; acct = purple_connection_get_account(gc); id = g_list_nth_data(row, 1); im = purple_conversations_find_im_with_account(id, acct); if(! im) im = purple_im_conversation_new(acct, id); - purple_conversation_present(PURPLE_CONVERSATION(im)); + purple_conversation_present(im); } diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 9c2e5e6cdf..1788350b59 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -76,7 +76,7 @@ silcpurple_buddy_keyagr_cb(SilcClient client, switch (status) { case SILC_KEY_AGREEMENT_OK: { - PurpleIMConversation *im; + PurpleConversation *im; char tmp[128]; /* Set the private key for this client */ @@ -99,7 +99,7 @@ silcpurple_buddy_keyagr_cb(SilcClient client, client_entry->nickname); } g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(PURPLE_CONVERSATION(im), tmp); + purple_conversation_set_title(im, tmp); } break; diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index d64bd4b520..c8a6993eea 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -94,7 +94,7 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, const unsigned char *data; SilcUInt32 data_len; PurpleMessageFlags cflags = 0; - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; SilcBool ret = FALSE; if (!mime) @@ -218,7 +218,7 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, if (channel) { purple_serv_got_chat_in(gc, - purple_chat_conversation_get_id(chat), + purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)), sender->nickname, cflags, tmp, time(NULL)); } else { purple_serv_got_im(gc, sender->nickname, @@ -263,7 +263,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, { PurpleConnection *gc = client->application; SilcPurple sg = purple_connection_get_protocol_data(gc); - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; char *msg, *tmp; if (!message) @@ -309,7 +309,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, tmp = g_markup_escape_text(msg, -1); /* Send to Purple */ - purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat), + purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)), sender->nickname, PURPLE_MESSAGE_RECV, tmp, time(NULL)); g_free(tmp); g_free(msg); @@ -338,7 +338,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, } tmp = g_markup_escape_text(msg, -1); /* Send to Purple */ - purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat), + purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)), sender->nickname, PURPLE_MESSAGE_RECV, tmp, time(NULL)); g_free(salvaged); g_free(tmp); @@ -443,7 +443,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, PurpleConnection *gc = client->application; SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); - PurpleChatConversation *chat; + PurpleConversation *chat; SilcClientEntry client_entry, client_entry2; SilcChannelEntry channel; SilcServerEntry server_entry; @@ -494,7 +494,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, /* Join user to channel */ g_snprintf(buf, sizeof(buf), "%s@%s", client_entry->username, client_entry->hostname); - purple_chat_conversation_add_user(chat, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, buf, PURPLE_CHAT_USER_NONE, TRUE); break; @@ -509,7 +509,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, break; /* Remove user from channel */ - purple_chat_conversation_remove_user(chat, + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, NULL); break; @@ -525,7 +525,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - purple_chat_conversation_remove_user(chat, + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, tmp); } @@ -560,7 +560,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, client_entry->nickname, channel->channel_name, tmp2); purple_conversation_write_system_message( PURPLE_CONVERSATION(chat), buf, 0); - purple_chat_conversation_set_topic(chat, + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, tmp); } else if (idtype == SILC_ID_SERVER) { server_entry = (SilcServerEntry)entry; @@ -569,7 +569,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, server_entry->server_name, channel->channel_name, tmp2); purple_conversation_write_system_message( PURPLE_CONVERSATION(chat), buf, 0); - purple_chat_conversation_set_topic(chat, + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), server_entry->server_name, tmp); } else if (idtype == SILC_ID_CHANNEL) { channel = (SilcChannelEntry)entry; @@ -578,10 +578,10 @@ silc_notify(SilcClient client, SilcClientConnection conn, channel->channel_name, channel->channel_name, tmp2); purple_conversation_write_system_message( PURPLE_CONVERSATION(chat), buf, 0); - purple_chat_conversation_set_topic(chat, + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), channel->channel_name, tmp); } else { - purple_chat_conversation_set_topic(chat, NULL, tmp); + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), NULL, tmp); } g_free(tmp2); @@ -604,8 +604,8 @@ silc_notify(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - if (purple_chat_conversation_has_user(chat, client_entry->nickname)) - purple_chat_conversation_rename_user(chat, + if (purple_chat_conversation_has_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname)) + purple_chat_conversation_rename_user(PURPLE_CHAT_CONVERSATION(chat), tmp, name); } silc_hash_table_list_reset(&htl); @@ -687,9 +687,9 @@ silc_notify(SilcClient client, SilcClientConnection conn, _("<I>%s</I> removed all <I>%s's</I> modes"), name, client_entry2->nickname); } - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); + purple_conversation_write_system_message(chat, buf, 0); purple_chat_user_set_flags(purple_chat_conversation_find_user( - chat, client_entry2->nickname), flags); + PURPLE_CHAT_CONVERSATION(chat), client_entry2->nickname), flags); break; } @@ -716,14 +716,13 @@ silc_notify(SilcClient client, SilcClientConnection conn, _("You have been kicked off <I>%s</I> by <I>%s</I> (%s)"), channel->channel_name, client_entry2->nickname, tmp ? tmp : ""); - purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), - buf, 0); - purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); + purple_conversation_write_system_message(chat, buf, 0); + purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat))); } else { /* Remove user from channel */ g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), client_entry2->nickname, tmp ? tmp : ""); - purple_chat_conversation_remove_user(chat, + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, buf); } @@ -761,9 +760,8 @@ silc_notify(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - purple_conversation_write_system_message( - PURPLE_CONVERSATION(chat), buf, 0); - purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); + purple_conversation_write_system_message(chat, buf, 0); + purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat))); } silc_hash_table_list_reset(&htl); @@ -792,7 +790,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - purple_chat_conversation_remove_user(chat, + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, tmp); } silc_hash_table_list_reset(&htl); @@ -816,7 +814,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - purple_chat_conversation_remove_user(chat, + purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(chat), client_entry->nickname, _("Server signoff")); } @@ -987,13 +985,12 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, { PurpleConnection *gc = client->application; SilcPurple sg = purple_connection_get_protocol_data(gc); - PurpleChatConversation *chat; + PurpleConversation *chat; switch (command) { case SILC_COMMAND_JOIN: { SilcChannelEntry channel; - PurpleChatConversation *chat; SilcHashTableList *user_list; SilcChannelUser chu; GList *users = NULL, *flags = NULL; @@ -1042,21 +1039,24 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, _("Channel founder on <I>%s</I> is <I>%s</I>"), channel->channel_name, chu->client->nickname); - purple_conversation_write_system_message( - PURPLE_CONVERSATION(chat), tmp, 0); + purple_conversation_write_system_message(chat, tmp, 0); } } - purple_chat_conversation_add_users(chat, users, NULL, flags, FALSE); + purple_chat_conversation_add_users(PURPLE_CHAT_CONVERSATION(chat), + users, NULL, flags, FALSE); g_list_free(users); g_list_free(flags); /* Set topic */ - if (topic) - purple_chat_conversation_set_topic(chat, NULL, topic); + if(topic) { + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), + NULL, topic); + } /* Set nick */ - purple_chat_conversation_set_nick(chat, conn->local_entry->nickname); + purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION(chat), + conn->local_entry->nickname); } break; @@ -1315,8 +1315,10 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, } /* Set topic */ - if (channel->topic) - purple_chat_conversation_set_topic(chat, NULL, channel->topic); + if (channel->topic) { + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(chat), + NULL, channel->topic); + } } break; @@ -1344,14 +1346,14 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, chu->channel->channel_name, sg->account); if (!chat) continue; - oldnick = purple_chat_conversation_get_nick(chat); + oldnick = purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(chat)); if (!purple_strequal(oldnick, - purple_normalize(purple_conversation_get_account - (PURPLE_CONVERSATION(chat)), newnick))) { + purple_normalize(purple_conversation_get_account(chat), + newnick))) { - purple_chat_conversation_rename_user(chat, + purple_chat_conversation_rename_user(PURPLE_CHAT_CONVERSATION(chat), oldnick, newnick); - purple_chat_conversation_set_nick(chat, newnick); + purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION(chat), newnick); } } silc_hash_table_list_reset(&htl); diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 6b34acb8bd..bf939e2032 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -1397,7 +1397,7 @@ silcpurple_send_im_resolved(SilcClient client, PurpleConnection *gc = client->application; SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleIM im = context; - PurpleIMConversation *convo; + PurpleConversation *convo; char tmp[256]; SilcClientEntry client_entry; SilcDList list; @@ -1445,7 +1445,7 @@ silcpurple_send_im_resolved(SilcClient client, silc_buffer_len(buf)); silc_mime_partial_free(list); msg = purple_message_new_outgoing(me, conn->local_entry->nickname, im->message, 0); - purple_conversation_write_message(PURPLE_CONVERSATION(convo), msg); + purple_conversation_write_message(convo, msg); g_object_unref(G_OBJECT(msg)); goto out; } @@ -1455,7 +1455,7 @@ silcpurple_send_im_resolved(SilcClient client, silc_client_send_private_message(client, conn, client_entry, im->flags, sg->sha1hash, (unsigned char *)im->message, im->message_len); msg = purple_message_new_outgoing(me, conn->local_entry->nickname, im->message, 0); - purple_conversation_write_message(PURPLE_CONVERSATION(convo), msg); + purple_conversation_write_message(convo, msg); g_object_unref(G_OBJECT(msg)); goto out; @@ -1463,7 +1463,7 @@ silcpurple_send_im_resolved(SilcClient client, g_snprintf(tmp, sizeof(tmp), _("User <I>%s</I> is not present in the network"), im->nick); purple_conversation_write_system_message( - PURPLE_CONVERSATION(convo), tmp, 0); + convo, tmp, 0); out: if (free_list) { @@ -1593,7 +1593,7 @@ static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { PurpleConnection *gc; - PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(conv); + PurpleConversation *chat = conv; int id = 0; gc = purple_conversation_get_connection(conv); @@ -1606,7 +1606,7 @@ static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, purple_connection_get_account(gc)); if (chat != NULL) - id = purple_chat_conversation_get_id(chat); + id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)); if (id == 0) return PURPLE_CMD_RET_FAILED; @@ -1731,7 +1731,7 @@ static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { int ret = 1; - PurpleIMConversation *im; + PurpleConversation *im; PurpleConnection *gc; PurpleAccount *account; @@ -1755,7 +1755,7 @@ static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, me, args[0], args[1], 0); ret = silcpurple_send_im(NULL, gc, msg); - purple_conversation_write_message(PURPLE_CONVERSATION(im), msg); + purple_conversation_write_message(im, msg); g_object_unref(G_OBJECT(msg)); } diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 2d2a84052e..e2808ecaa9 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -311,7 +311,7 @@ handle_message(PurpleConnection *gc, ZNotice_t *notice) zephyr_triple *zt; gchar *send_inst_utf8; GSList *l = g_slist_find_custom(zephyr->subscrips, &sub, (GCompareFunc)zephyr_triple_subset); - PurpleChatConversation *gcc; + PurpleConversation *gcc; if (!l) { /* This is a server supplied subscription */ @@ -338,7 +338,7 @@ handle_message(PurpleConnection *gc, ZNotice_t *notice) } gcc = purple_conversations_find_chat_with_account(zt->name, purple_connection_get_account(gc)); - if (!purple_chat_conversation_has_user(gcc, stripped_sender)) { + if (!purple_chat_conversation_has_user(PURPLE_CHAT_CONVERSATION(gcc), stripped_sender)) { GInetAddress *inet_addr = NULL; gchar *ipaddr = NULL; @@ -346,7 +346,8 @@ handle_message(PurpleConnection *gc, ZNotice_t *notice) (const guint8 *)¬ice->z_sender_addr, G_SOCKET_FAMILY_IPV4); ipaddr = g_inet_address_to_string(inet_addr); - purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, + purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(gcc), + stripped_sender, ipaddr, PURPLE_CHAT_USER_NONE, TRUE); g_free(ipaddr); g_object_unref(inet_addr); @@ -919,7 +920,7 @@ zephyr_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, GSList *l; zephyr_triple *zt; const char *sig; - PurpleChatConversation *gcc; + PurpleConversation *gcc; char *inst; char *recipient; zephyr_account *zephyr = purple_connection_get_protocol_data(gc); @@ -935,7 +936,7 @@ zephyr_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, gcc = purple_conversations_find_chat_with_account(zt->name, purple_connection_get_account(gc)); - if (!(inst = (char *)purple_chat_conversation_get_topic(gcc))) + if (!(inst = (char *)purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(gcc)))) inst = g_strdup("PERSONAL"); if (!g_ascii_strcasecmp(zt->sub.zsub_recipient, "*")) { @@ -1349,7 +1350,7 @@ zephyr_send_typing(G_GNUC_UNUSED PurpleProtocolIM *im, PurpleConnection *gc, con static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic) { zephyr_triple *zt; - PurpleChatConversation *gcc; + PurpleConversation *gcc; gchar *topic_utf8; zephyr_account *zephyr = purple_connection_get_protocol_data(gc); GSList *l; @@ -1363,7 +1364,7 @@ static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *top gcc = purple_conversations_find_chat_with_account(zt->name, purple_connection_get_account(gc)); topic_utf8 = convert_to_utf8(topic, zephyr->encoding); - purple_chat_conversation_set_topic(gcc, zephyr->username, topic_utf8); + purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(gcc), zephyr->username, topic_utf8); g_free(topic_utf8); } diff --git a/libpurple/purplechatconversation.c b/libpurple/purplechatconversation.c index fd35d60680..ace51e208c 100644 --- a/libpurple/purplechatconversation.c +++ b/libpurple/purplechatconversation.c @@ -338,9 +338,9 @@ purple_chat_conversation_class_init(PurpleChatConversationClass *klass) { /****************************************************************************** * Public API *****************************************************************************/ -PurpleChatConversation * +PurpleConversation * purple_chat_conversation_new(PurpleAccount *account, const gchar *name) { - PurpleChatConversation *chat = NULL; + PurpleConversation *chat = NULL; PurpleConnection *connection = NULL; g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); @@ -349,7 +349,7 @@ purple_chat_conversation_new(PurpleAccount *account, const gchar *name) { /* Check if this conversation already exists. */ chat = purple_conversations_find_chat_with_account(name, account); if(PURPLE_IS_CHAT_CONVERSATION(chat)) { - if(!purple_chat_conversation_has_left(chat)) { + if(!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(chat))) { purple_debug_warning("chat-conversation", "A chat named %s " "already exists.", name); return NULL; @@ -364,7 +364,7 @@ purple_chat_conversation_new(PurpleAccount *account, const gchar *name) { return NULL; } - return PURPLE_CHAT_CONVERSATION(g_object_new( + return PURPLE_CONVERSATION(g_object_new( PURPLE_TYPE_CHAT_CONVERSATION, "account", account, "name", name, diff --git a/libpurple/purplechatconversation.h b/libpurple/purplechatconversation.h index abe25e20c8..1b778eef16 100644 --- a/libpurple/purplechatconversation.h +++ b/libpurple/purplechatconversation.h @@ -88,7 +88,7 @@ GType purple_chat_conversation_get_type(void); * * Returns: The new conversation. */ -PurpleChatConversation *purple_chat_conversation_new(PurpleAccount *account, const gchar *name); +PurpleConversation *purple_chat_conversation_new(PurpleAccount *account, const gchar *name); /** * purple_chat_conversation_get_users: diff --git a/libpurple/purpleimconversation.c b/libpurple/purpleimconversation.c index 42443dbdee..608843c10c 100644 --- a/libpurple/purpleimconversation.c +++ b/libpurple/purpleimconversation.c @@ -248,10 +248,10 @@ purple_im_conversation_class_init(PurpleIMConversationClass *klass) { /****************************************************************************** * Public API *****************************************************************************/ -PurpleIMConversation * +PurpleConversation * purple_im_conversation_new(PurpleAccount *account, const char *name) { - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); g_return_val_if_fail(name != NULL, NULL); diff --git a/libpurple/purpleimconversation.h b/libpurple/purpleimconversation.h index 0b27731df0..2802867896 100644 --- a/libpurple/purpleimconversation.h +++ b/libpurple/purpleimconversation.h @@ -101,7 +101,7 @@ GType purple_im_conversation_get_type(void); * * Returns: The new conversation. */ -PurpleIMConversation *purple_im_conversation_new(PurpleAccount *account, const gchar *name); +PurpleConversation *purple_im_conversation_new(PurpleAccount *account, const gchar *name); /** * purple_im_conversation_set_icon: diff --git a/libpurple/server.c b/libpurple/server.c index a7fd740e8c..f5fa9bf2dc 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -123,7 +123,7 @@ get_last_auto_response(PurpleConnection *gc, const char *name) int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg) { - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; PurpleAccount *account = NULL; PurplePresence *presence = NULL; PurpleProtocol *protocol = NULL; @@ -169,8 +169,8 @@ int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg) lar->sent = time(NULL); } - if(im && purple_im_conversation_get_send_typed_timeout(im)) - purple_im_conversation_stop_send_typed_timeout(im); + if(im && purple_im_conversation_get_send_typed_timeout(PURPLE_IM_CONVERSATION(im))) + purple_im_conversation_stop_send_typed_timeout(PURPLE_IM_CONVERSATION(im)); return val; } @@ -241,7 +241,7 @@ purple_serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) PurpleAccount *account; GSList *buddies; PurpleBuddy *b; - PurpleIMConversation *im; + PurpleConversation *im; account = purple_connection_get_account(gc); buddies = purple_blist_find_buddies(account, who); @@ -269,7 +269,7 @@ purple_serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) escaped, escaped2); purple_conversation_write_system_message( - PURPLE_CONVERSATION(im), tmp, + im, tmp, PURPLE_MESSAGE_NO_LINKIFY); g_free(tmp); @@ -440,7 +440,7 @@ void purple_serv_reject_chat(PurpleConnection *gc, GHashTable *data) void purple_serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) { PurpleProtocol *protocol = NULL; - PurpleChatConversation *chat; + PurpleConversation *chat; char *buffy; chat = purple_conversations_find_chat(gc, id); @@ -502,7 +502,7 @@ void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg, PurpleMessageFlags flags, time_t mtime) { PurpleAccount *account; - PurpleIMConversation *im; + PurpleConversation *im; char *message, *name; char *angel, *buffy; int plugin_return; @@ -569,7 +569,7 @@ void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg, im = purple_im_conversation_new(account, name); pmsg = purple_message_new_incoming(name, message, flags, mtime); - purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg); + purple_conversation_write_message(im, pmsg); g_free(message); g_object_unref(G_OBJECT(pmsg)); @@ -657,11 +657,17 @@ void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg, void purple_serv_got_typing(PurpleConnection *gc, const char *name, int timeout, PurpleIMTypingState state) { - PurpleIMConversation *im; + PurpleConversation *conv; + + conv = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); + if(PURPLE_IS_IM_CONVERSATION(conv)) { + PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv); - im = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); - if (im != NULL) { purple_im_conversation_set_typing_state(im, state); + + if(timeout > 0) { + purple_im_conversation_start_typing_timeout(im, timeout); + } } else { switch (state) { @@ -679,18 +685,16 @@ void purple_serv_got_typing(PurpleConnection *gc, const char *name, int timeout, break; } } - - if (im != NULL && timeout > 0) - purple_im_conversation_start_typing_timeout(im, timeout); } void purple_serv_got_typing_stopped(PurpleConnection *gc, const char *name) { - PurpleIMConversation *im; + PurpleConversation *conv; - im = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); - if (im != NULL) + conv = purple_conversations_find_im_with_account(name, purple_connection_get_account(gc)); + if (conv != NULL) { + PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv); if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_NOT_TYPING) return; @@ -788,10 +792,10 @@ void purple_serv_got_chat_invite(PurpleConnection *gc, const char *name, chat_invite_reject(cid); } -PurpleChatConversation *purple_serv_got_joined_chat(PurpleConnection *gc, +PurpleConversation *purple_serv_got_joined_chat(PurpleConnection *gc, int id, const char *name) { - PurpleChatConversation *chat; + PurpleConversation *chat; PurpleAccount *account; account = purple_connection_get_account(gc); @@ -803,9 +807,9 @@ PurpleChatConversation *purple_serv_got_joined_chat(PurpleConnection *gc, g_return_val_if_fail(chat != NULL, NULL); if (!g_slist_find(purple_connection_get_active_chats(gc), chat)) - _purple_connection_add_active_chat(gc, chat); + _purple_connection_add_active_chat(gc, PURPLE_CHAT_CONVERSATION(chat)); - purple_chat_conversation_set_id(chat, id); + purple_chat_conversation_set_id(PURPLE_CHAT_CONVERSATION(chat), id); purple_signal_emit(purple_conversations_get_handle(), "chat-joined", chat); diff --git a/libpurple/server.h b/libpurple/server.h index a341f47592..a41d0634ee 100644 --- a/libpurple/server.h +++ b/libpurple/server.h @@ -42,6 +42,7 @@ #include "group.h" #include "protocols.h" #include "purpleattentiontype.h" +#include "purpleimconversation.h" #include "purplemessage.h" G_BEGIN_DECLS @@ -330,7 +331,7 @@ void purple_serv_got_chat_invite(PurpleConnection *gc, const char *name, * * Returns: (transfer none): The resulting conversation. */ -PurpleChatConversation *purple_serv_got_joined_chat(PurpleConnection *gc, +PurpleConversation *purple_serv_got_joined_chat(PurpleConnection *gc, int id, const char *name); /** * purple_serv_got_join_chat_failed: diff --git a/libpurple/xfer.c b/libpurple/xfer.c index 3612189dcc..84623adcb4 100644 --- a/libpurple/xfer.c +++ b/libpurple/xfer.c @@ -211,7 +211,7 @@ static void purple_xfer_conversation_write_internal(PurpleXfer *xfer, const char *message, gboolean is_error, gboolean print_thumbnail) { - PurpleIMConversation *im = NULL; + PurpleConversation *im = NULL; PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM; char *escaped; gconstpointer thumbnail_data; @@ -243,11 +243,11 @@ purple_xfer_conversation_write_internal(PurpleXfer *xfer, message_with_img = g_strdup_printf("<img src=\"" PURPLE_IMAGE_STORE_PROTOCOL "%u\"> %s", id, escaped); purple_conversation_write_system_message( - PURPLE_CONVERSATION(im), message_with_img, flags); + im, message_with_img, flags); g_free(message_with_img); } else { purple_conversation_write_system_message( - PURPLE_CONVERSATION(im), escaped, flags); + im, escaped, flags); } g_free(escaped); } @@ -955,7 +955,7 @@ purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) if (completed == TRUE) { char *msg = NULL; - PurpleIMConversation *im; + PurpleConversation *im; purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_DONE); @@ -983,7 +983,7 @@ purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) if (im != NULL) { purple_conversation_write_system_message( - PURPLE_CONVERSATION(im), msg, 0); + im, msg, 0); } g_free(msg); } diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index e7acc75e31..a1db17b25a 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3290,6 +3290,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) if (bnode && bnode->conv.conv) { conv = PURPLE_CHAT_CONVERSATION(bnode->conv.conv); } else { + PurpleConversation *chat_conv; char *chat_name; if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, get_name)) { chat_name = purple_protocol_chat_get_name(PURPLE_PROTOCOL_CHAT(protocol), @@ -3298,9 +3299,13 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) chat_name = g_strdup(purple_chat_get_name(chat)); } - conv = purple_conversations_find_chat_with_account(chat_name, - account); + chat_conv = purple_conversations_find_chat_with_account(chat_name, + account); g_free(chat_name); + + if(PURPLE_IS_CHAT_CONVERSATION(chat_conv)) { + conv = PURPLE_CHAT_CONVERSATION(chat_conv); + } } if (conv && !purple_chat_conversation_has_left(conv)) { @@ -6123,7 +6128,7 @@ add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data) PurpleAccount *account; PurpleGroup *g; PurpleBuddy *b; - PurpleIMConversation *im; + PurpleConversation *im; PurpleBuddyIcon *icon; if (resp == GTK_RESPONSE_OK) @@ -6184,7 +6189,7 @@ add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data) im = purple_conversations_find_im_with_account(who, data->rq_data.account); if (im != NULL) { - icon = purple_im_conversation_get_icon(im); + icon = purple_im_conversation_get_icon(PURPLE_IM_CONVERSATION(im)); if (icon != NULL) purple_buddy_icon_update(icon); } diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 5ca6e139b2..685a6ec826 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1678,13 +1678,13 @@ menu_conv_sel_send_cb(GObject *m, gpointer data) { PurpleAccount *account = g_object_get_data(m, "purple_account"); gchar *name = g_object_get_data(m, "purple_buddy_name"); - PurpleIMConversation *im; + PurpleConversation *im; if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) return; im = purple_im_conversation_new(account, name); - pidgin_conv_switch_active_conversation(PURPLE_CONVERSATION(im)); + pidgin_conv_switch_active_conversation(im); } static void @@ -3282,10 +3282,10 @@ pidgin_conv_find_gtkconv(PurpleConversation * conv) cn = PURPLE_BLIST_NODE(c); for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) { PurpleBuddy *b = PURPLE_BUDDY(bn); - PurpleIMConversation *im; + PurpleConversation *im; if ((im = purple_conversations_find_im_with_account(purple_buddy_get_name(b), purple_buddy_get_account(b)))) { - if (PIDGIN_CONVERSATION(PURPLE_CONVERSATION(im))) - return PIDGIN_CONVERSATION(PURPLE_CONVERSATION(im)); + if (PIDGIN_CONVERSATION(im)) + return PIDGIN_CONVERSATION(im); } } @@ -4493,10 +4493,10 @@ get_gtkconv_with_contact(PurpleContact *contact) for (; node; node = node->next) { PurpleBuddy *buddy = (PurpleBuddy*)node; - PurpleIMConversation *im; + PurpleConversation *im; im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (im) - return PIDGIN_CONVERSATION(PURPLE_CONVERSATION(im)); + return PIDGIN_CONVERSATION(im); } return NULL; } @@ -4594,21 +4594,21 @@ update_buddy_privacy_changed(PurpleBuddy *buddy) static void update_buddy_idle_changed(PurpleBuddy *buddy, gboolean old, gboolean newidle) { - PurpleIMConversation *im; + PurpleConversation *im; im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (im) - pidgin_conv_update_fields(PURPLE_CONVERSATION(im), PIDGIN_CONV_TAB_ICON); + pidgin_conv_update_fields(im, PIDGIN_CONV_TAB_ICON); } static void update_buddy_icon(PurpleBuddy *buddy) { - PurpleIMConversation *im; + PurpleConversation *im; im = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (im) - pidgin_conv_update_fields(PURPLE_CONVERSATION(im), PIDGIN_CONV_BUDDY_ICON); + pidgin_conv_update_fields(im, PIDGIN_CONV_BUDDY_ICON); } static void diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 189bc0a87e..f8d4e2a53d 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -321,7 +321,7 @@ pidgin_dialogs_im(void) void pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username) { - PurpleIMConversation *im; + PurpleConversation *im; g_return_if_fail(account != NULL); g_return_if_fail(username != NULL); @@ -331,8 +331,8 @@ pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username) if (im == NULL) im = purple_im_conversation_new(account, username); - pidgin_conv_attach_to_conversation(PURPLE_CONVERSATION(im)); - purple_conversation_present(PURPLE_CONVERSATION(im)); + pidgin_conv_attach_to_conversation(im); + purple_conversation_present(im); } static gboolean |