[gaim-migrate @ 10456]

Thu, 29 Jul 2004 03:11:00 +0000

author
Kevin Stange <kstange@pidgin.im>
date
Thu, 29 Jul 2004 03:11:00 +0000
changeset 9613
cd81e0c76ec0
parent 9612
89f5a9900fdd
child 9614
4da9c73665c3

[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: Luke Schierer <lschiere@pidgin.im>

src/conversation.c file | annotate | diff | comparison | revisions
src/gtkconv.c file | annotate | diff | comparison | revisions
src/log.c file | annotate | diff | comparison | revisions
src/server.c file | annotate | diff | comparison | revisions
--- a/src/conversation.c	Wed Jul 28 05:33:54 2004 +0000
+++ b/src/conversation.c	Thu Jul 29 03:11:00 2004 +0000
@@ -1376,8 +1376,8 @@
 		!g_list_find(gaim_get_conversations(), conv))
 		return;
 
-	if (gc != NULL) {
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if (account != NULL) {
+		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account)));
 
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM ||
 			!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
--- a/src/gtkconv.c	Wed Jul 28 05:33:54 2004 +0000
+++ b/src/gtkconv.c	Thu Jul 29 03:11:00 2004 +0000
@@ -5073,7 +5073,7 @@
 	}
 	else {
 		char *new_message = g_memdup(message, length);
-		char *who_escaped = g_markup_escape_text(who, strlen(who));
+		char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup(""));
 
 		if (flags & GAIM_MESSAGE_WHISPER) {
 			str = g_malloc(1024);
--- 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);
 		}
 	}
 
--- a/src/server.c	Wed Jul 28 05:33:54 2004 +0000
+++ b/src/server.c	Thu Jul 29 03:11:00 2004 +0000
@@ -1208,7 +1208,7 @@
 			GaimLog *log = gaim_account_get_log(account);
 			char *tmp = g_strdup_printf(_("%s signed on"), alias);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
 						   current_time, tmp);
 			g_free(tmp);
 		}
@@ -1226,7 +1226,7 @@
 			tmp = g_strdup_printf(_("%s went away"), alias);
 
 		if(tmp){
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
 						   current_time, tmp);
 			g_free(tmp);
 		}
@@ -1239,7 +1239,7 @@
 			GaimLog *log = gaim_account_get_log(account);
 			char *tmp = g_strdup_printf(_("%s became idle"), alias);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
 						   current_time, tmp);
 			g_free(tmp);
 		}
@@ -1250,7 +1250,7 @@
 			GaimLog *log = gaim_account_get_log(account);
 			char *tmp = g_strdup_printf(_("%s became unidle"), alias);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
 						   current_time, tmp);
 			g_free(tmp);
 		}
@@ -1280,7 +1280,7 @@
 			GaimLog *log = gaim_account_get_log(account);
 			char *tmp = g_strdup_printf(_("%s signed off"), alias);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
 						   current_time, tmp);
 			g_free(tmp);
 		}

mercurial