changeset 15459:fc61aa6bc571

merge of 'b8682f66d35fb704bcd0ec3b4f06caaf002b7906' and 'c859709334e5e5d77d954c938d79952448889e5f'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 29 Jan 2007 03:36:59 +0000
parents 3b45081f6183 (current diff) dc69d7b760ad (diff)
children fafd7d4f8c50
files
diffstat 6 files changed, 85 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/.mtn-ignore	Mon Jan 29 03:22:42 2007 +0000
+++ b/.mtn-ignore	Mon Jan 29 03:36:59 2007 +0000
@@ -48,6 +48,7 @@
 libpurple/plugins/perl/common/lib
 libpurple/win32/libpurplerc.rc
 libtool
+local.mak
 ltmain.sh
 missing
 mkinstalldirs
--- a/libpurple/protocols/irc/cmds.c	Mon Jan 29 03:22:42 2007 +0000
+++ b/libpurple/protocols/irc/cmds.c	Mon Jan 29 03:36:59 2007 +0000
@@ -245,8 +245,6 @@
 	irc_send(irc, buf);
 	g_free(buf);
 
-	irc->nameconv = g_strdup(target);
-
 	return 0;
 }
 
--- a/libpurple/protocols/irc/irc.h	Mon Jan 29 03:22:42 2007 +0000
+++ b/libpurple/protocols/irc/irc.h	Mon Jan 29 03:36:59 2007 +0000
@@ -41,6 +41,8 @@
 
 #define IRC_INITIAL_BUFSIZE 1024
 
+#define IRC_NAMES_FLAG "irc-namelist"
+
 
 enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET };
 enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED };
@@ -60,7 +62,6 @@
 
 	GString *motd;
 	GString *names;
-	char *nameconv;
 	struct _whois {
 		char *nick;
 		char *away;
--- a/libpurple/protocols/irc/msgs.c	Mon Jan 29 03:22:42 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Mon Jan 29 03:36:59 2007 +0000
@@ -442,27 +442,23 @@
 	GaimConversation *convo;
 
 	if (!strcmp(name, "366")) {
-		convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account);
+		convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, args[1], irc->account);
 		if (!convo) {
 			gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[1]);
 			g_string_free(irc->names, TRUE);
 			irc->names = NULL;
-			g_free(irc->nameconv);
-			irc->nameconv = NULL;
 			return;
 		}
 
 		names = cur = g_string_free(irc->names, FALSE);
 		irc->names = NULL;
-		if (irc->nameconv) {
+		if (gaim_conversation_get_data(convo, IRC_NAMES_FLAG)) {
 			msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : "");
 			if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT)
 				gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 			else
 				gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 			g_free(msg);
-			g_free(irc->nameconv);
-			irc->nameconv = NULL;
 		} else {
 			GList *users = NULL;
 			GList *flags = NULL;
@@ -504,6 +500,9 @@
 				g_list_free(users);
 				g_list_free(flags);
 			}
+
+			gaim_conversation_set_data(convo, IRC_NAMES_FLAG,
+						   GINT_TO_POINTER(TRUE));
 		}
 		g_free(names);
 	} else {
@@ -723,10 +722,13 @@
 		convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
 							    args[0],
 							    irc->account);
+
 		if (convo == NULL) {
 			gaim_debug_error("irc", "tried to join %s but couldn't\n", args[0]);
 			return;
 		}
+		gaim_conversation_set_data(convo, IRC_NAMES_FLAG,
+					   GINT_TO_POINTER(FALSE));
 		gaim_conversation_present(convo);
 		return;
 	}
--- a/libpurple/win32/global.mak	Mon Jan 29 03:22:42 2007 +0000
+++ b/libpurple/win32/global.mak	Mon Jan 29 03:36:59 2007 +0000
@@ -5,20 +5,23 @@
 # wide definitions (after correctly defining GAIM_TOP).
 #
 
+#include optional $(GAIM_TOP)/local.mak to allow overriding of any definitions
+-include $(GAIM_TOP)/local.mak
+
 # Locations of our various dependencies
