diff plugins/history.c @ 8898:de87e510ff9a

[gaim-migrate @ 9667] This makes the history plugin work in chats and not just conversations. To do this I had to change some functions in log.c to pass around the GaimLogType (GAIM_LOG_IM, GAIM_LOG_CHAT, or GAIM_LOG_SYSTEM). I hope that's not a problem... Here's how I see it: When creating a new GaimLog you need 3 things, the type, your account and the name of the other person/chat. It only makes sense that you would need those same 3 things to find a log. Or to calculate log size. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 07 May 2004 02:30:02 +0000
parents d7b8eb1f0a18
children d729311f6352
line wrap: on
line diff
--- a/plugins/history.c	Thu May 06 23:56:52 2004 +0000
+++ b/plugins/history.c	Fri May 07 02:30:02 2004 +0000
@@ -21,14 +21,23 @@
 static void historize(GaimConversation *c)
 {
 	GaimGtkConversation *gtkconv;
+	GaimConversationType convtype;
 	char *history = NULL;
 	guint flags;
 	GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS;
-	GList *logs = gaim_log_get_logs(gaim_conversation_get_name(c),
-			gaim_conversation_get_account(c));
+	GList *logs = NULL;
+
+	convtype = gaim_conversation_get_type(c);
+	if (convtype == GAIM_CONV_IM)
+		logs = gaim_log_get_logs(GAIM_LOG_IM,
+				gaim_conversation_get_name(c), gaim_conversation_get_account(c));
+	else if (convtype == GAIM_CONV_CHAT)
+		logs = gaim_log_get_logs(GAIM_LOG_CHAT,
+				gaim_conversation_get_name(c), gaim_conversation_get_account(c));
 
 	if (!logs)
 		return;
+
 	history = gaim_log_read((GaimLog*)logs->data, &flags);
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 	if (flags & GAIM_LOG_READ_NO_NEWLINE)
@@ -37,6 +46,7 @@
 	gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<hr>", options);
 	gtk_imhtml_scroll_to_end(GTK_IMHTML(gtkconv->imhtml));
 	g_free(history);
+
 	while (logs) {
 		GaimLog *log = logs->data;
 		GList *logs2;
@@ -45,7 +55,6 @@
 		g_list_free_1(logs);
 		logs = logs2;
 	}
-	
 }
 
 static gboolean