im.pidgin.pidgin.next.minor: a0cc58611eba803e55891cb8cfefa80d29a8413b

sadrul at pidgin.im sadrul at pidgin.im
Fri Oct 26 05:00:46 EDT 2007


-----------------------------------------------------------------
Revision: a0cc58611eba803e55891cb8cfefa80d29a8413b
Ancestor: 771ebee2b730ca642cfc54d74967af56f5ee4589
Author: sadrul at pidgin.im
Date: 2007-10-26T08:39:34
Branch: im.pidgin.pidgin.next.minor

Modified files:
        ChangeLog.API libpurple/conversation.c
        libpurple/conversation.h pidgin/gtkconv.c

ChangeLog: 

Show alias in restored conversation.

-------------- next part --------------
============================================================
--- ChangeLog.API	f8443ffd7b2c7e670e9f210adea0cf1e5f00655f
+++ ChangeLog.API	632b61fb302854c6a896c0bceffb6b21cedcb525
@@ -1,10 +1,10 @@ version 2.3.0 (??/??/????):
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 2.3.0 (??/??/????):
 	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
============================================================
--- libpurple/conversation.c	f31c0064ee683e27835bd4599dc0030c4e6f295e
+++ libpurple/conversation.c	a3f044a1ba848c426e7d6391b519abf27da9e195
@@ -205,8 +205,8 @@ static void
 /* 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 @@ add_message_to_history(PurpleConversatio
 			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
 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 @@ purple_conversation_new(PurpleConversati
 	/* 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,8 +932,9 @@ purple_conversation_write(PurpleConversa
 
 	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"),
 		account, who, displayed, conv, flags);
============================================================
--- libpurple/conversation.h	7575a4b175d92301a2023d169495e644b966a84c
+++ libpurple/conversation.h	c66565ea762841da2f9e8b19746290c831b37f9c
@@ -294,7 +294,8 @@ struct _PurpleConvMessage
 	char *what;
 	PurpleMessageFlags flags;
 	time_t when;
-	PurpleConversation *conv;
+	PurpleConversation *conv;  /** @since 2.3.0 */
+	char *alias;               /** @since 2.3.0 */
 };
 
 /**
============================================================
--- pidgin/gtkconv.c	25d3a991f261f70b56e427117a68c37d2cd508b8
+++ pidgin/gtkconv.c	d294624428c193a8bf0fe57ce96f81b312efbbad
@@ -7435,7 +7435,7 @@ add_message_history_to_gtkconv(gpointer 
 			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 @@ add_message_history_to_gtkconv(gpointer 
 		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);


More information about the Commits mailing list