-WIN32_DEV_TOP := $(GAIM_TOP)/../win32-dev
-ASPELL_TOP := $(WIN32_DEV_TOP)/aspell-dev-0-50-3-3
-GTKSPELL_TOP := $(WIN32_DEV_TOP)/gtkspell-2.0.6
-GTK_TOP := $(WIN32_DEV_TOP)/gtk_2_0
-GTK_BIN := $(GTK_TOP)/bin
-HOWL_TOP := $(WIN32_DEV_TOP)/howl-1.0.0
-LIBXML2_TOP := $(WIN32_DEV_TOP)/libxml2
-MEANWHILE_TOP := $(WIN32_DEV_TOP)/meanwhile-1.0.2
-NSPR_TOP := $(WIN32_DEV_TOP)/nspr-4.6.4
-NSS_TOP := $(WIN32_DEV_TOP)/nss-3.11.4
-PERL_LIB_TOP := $(WIN32_DEV_TOP)/perl58
-SILC_TOOLKIT := $(WIN32_DEV_TOP)/silc-toolkit-1.0.2
-TCL_LIB_TOP := $(WIN32_DEV_TOP)/tcl-8.4.5
+WIN32_DEV_TOP ?= $(GAIM_TOP)/../win32-dev
+ASPELL_TOP ?= $(WIN32_DEV_TOP)/aspell-dev-0-50-3-3
+GTKSPELL_TOP ?= $(WIN32_DEV_TOP)/gtkspell-2.0.6
+GTK_TOP ?= $(WIN32_DEV_TOP)/gtk_2_0
+GTK_BIN ?= $(GTK_TOP)/bin
+HOWL_TOP ?= $(WIN32_DEV_TOP)/howl-1.0.0
+LIBXML2_TOP ?= $(WIN32_DEV_TOP)/libxml2
+MEANWHILE_TOP ?= $(WIN32_DEV_TOP)/meanwhile-1.0.2
+NSPR_TOP ?= $(WIN32_DEV_TOP)/nspr-4.6.4
+NSS_TOP ?= $(WIN32_DEV_TOP)/nss-3.11.4
+PERL_LIB_TOP ?= $(WIN32_DEV_TOP)/perl58
+SILC_TOOLKIT ?= $(WIN32_DEV_TOP)/silc-toolkit-1.0.2
+TCL_LIB_TOP ?= $(WIN32_DEV_TOP)/tcl-8.4.5
 
 # Where we installing this stuff to?
 GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir
@@ -44,8 +47,8 @@
 GAIM_LIBGAIM_DLL := $(GAIM_LIB_TOP)/libpurple.dll
 GAIM_LIBGAIM_PERL_DLL := $(GAIM_LIB_PERL_TOP)/perl.dll
 GAIM_GTKGAIM_DLL := $(GAIM_GTK_TOP)/pidgin.dll
-GAIM_EXE := $(GAIM_GTK_TOP)/gaim.exe
-GAIM_PORTABLE_EXE := $(GAIM_GTK_TOP)/gaim-portable.exe
+GAIM_EXE := $(GAIM_GTK_TOP)/pidgin.exe
+GAIM_PORTABLE_EXE := $(GAIM_GTK_TOP)/pidgin-portable.exe
 
 GCCWARNINGS := -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wextra -Wno-sign-compare -Wno-unused-parameter -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
 
@@ -75,11 +78,13 @@
 DLL_LD_FLAGS += -Wl,--enable-auto-image-base
 
 # Build programs
-CC := gcc.exe
-GMSGFMT := $(GTK_BIN)/msgfmt
-MAKENSIS := makensis.exe
-PERL := /cygdrive/c/perl/bin/perl
-WINDRES := windres
+ifeq "$(origin CC)" "default"
+  CC := gcc.exe
+endif
+GMSGFMT ?= $(GTK_BIN)/msgfmt
+MAKENSIS ?= makensis.exe
+PERL ?= /cygdrive/c/perl/bin/perl
+WINDRES ?= windres
 
 GAIM_COMMON_RULES := $(GAIM_LIB_TOP)/win32/rules.mak
 GAIM_COMMON_TARGETS := $(GAIM_LIB_TOP)/win32/targets.mak
