diff src/log.c @ 9613:1b13160bf5a4

[gaim-migrate @ 10456] "Okay, now it's better. Still should close #997210. Note the list below is mostly the same as my initial comment and replaces the former information. 1) Prevent a crash if you sign off and try to dequeue messages from the away dialog. This was because we tried to use the destroyed GaimConnection in a couple places to get the prpl's name for the HTML logger and other conversation data. We look up the information via the account instead. 2) Prevent a possible crash if gaim_gtkconv_write_conv is called with who as NULL. 3) Prevent (null) or an empty string from being logged as the sender's name if the sender no longer has an alias because the account is signed off." --Kevin Stange committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 29 Jul 2004 03:11:00 +0000
parents 9c78aaa4117e
children 70ff55c0939b
line wrap: on
line diff
--- a/src/log.c	Wed Jul 28 05:33:54 2004 +0000
+++ b/src/log.c	Thu Jul 29 03:11:00 2004 +0000
@@ -503,17 +503,18 @@
 static void html_logger_write(GaimLog *log, GaimMessageFlags type,
 		const char *from, time_t time, const char *message)
 {
-	GaimConnection *gc = gaim_account_get_connection(log->account);
 	char date[64];
 	char *msg_fixed;
 	struct generic_logger_data *data = log->logger_data;
+	GaimPlugin *plugin = gaim_find_prpl(gaim_account_get_protocol_id(log->account));
+	const char *prpl_name = plugin->info->name;
+
 	if(!data) {
 		/* This log is new */
 		char *ud = gaim_user_dir();
 		char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
 		char *chat;
-		const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
-			(gaim_find_prpl(gaim_account_get_protocol_id(log->account)))->list_icon(log->account, NULL);
+		const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL);
 		char *dir;
 		char *filename;
 
@@ -577,17 +578,17 @@
 		} else if (type & GAIM_MESSAGE_RECV) {
 			if(gaim_message_meify(msg_fixed, -1))
 				fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
-						date, from, gc->prpl->info->name, msg_fixed);
+						date, from, prpl_name, msg_fixed);
 			else
 				fprintf(data->file, "<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
-						date, from, gc->prpl->info->name, msg_fixed);
+						date, from, prpl_name, msg_fixed);
 		} else if (type & GAIM_MESSAGE_SEND) {
 			if(gaim_message_meify(msg_fixed, -1))
 				fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
-						date, from, gc->prpl->info->name, msg_fixed);
+						date, from, prpl_name, msg_fixed);
 			else
 				fprintf(data->file, "<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
-						date, from, gc->prpl->info->name, msg_fixed);
+						date, from, prpl_name, msg_fixed);
 		}
 	}