# HG changeset patch # User Ankit Vani # Date 1379573805 -19800 # Node ID 6cafff03b4c29c9644d2b202a8f92488e6cd63fd # Parent 14109bfbe008059e0f9b72888bb6abe38617da23 Refactored some non-gobjectified purple code in gg according to the new conversation API diff -r 14109bfbe008 -r 6cafff03b4c2 libpurple/protocols/gg/chat.c --- a/libpurple/protocols/gg/chat.c Thu Sep 19 00:26:33 2013 +0530 +++ b/libpurple/protocols/gg/chat.c Thu Sep 19 12:26:45 2013 +0530 @@ -24,7 +24,7 @@ int local_id; uint64_t id; - PurpleConversation *conv; + PurpleChatConversation *conv; PurpleConnection *gc; gboolean left; @@ -112,7 +112,6 @@ static void ggp_chat_open_conv(ggp_chat_local_info *chat) { - PurpleConvChat *pcchat; int i; if (chat->conv != NULL) @@ -122,18 +121,17 @@ ggp_chat_get_name_from_id(chat->id)); if (chat->previously_joined) { - purple_conversation_write(chat->conv, NULL, + purple_conversation_write(PURPLE_CONVERSATION(chat->conv), NULL, _("You have re-joined the chat"), PURPLE_MESSAGE_SYSTEM, time(NULL)); } chat->previously_joined = TRUE; - pcchat = purple_conversation_get_chat_data(chat->conv); - purple_conv_chat_clear_users(pcchat); + purple_chat_conversation_clear_users(chat->conv); for (i = 0; i < chat->participants_count; i++) - purple_conv_chat_add_user(pcchat, + purple_chat_conversation_add_user(chat->conv, ggp_uin_to_str(chat->participants[i]), NULL, - PURPLE_CBFLAGS_NONE, FALSE); + PURPLE_CHAT_USER_NONE, FALSE); } static ggp_chat_local_info * ggp_chat_get_local(PurpleConnection *gc, @@ -242,8 +240,8 @@ if (!chat->conv) return; - purple_conv_chat_add_user(purple_conversation_get_chat_data(chat->conv), - ggp_uin_to_str(uin), NULL, PURPLE_CBFLAGS_NONE, TRUE); + purple_chat_conversation_add_user(chat->conv, + ggp_uin_to_str(uin), NULL, PURPLE_CHAT_USER_NONE, TRUE); } static void ggp_chat_left(ggp_chat_local_info *chat, uin_t uin) @@ -272,15 +270,14 @@ if (me == uin) { - purple_conversation_write(chat->conv, NULL, + purple_conversation_write(PURPLE_CONVERSATION(chat->conv), NULL, _("You have left the chat"), PURPLE_MESSAGE_SYSTEM, time(NULL)); serv_got_chat_left(chat->gc, chat->local_id); chat->conv = NULL; chat->left = TRUE; } - purple_conv_chat_remove_user(purple_conversation_get_chat_data( - chat->conv), ggp_uin_to_str(uin), NULL); + purple_chat_conversation_remove_user(chat->conv, ggp_uin_to_str(uin), NULL); } GList * ggp_chat_info(PurpleConnection *gc) @@ -476,7 +473,7 @@ PurpleMessageFlags flags) { GGPInfo *info = purple_connection_get_protocol_data(gc); - PurpleConversation *conv; + PurpleChatConversation *conv; ggp_chat_local_info *chat; gboolean succ = TRUE; const gchar *me; @@ -490,11 +487,11 @@ return -1; } - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, + conv = purple_conversations_find_chat_with_account( ggp_chat_get_name_from_id(chat->id), purple_connection_get_account(gc)); - gg_msg = ggp_message_format_to_gg(conv, message); + gg_msg = ggp_message_format_to_gg(PURPLE_CONVERSATION(conv), message); if (gg_chat_send_message(info->session, chat->id, gg_msg, TRUE) < 0) succ = FALSE; @@ -526,8 +523,8 @@ ggp_chat_open_conv(chat); if (who == me) { - purple_conversation_write(chat->conv, ggp_uin_to_str(who), - message, PURPLE_MESSAGE_SEND, time); + purple_conversation_write(PURPLE_CONVERSATION(chat->conv), + ggp_uin_to_str(who), message, PURPLE_MESSAGE_SEND, time); } else {