diff src/conversation.c @ 13969:8934a27fed4b

[gaim-migrate @ 16527] Sadrul sent me this patch to look over and then commit. It fixes a PRPL leak in Yahoo's chat and fixes a few other memory leaks that were mostly my fault. committer: Tailor Script <tailor@pidgin.im>
author Aaron Sheldon <aaronsheldon>
date Thu, 20 Jul 2006 12:53:46 +0000
parents df0dba522147
children 91a4cc3ee221
line wrap: on
line diff
--- a/src/conversation.c	Thu Jul 20 08:11:54 2006 +0000
+++ b/src/conversation.c	Thu Jul 20 12:53:46 2006 +0000
@@ -1485,7 +1485,7 @@
 {
 	GaimConversation *conv;
 	GaimConversationUiOps *ops;
-	GaimConvChatBuddy *cb;
+	GaimConvChatBuddy *cbuddy;
 	GaimConnection *gc;
 	GaimPluginProtocolInfo *prpl_info;
 	GList *ul, *fl;
@@ -1508,12 +1508,9 @@
 		const char *user = (const char *)ul->data;
 		const char *alias = user;
 		gboolean quiet;
-		GaimConvChatBuddy *cbuddy;
-		GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data);
+		GaimConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data);
 		const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL);
 
-		cbuddy = gaim_conv_chat_cb_new(user, NULL, GPOINTER_TO_INT(fl->data));
-
 		if (!strcmp(chat->nick, gaim_normalize(conv->account, user))) {
 			const char *alias2 = gaim_account_get_alias(conv->account);
 			if (alias2 != NULL)
@@ -1531,17 +1528,14 @@
 		}
 
 		quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(),
-						 "chat-buddy-joining", conv, user, flags)) |
+						 "chat-buddy-joining", conv, user, flag)) |
 				gaim_conv_chat_is_user_ignored(chat, user);
 
-		cb = gaim_conv_chat_cb_new(user, NULL, flags);
+		cbuddy = gaim_conv_chat_cb_new(user, alias, flag);
 		/* This seems dumb. Why should we set users thousands of times? */
 		gaim_conv_chat_set_users(chat,
-				g_list_prepend(gaim_conv_chat_get_users(chat), cb));
-
-		cbuddy->alias = strdup(alias); /* Should I be doing a strdup? */
-		cbuddy->alias_key = g_utf8_collate_key(alias, strlen(alias));
-		cbuddy->buddy = (gaim_find_buddy(conv->account, cbuddy->name) != NULL);
+				g_list_prepend(gaim_conv_chat_get_users(chat), cbuddy));
+
 		cbuddies = g_list_prepend(cbuddies, cbuddy);
 
 		if (!quiet && new_arrivals) {
@@ -1563,7 +1557,7 @@
 		}
 
 		gaim_signal_emit(gaim_conversations_get_handle(),
-						 "chat-buddy-joined", conv, user, flags, new_arrivals);
+						 "chat-buddy-joined", conv, user, flag, new_arrivals);
 		ul = ul->next;
 		fl = fl->next;
 		if (extra_msgs != NULL)
@@ -1575,6 +1569,7 @@
 	if (ops != NULL && ops->chat_add_users != NULL)
 		ops->chat_add_users(conv, cbuddies, new_arrivals);
 
+	g_list_free(cbuddies);
 }
 
 void