--- a/pidgin/gtkaccount.c	Mon Jan 29 03:22:42 2007 +0000
+++ b/pidgin/gtkaccount.c	Mon Jan 29 03:36:59 2007 +0000
@@ -159,7 +159,7 @@
 
 static void add_account_to_liststore(GaimAccount *account, gpointer user_data);
 static void set_account(GtkListStore *store, GtkTreeIter *iter,
-						  GaimAccount *account);
+						  GaimAccount *account, GdkPixbuf *global_buddyicon);
 
 /**************************************************************************
  * Add/Modify Account dialog
@@ -1369,7 +1369,7 @@
 
 
 static const GtkTargetEntry dnd_targets[] = {
-       {"text/plain", 0, 0},
+	{"text/plain", 0, 0},
 	{"text/uri-list", 0, 1},
 	{"STRING", 0, 2}
 };
@@ -1626,7 +1626,7 @@
 	/* Remove the account from the GtkListStore */
 	if (accounts_window_find_account_in_treemodel(&iter, account))
 		gtk_list_store_remove(accounts_window->model, &iter);
-	
+
 	if (gaim_accounts_get_all() == NULL)
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0);
 }
@@ -1694,7 +1694,7 @@
 
 	gtk_list_store_insert_after(store, &new_iter, position);
 
-	set_account(store, &new_iter, account);
+	set_account(store, &new_iter, account, NULL);
 
 	gtk_list_store_remove(store, iter);
 }
@@ -1712,7 +1712,7 @@
 
 	gtk_list_store_insert_before(store, &new_iter, position);
 
-	set_account(store, &new_iter, account);
+	set_account(store, &new_iter, account, NULL);
 
 	gtk_list_store_remove(store, iter);
 }
@@ -1975,35 +1975,35 @@
 }
 
 static void
-set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account)
+set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account, GdkPixbuf *global_buddyicon)
 {
-	const char *path;
-	GdkPixbuf *pixbuf;
-	GdkPixbuf *statusicon_pixbuf;
-	GdkPixbuf *statusicon_pixbuf_scaled;
+	GdkPixbuf *pixbuf, *buddyicon = NULL;
+	const char *path = NULL;
 
 	pixbuf = gaim_gtk_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM);
 	if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
 		gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
 
-	if (gaim_account_get_bool(account, "use-global-buddyicon", TRUE))
-		path = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon");
-	else
+	if (gaim_account_get_bool(account, "use-global-buddyicon", TRUE)) {
+		if (global_buddyicon != NULL)
+			buddyicon = g_object_ref(G_OBJECT(global_buddyicon));
+		/* This is for when set_account() is called for a single account */
+		else
+			path = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon");
+	} else
 		path = gaim_account_get_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon-path", NULL);
-	if (path != NULL)
-		statusicon_pixbuf = gdk_pixbuf_new_from_file(path, NULL);
-	else
-		statusicon_pixbuf = NULL;
-
-	if (statusicon_pixbuf) {
-		statusicon_pixbuf_scaled = gdk_pixbuf_scale_simple(statusicon_pixbuf, 22, 22, GDK_INTERP_HYPER);
-	} else {
-		statusicon_pixbuf_scaled = NULL;
+
+	if (path != NULL) {
+		GdkPixbuf *buddyicon_pixbuf = gdk_pixbuf_new_from_file(path, NULL);
+		if (buddyicon_pixbuf != NULL) {
+			buddyicon = gdk_pixbuf_scale_simple(buddyicon_pixbuf, 22, 22, GDK_INTERP_HYPER);
+			g_object_unref(G_OBJECT(buddyicon_pixbuf));
+		}
 	}
 
 	gtk_list_store_set(store, iter,
 			COLUMN_ICON, pixbuf,
-			COLUMN_BUDDYICON, statusicon_pixbuf_scaled,
+			COLUMN_BUDDYICON, buddyicon,
 			COLUMN_SCREENNAME, gaim_account_get_username(account),
 			COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI),
 			COLUMN_PROTOCOL, gaim_account_get_protocol_name(account),
@@ -2012,16 +2012,15 @@
 
 	if (pixbuf != NULL)
 		g_object_unref(G_OBJECT(pixbuf));
-	if (statusicon_pixbuf != NULL)
-		g_object_unref(G_OBJECT(statusicon_pixbuf));
-	if (statusicon_pixbuf_scaled != NULL)
-		g_object_unref(G_OBJECT(statusicon_pixbuf_scaled));
+	if (buddyicon != NULL)
+		g_object_unref(G_OBJECT(buddyicon));
 }
 
 static void
 add_account_to_liststore(GaimAccount *account, gpointer user_data)
 {
 	GtkTreeIter iter;
+	GdkPixbuf *global_buddyicon = user_data;
 
 	if (accounts_window == NULL)
 		return;
@@ -2029,7 +2028,7 @@
 	gtk_list_store_append(accounts_window->model, &iter);
 	gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook),1);
 
