# HG changeset patch # User Sadrul Habib Chowdhury # Date 1189444116 0 # Node ID 7ea794e7cec30caa1a6eb574e0e173ab92e8dc21 # Parent 892a99da5c5f0c768cc0c2a048f8291efb534ae4 Keep the message history in PurpleConversation. diff -r 892a99da5c5f -r 7ea794e7cec3 libpurple/conversation.c --- a/libpurple/conversation.c Mon Sep 10 14:47:42 2007 +0000 +++ b/libpurple/conversation.c Mon Sep 10 17:08:36 2007 +0000 @@ -39,7 +39,6 @@ static GList *ims = NULL; static GList *chats = NULL; static PurpleConversationUiOps *default_ops = NULL; -static GHashTable *histories = NULL; void purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) @@ -209,7 +208,6 @@ add_message_to_history(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t when) { - GList *list; PurpleConvMessage *msg; if (flags & PURPLE_MESSAGE_SEND) { @@ -228,9 +226,7 @@ msg->what = g_strdup(message); msg->when = when; - list = g_hash_table_lookup(histories, conv); - list = g_list_prepend(list, msg); - g_hash_table_insert(histories, conv, list); + conv->message_history = g_list_prepend(conv->message_history, msg); } static void @@ -2068,14 +2064,14 @@ void purple_conversation_clear_message_history(PurpleConversation *conv) { - GList *list = g_hash_table_lookup(histories, conv); + GList *list = conv->message_history; message_history_free(list); - g_hash_table_remove(histories, conv); + conv->message_history = NULL; } GList *purple_conversation_get_message_history(PurpleConversation *conv) { - return g_hash_table_lookup(histories, conv); + return conv->message_history; } const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) @@ -2382,9 +2378,6 @@ purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONVERSATION), purple_value_new(PURPLE_TYPE_BOXED, "GList **")); - - /* Initialize the history */ - histories = g_hash_table_new(g_direct_hash, g_direct_equal); } void @@ -2393,6 +2386,5 @@ while (conversations) purple_conversation_destroy((PurpleConversation*)conversations->data); purple_signals_unregister_by_instance(purple_conversations_get_handle()); - g_hash_table_destroy(histories); - histories = NULL; } + diff -r 892a99da5c5f -r 7ea794e7cec3 libpurple/conversation.h --- a/libpurple/conversation.h Mon Sep 10 14:47:42 2007 +0000 +++ b/libpurple/conversation.h Mon Sep 10 17:08:36 2007 +0000 @@ -327,7 +327,7 @@ GHashTable *data; /**< Plugin-specific data. */ PurpleConnectionFlags features; /**< The supported features */ - + GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ }; #ifdef __cplusplus