changeset 11869:3ba50c385299

[gaim-migrate @ 14160] This should make joining big channels a bit quicker/more efficient. It was really bad before, now it's just bad. My crude testing showed it shaved a few hundred thousand library calls of joining #gaim, so it can't be too bad. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 28 Oct 2005 01:46:12 +0000
parents 4b71193448b3
children 678ef9ad7a0d
files src/conversation.c src/conversation.h src/gtkconv.c src/gtklog.c src/protocols/irc/msgs.c
diffstat 5 files changed, 24 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Thu Oct 27 21:48:05 2005 +0000
+++ b/src/conversation.c	Fri Oct 28 01:46:12 2005 +0000
@@ -1517,7 +1517,7 @@
 	aliases = g_list_reverse(aliases);
 
 	if (ops != NULL && ops->chat_add_users != NULL)
-		ops->chat_add_users(conv, users, aliases);
+		ops->chat_add_users(conv, users, flags, aliases);
 
 	g_list_free(aliases);
 }
--- a/src/conversation.h	Thu Oct 27 21:48:05 2005 +0000
+++ b/src/conversation.h	Fri Oct 28 01:46:12 2005 +0000
@@ -151,7 +151,7 @@
 	                   const char *message, GaimMessageFlags flags,
 	                   time_t mtime);
 
-	void (*chat_add_users)(GaimConversation *conv, GList *users, GList *aliases);
+	void (*chat_add_users)(GaimConversation *conv, GList *users, GList *flags, GList *aliases);
 	void (*chat_rename_user)(GaimConversation *conv, const char *old_name,
 	                         const char *new_name, const char *new_alias);
 	void (*chat_remove_user)(GaimConversation *conv, const char *user);
--- a/src/gtkconv.c	Thu Oct 27 21:48:05 2005 +0000
+++ b/src/gtkconv.c	Fri Oct 28 01:46:12 2005 +0000
@@ -121,7 +121,7 @@
 static void gray_stuff_out(GaimGtkConversation *gtkconv);
 static GList *generate_invite_user_names(GaimConnection *gc);
 static void add_chat_buddy_common(GaimConversation *conv, const char *name,
-								  const char *alias, const char *old_name);
+								  GaimConvChatBuddyFlags flags, const char *alias, const char *old_name);
 static gboolean tab_complete(GaimConversation *conv);
 static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type);
 static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state);
@@ -1358,6 +1358,7 @@
 	GaimConversation *conv = gtkconv->active_conv;
 	GaimGtkChatPane *gtkchat;
 	GaimConvChat *chat;
+	GaimConvChatBuddyFlags flags;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GtkTreeSelection *sel;
@@ -1374,6 +1375,7 @@
 		gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
 						   CHAT_USERS_NAME_COLUMN, &name,
 						   CHAT_USERS_ALIAS_COLUMN, &alias,
+						   CHAT_USERS_FLAGS_COLUMN, &flags,
 						   -1);
 		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 	}
@@ -1385,7 +1387,7 @@
 	else
 		gaim_conv_chat_ignore(chat, name);
 
-	add_chat_buddy_common(conv, name, alias, NULL);
+	add_chat_buddy_common(conv, name, flags, alias, NULL);
 	g_free(name);
 	g_free(alias);
 }
@@ -2855,14 +2857,13 @@
 }
 
 static void
-add_chat_buddy_common(GaimConversation *conv, const char *name, const char *alias, const char *old_name)
+add_chat_buddy_common(GaimConversation *conv, const char *name, GaimConvChatBuddyFlags flags, const char *alias, const char *old_name)
 {
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
 	GaimConvChat *chat;
 	GaimConnection *gc;
 	GaimPluginProtocolInfo *prpl_info;
-	GaimConvChatBuddyFlags flags;
 	GtkListStore *ls;
 	GdkPixbuf *pixbuf;
 	GtkTreeIter iter;
@@ -2882,7 +2883,6 @@
 
 	ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)));
 
-	flags = gaim_conv_chat_user_get_flags(chat, name);
 	pixbuf = get_chat_buddy_status_icon(chat, name, flags);
 
 	if (!strcmp(chat->nick, gaim_normalize(conv->account, old_name != NULL ? old_name : name)))
@@ -4340,13 +4340,14 @@
 }
 
 static void
-gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users, GList *aliases)
+gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users, GList *flags, GList *aliases)
 {
 	GaimConvChat *chat;
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
 	GList *l;
 	GList *ll;
+	GList *lll;
 	char tmp[BUF_LONG];
 	int num_users;
 
@@ -4364,11 +4365,13 @@
 	gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
 
 	l = users;
-	ll = aliases;
-	while (l != NULL && ll != NULL) {
-		add_chat_buddy_common(conv, (const char *)l->data, (const char *)ll->data, NULL);
+	ll = flags;
+	lll = aliases;
+	while (l != NULL && ll != NULL && lll != NULL) {
+		add_chat_buddy_common(conv, (const char *)l->data, GPOINTER_TO_INT(ll->data), (const char *)lll->data, NULL);
 		l = l->next;
 		ll = ll->next;
+		lll = lll->next;
 	}
 }
 
@@ -4379,6 +4382,7 @@
 	GaimConvChat *chat;
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
+	GaimConvChatBuddyFlags flags;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	int f = 1;
@@ -4395,7 +4399,7 @@
 	while (f != 0) {
 		char *val;
 
-		gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1);
+		gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1);
 
 		if (!gaim_utf8_strcasecmp(old_name, val)) {
 			gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
@@ -4413,7 +4417,7 @@
 
 	g_return_if_fail(new_alias != NULL);
 
-	add_chat_buddy_common(conv, new_name, new_alias, old_name);
+	add_chat_buddy_common(conv, new_name, flags, new_alias, old_name);
 }
 
 static void
@@ -4524,6 +4528,7 @@
 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user)
 {
 	GaimConvChat *chat;
+	GaimConvChatBuddyFlags flags;
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
 	GtkTreeIter iter;
@@ -4562,7 +4567,9 @@
 
 	g_return_if_fail(alias != NULL);
 
-	add_chat_buddy_common(conv, user, alias, NULL);
+	flags = gaim_conv_chat_user_get_flags(chat, user);
+
+	add_chat_buddy_common(conv, user, flags, alias, NULL);
 	g_free(alias);
 }
 
--- a/src/gtklog.c	Thu Oct 27 21:48:05 2005 +0000
+++ b/src/gtklog.c	Fri Oct 28 01:46:12 2005 +0000
@@ -313,7 +313,7 @@
 					log_preferences = _("Instant messages will only be logged if the \"Log all instant messages\" preference is enabled.");
 			} else if (ht->type == GAIM_LOG_CHAT) {
 				if (!gaim_prefs_get_bool("/core/logging/log_chats"))
-					log_preferences = _("Chats will only be logged if the \"Log all chats preference\" is enabled.");
+					log_preferences = _("Chats will only be logged if the \"Log all chats\" preference is enabled.");
 			}
 		}
 
--- a/src/protocols/irc/msgs.c	Thu Oct 27 21:48:05 2005 +0000
+++ b/src/protocols/irc/msgs.c	Fri Oct 28 01:46:12 2005 +0000
@@ -388,8 +388,8 @@
 					cur++;
 				}
 				tmp = g_strndup(cur, end - cur);
-				users = g_list_append(users, tmp);
-				flags = g_list_append(flags, GINT_TO_POINTER(f));
+				users = g_list_prepend(users, tmp);
+				flags = g_list_prepend(flags, GINT_TO_POINTER(f));
 				cur = end;
 				if (*cur)
 					cur++;