-	set_account(accounts_window->model, &iter, account);
+	set_account(accounts_window->model, &iter, account, global_buddyicon);
 }
 
 static gboolean
@@ -2037,14 +2036,27 @@
 {
 	GList *l;
 	gboolean ret = FALSE;
-	
+	GdkPixbuf *global_buddyicon = NULL;
+	const char *path;
+
 	gtk_list_store_clear(dialog->model);
 
+	if ((path = gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon")) != NULL) {
+		GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, NULL);
+		if (pixbuf != NULL) {
+			global_buddyicon = gdk_pixbuf_scale_simple(pixbuf, 22, 22, GDK_INTERP_HYPER);
+			g_object_unref(G_OBJECT(pixbuf));
+		}
+	}
+
 	for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
 		ret = TRUE;
-		add_account_to_liststore((GaimAccount *)l->data, NULL);
+		add_account_to_liststore((GaimAccount *)l->data, global_buddyicon);
 	}
 
+	if (global_buddyicon != NULL)
+		g_object_unref(G_OBJECT(global_buddyicon));
+
 	return ret;
 }
 
@@ -2125,9 +2137,8 @@
 	gtk_notebook_set_show_border(GTK_NOTEBOOK(accounts_window->notebook), FALSE);
 	gtk_container_add(GTK_CONTAINER(frame), accounts_window->notebook);
 
-       	
 	/* Create a helpful first-time-use label */
-       	label = gtk_label_new(NULL);
+	label = gtk_label_new(NULL);
 	/* Translators: Please maintain the use of -> or <- to represent the menu heirarchy */
 	pretty = gaim_gtk_make_pretty_arrows(_(
 						 "<span size='larger' weight='bold'>Welcome to " PIDGIN_NAME "!</span>\n\n"
@@ -2190,7 +2201,7 @@
 
 	if (populate_accounts_list(dialog))
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 1);
-	else 
+	else
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0);
 
 	/* Setup DND. I wanna be an orc! */
@@ -2205,7 +2216,7 @@
 					 G_CALLBACK(drag_data_received_cb), dialog);
 	g_signal_connect(G_OBJECT(treeview), "drag-data-get",
 					 G_CALLBACK(drag_data_get_cb), dialog);
-	
+
 	gtk_widget_show_all(frame);
 	return frame;
 }
@@ -2218,7 +2229,7 @@
 	if (!accounts_window_find_account_in_treemodel(&iter, account))
 		return;
 
-	set_account(window->model, &iter, account);
+	set_account(window->model, &iter, account, NULL);
 }
 
 static void
@@ -2425,14 +2436,14 @@
 	data->account  = account;
 	data->username = g_strdup(remote_user);
 	data->alias    = g_strdup(alias);
-	
+
 	buffer = make_info(account, gc, remote_user, id, alias, msg);
 	alert = gaim_gtk_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
 					  _("Add buddy to your list?"), buffer, data, 
 					  _("Add"), G_CALLBACK(add_user_cb),
 					  _("Cancel"), G_CALLBACK(free_add_user_data), NULL);
 	gaim_gtk_blist_add_alert(alert);
-        
+
 	g_free(buffer);
 }
 
@@ -2479,7 +2490,7 @@
 	gc = gaim_account_get_connection(account);
 	if (message != NULL && *message == '\0')
 		message = NULL;
-	
+
 	buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"),
 				remote_user,
 	 	                (alias != NULL ? " ("  : ""),