Mercurial > pidgin
changeset 21263:1812b8ccfd7a
Show alias in restored conversation.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 26 Oct 2007 08:39:34 +0000 |
parents | aee0d7fef769 |
children | ad49d9dace9f |
files | ChangeLog.API libpurple/conversation.c libpurple/conversation.h pidgin/gtkconv.c |
diffstat | 4 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Fri Oct 26 07:27:00 2007 +0000 +++ b/ChangeLog.API Fri Oct 26 08:39:34 2007 +0000 @@ -4,7 +4,7 @@ libpurple: Added: * purple_request_field_blist_nodes_new and its accessory functions. - * a PurpleConversation field in PurpleConvMessage + * a PurpleConversation field and an alias field in PurpleConvMessage * account-authorization signals (see account-signals.dox for details) (Stefan Ott) * libpurple/purple.h, which includes #define's and #include's
--- a/libpurple/conversation.c Fri Oct 26 07:27:00 2007 +0000 +++ b/libpurple/conversation.c Fri Oct 26 08:39:34 2007 +0000 @@ -205,8 +205,8 @@ /* Functions that deal with PurpleConvMessage */ static void -add_message_to_history(PurpleConversation *conv, const char *who, const char *message, - PurpleMessageFlags flags, time_t when) +add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, + const char *message, PurpleMessageFlags flags, time_t when) { PurpleConvMessage *msg; @@ -218,10 +218,11 @@ me = conv->account->username; who = me; } - + msg = g_new0(PurpleConvMessage, 1); PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); msg->who = g_strdup(who); + msg->alias = g_strdup(alias); msg->flags = flags; msg->what = g_strdup(message); msg->when = when; @@ -234,6 +235,7 @@ free_conv_message(PurpleConvMessage *msg) { g_free(msg->who); + g_free(msg->alias); g_free(msg->what); PURPLE_DBUS_UNREGISTER_POINTER(msg); g_free(msg); @@ -293,14 +295,10 @@ /* Check if this conversation already exists. */ if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL) { - if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT || - purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) - { - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - purple_conversation_chat_cleanup_for_rejoin(conv); - - return conv; - } + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && + purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) + purple_conversation_chat_cleanup_for_rejoin(conv); + return conv; } gc = purple_account_get_connection(account); @@ -934,7 +932,8 @@ if (ops && ops->write_conv) ops->write_conv(conv, who, alias, displayed, flags, mtime); - add_message_to_history(conv, who, message, flags, mtime); + + add_message_to_history(conv, who, alias, message, flags, mtime); purple_signal_emit(purple_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"),
--- a/libpurple/conversation.h Fri Oct 26 07:27:00 2007 +0000 +++ b/libpurple/conversation.h Fri Oct 26 08:39:34 2007 +0000 @@ -294,7 +294,8 @@ char *what; PurpleMessageFlags flags; time_t when; - PurpleConversation *conv; + PurpleConversation *conv; /** @since 2.3.0 */ + char *alias; /** @since 2.3.0 */ }; /**
--- a/pidgin/gtkconv.c Fri Oct 26 07:27:00 2007 +0000 +++ b/pidgin/gtkconv.c Fri Oct 26 08:39:34 2007 +0000 @@ -7435,7 +7435,7 @@ gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR><HR>", 0); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } - pidgin_conv_write_conv(msg->conv, msg->who, msg->who, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); if (im) { gtkconv->attach.current = g_list_delete_link(gtkconv->attach.current, gtkconv->attach.current); } else { @@ -7465,7 +7465,7 @@ msgs = g_list_sort(msgs, message_compare); for (; msgs; msgs = g_list_delete_link(msgs, msgs)) { PurpleConvMessage *msg = msgs->data; - pidgin_conv_write_conv(msg->conv, msg->who, msg->who, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); } gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR><HR>", 0); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);