changeset 13886:90eb736b4c26

[gaim-migrate @ 16366] Fix a typo ("chat" -> "conv"), plug a memory leak, and auto-scroll the conversation history. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 28 Jun 2006 16:01:42 +0000
parents 582aaa4e287e
children 7d3256b253ec
files console/gntconv.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntconv.c	Wed Jun 28 05:52:23 2006 +0000
+++ b/console/gntconv.c	Wed Jun 28 16:01:42 2006 +0000
@@ -134,6 +134,7 @@
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
 			strip, (flags & GAIM_MESSAGE_NICK) ? GNT_TEXT_FLAG_UNDERLINE : 0);
 	gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv));
+	gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0);
 
 	g_free(name);
 	g_free(strip);
@@ -167,13 +168,15 @@
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
 			(strip = gaim_markup_strip_html(message)), 0);
 	gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv));
+	gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0);
+
 	g_free(strip);
 	g_free(name);
 }
 
 static void
-gg_write_conv(GaimConversation *conv, const char *who, const char *message,
-		GaimMessageFlags flags, time_t mtime)
+gg_write_conv(GaimConversation *conv, const char *who, const char *alias,
+		const char *message, GaimMessageFlags flags, time_t mtime)
 {
 	GGConv *ggconv = g_hash_table_lookup(ggconvs, conv);
 	char *strip;
@@ -182,15 +185,22 @@
 	g_return_if_fail(ggconv != NULL);
 
 	strip = gaim_markup_strip_html(message);
-	name = g_strdup_printf("%s: ", who);
+	if (alias && *alias)
+		name = g_strdup_printf("%s: ", alias);
+	else if (who && *who)
+		name = g_strdup_printf("%s: ", who);
+	else
+		name = g_strdup("");
 
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
 			name, GNT_TEXT_FLAG_BOLD);
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
 			strip, 0);
 	gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv));
+	gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0);
 
 	g_free(strip);
+	g_free(name);
 }
 
 static void
@@ -215,7 +225,7 @@
 	.destroy_conversation = gg_destroy_conversation,
 	.write_chat = gg_write_chat,
 	.write_im = gg_write_im,
-	.write_chat = gg_write_conv,
+	.write_conv = gg_write_conv,
 	.chat_add_users = gg_chat_add_users,
 	.chat_rename_user = gg_chat_rename_user,
 	.chat_remove_users = gg_chat_remove_user,