changeset 20329:24ce4fcce5b0

applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec through 3efb5d625e5a73423be8be77a6baeed0b65f7e55 applied changes from 74f0e6698f9f17bc8335cf2454c06e6b13748039 through 017296ee954fb91349806c809983c916842603da applied changes from c8ff393c43d8a5f4136c653853a95284cc5710dc through f53dbbff44537aa86b1cb8788fd306c90e6ccca9 applied changes from f53dbbff44537aa86b1cb8788fd306c90e6ccca9 through 5798594431164383deacd7d4aad5a9a0d5b867ae applied changes from 5798594431164383deacd7d4aad5a9a0d5b867ae through 0822c640f22b63d7bc8992e62b80bccd1eea12a2 applied changes from 703c3f9437d5e71255819c747f9690d19c6ba6e3 through b7a2c4d81867c3bbd262c2a4b1d924ea7fd3afb6 applied changes from b7a2c4d81867c3bbd262c2a4b1d924ea7fd3afb6 through 5ea15b000ee727088be88bb335c2ded6b2ab96e3 applied changes from 5ea15b000ee727088be88bb335c2ded6b2ab96e3 through c5051010dd50f9fdb7f85d779d882ce8bbc149f2
author Luke Schierer <lschiere@pidgin.im>
date Fri, 19 Oct 2007 18:14:53 +0000
parents dc7f87da7e95
children 4ab7551d9626
files libpurple/plugins/log_reader.c libpurple/plugins/ssl/ssl-nss.c libpurple/protocols/bonjour/bonjour.c libpurple/protocols/bonjour/parser.c libpurple/protocols/jabber/roster.c libpurple/tests/test_cipher.c pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtkutils.c pidgin/win32/winpidgin.c
diffstat 10 files changed, 90 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Fri Oct 19 18:14:53 2007 +0000
@@ -232,7 +232,6 @@
 	struct adium_logger_data *data;
 	GError *error = NULL;
 	gchar *read = NULL;
-	gsize length;
 
 	/* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE
 	 * XXX: TODO: for HTML logs. */
@@ -246,8 +245,9 @@
 	g_return_val_if_fail(data->path != NULL, g_strdup(""));
 
 	purple_debug_info("Adium log read", "Reading %s\n", data->path);
-	if (!g_file_get_contents(data->path, &read, &length, &error)) {
-		purple_debug_error("Adium log read", "Error reading log\n");
+	if (!g_file_get_contents(data->path, &read, NULL, &error)) {
+		purple_debug_error("Adium log read", "Error reading log: %s\n",
+					   (error && error->message) ? error->message : "Unknown error");
 		if (error)
 			g_error_free(error);
 		return g_strdup("");
@@ -1808,8 +1808,10 @@
 	error = NULL;
 	if (!g_file_get_contents(path, &contents, NULL, &error)) {
 		purple_debug_error("QIP logger",
-		                   "Couldn't read file %s: %s \n", path, error->message);
-		g_error_free(error);
+				   "Couldn't read file %s: %s \n", path,
+				   (error && error->message) ? error->message : "Unknown error");
+		if (error)
+			g_error_free(error);
 		g_free(path);
 		return list;
 	}
@@ -1955,8 +1957,10 @@
 	error = NULL;
 	if (!(utf8_string = g_convert(contents, -1, "UTF-8", "Cp1251", NULL, NULL, &error))) {
 		purple_debug_error("QIP logger",
-			"Couldn't convert file %s to UTF-8: %s\n", data->path, error->message);
-		g_error_free(error);
+			"Couldn't convert file %s to UTF-8: %s\n", data->path,
+				   (error && error->message) ? error->message : "Unknown error");
+		if (error)
+			g_error_free(error);
 		g_free(contents);
 		return g_strdup("");
 	}
@@ -2151,18 +2155,18 @@
 
 	/* Calculate default Messenger Plus! log directory. */
 #ifdef _WIN32
+	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PERSONAL);
 	if (folder) {
 		path = g_build_filename(folder, "My Chat Logs", NULL);
 		g_free(folder);
-	} else
-		path = g_strdup("");
+	}
 #else
 	path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT,
 	                        "Documents and Settings", g_get_user_name(),
 	                        "My Documents", "My Chat Logs", NULL);
 #endif
-	purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path);
+	purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path ? path : "");
 	g_free(path);
 
 
@@ -2171,18 +2175,18 @@
 
 	/* Calculate default MSN message history directory. */
 #ifdef _WIN32
+	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PERSONAL);
 	if (folder) {
 		path = g_build_filename(folder, "My Received Files", NULL);
 		g_free(folder);
-	} else
-		path = g_strdup("");
+	}
 #else
 	path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT,
 	                        "Documents and Settings", g_get_user_name(),
 	                        "My Documents", "My Received Files", NULL);
 #endif
-	purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path);
+	purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path ? path : "");
 	g_free(path);
 
 
@@ -2261,22 +2265,22 @@
 			g_key_file_free(key_file);
 		}
 #else /* !GLIB_CHECK_VERSION(2,6,0) */
-		gsize length;
 		gchar *contents = NULL;
 
 		purple_debug_info("Trillian talk.ini read",
-					"Reading %s\n", path);
-		if (!g_file_get_contents(path, &contents, &length, &error)) {
+				  "Reading %s\n", path);
+		if (!g_file_get_contents(path, &contents, NULL, &error)) {
 			purple_debug_error("Trillian talk.ini read",
-			                   "Error reading talk.ini\n");
+					   "Error reading talk.ini: %s\n",
+					   (error && error->message) ? error->message : "Unknown error");
 			if (error)
 				g_error_free(error);
-			g_free(path);
 		} else {
-			char *line = contents;
-			while (*contents) {
-				if (*contents == '\n') {
-					*contents = '\0';
+			char *cursor, *line;
+			line = cursor = contents;
+			while (*cursor) {
+				if (*cursor == '\n') {
+					*cursor = '\0';
 
 					/* XXX: This assumes the first Directory key is under [Logging]. */
 					if (purple_str_has_prefix(line, "Directory=")) {
@@ -2288,25 +2292,29 @@
 						found = TRUE;
 					}
 
-					contents++;
-					line = contents;
+					cursor++;
+					line = cursor;
 				} else
-					contents++;
+					cursor++;
 			}
-			g_free(path);
 			g_free(contents);
 		}
+		g_free(path);
 #endif /* !GTK_CHECK_VERSION(2,6,0) */
 	} /* path */
 
 	if (!found) {
+		path = NULL;
 		folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES);
 		if (folder) {
 			path = g_build_filename(folder, "Trillian", "users",
 			                        "default", "logs", NULL);
 			g_free(folder);
-		} else
-			path = g_strdup("");
+		}
+
+		purple_prefs_add_string(
+			"/plugins/core/log_reader/trillian/log_directory", path ? path : "");
+		g_free(path);
 	}
 #else /* !defined(_WIN32) */
 	/* TODO: At some point, this could attempt to parse talk.ini
@@ -2317,28 +2325,27 @@
 	path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT,
 	                        "Program Files", "Trillian", "users",
 	                        "default", "logs", NULL);
+	purple_prefs_add_string(
+		"/plugins/core/log_reader/trillian/log_directory", path);
+	g_free(path);
 #endif
 
-	/*XXX: Why do we even bother allocating it ? */
-	g_free(path);
-
-
 	/* Add QIP log directory preference. */
 	purple_prefs_add_none("/plugins/core/log_reader/qip");
 
 	/* Calculate default QIP log directory. */
 #ifdef _WIN32
+	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES);
 	if (folder) {
 		path = g_build_filename(folder, "QIP", "Users", NULL);
 		g_free(folder);
-	} else
-		path = g_strdup("");
+	}
 #else
 	path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT,
 	                        "Program Files", "QIP", "Users", NULL);
 #endif
-	purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path);
+	purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path ? path : "");
 	g_free(path);
 }
 
--- a/libpurple/plugins/ssl/ssl-nss.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Fri Oct 19 18:14:53 2007 +0000
@@ -386,6 +386,7 @@
 static GList *
 ssl_nss_peer_certs(PurpleSslConnection *gsc)
 {
+#if 0
 	PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc);
 	CERTCertificate *cert;
 /*
@@ -397,6 +398,10 @@
 	/* TODO: this is a blind guess */
 	cert = SSL_PeerCertificate(nss_data->fd);
 
+	if (cert)
+		CERT_DestroyCertificate(cert);
+#endif
+
 	
 
 	return NULL;
@@ -430,11 +435,12 @@
 			  filename);
 	
 	/* Load the raw data up */
-	g_return_val_if_fail(
-		g_file_get_contents(filename,
-				    &rawcert, &len,
-				    NULL ),
-		NULL);
+	if (!g_file_get_contents(filename,
+				 &rawcert, &len,
+				 NULL)) {
+		purple_debug_error("nss/x509", "Unable to read certificate file.\n");
+		return NULL;
+	}
 
 	/* Decode the certificate */
 	crt_dat = CERT_DecodeCertFromPackage(rawcert, len);
--- a/libpurple/protocols/bonjour/bonjour.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Fri Oct 19 18:14:53 2007 +0000
@@ -188,6 +188,8 @@
 	if (bonjour_group != NULL)
 		purple_blist_remove_group(bonjour_group);
 
+	g_free(bd);
+	connection->proto_data = NULL;
 }
 
 static const char *
@@ -581,7 +583,7 @@
 			fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL);
 	}
 
-	g_idle_add(_set_default_name_cb, fullname);
+	purple_timeout_add(0, _set_default_name_cb, fullname);
 
 	return NULL;
 }
--- a/libpurple/protocols/bonjour/parser.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/protocols/bonjour/parser.c	Fri Oct 19 18:14:53 2007 +0000
@@ -101,7 +101,7 @@
 		if(!xmlStrcmp(element_name, (xmlChar*) "stream")) {
 			/* Asynchronously close the conversation to prevent bonjour_parser_setup()
 			 * being called from within this context */
-			g_idle_add(_async_bonjour_jabber_stream_ended_cb, pb);
+			purple_timeout_add(0, _async_bonjour_jabber_stream_ended_cb, pb);
 		}
 		return;
 	}
--- a/libpurple/protocols/jabber/roster.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/protocols/jabber/roster.c	Fri Oct 19 18:14:53 2007 +0000
@@ -67,8 +67,10 @@
 	if(!groups) {
 		if(!buddies)
 			g2 = g_slist_append(g2, g_strdup(_("Buddies")));
-		else
+		else {
+			g_slist_free(buddies);
 			return;
+		}
 	}
 
 	my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
@@ -229,6 +231,11 @@
 			remove_purple_buddies(js, jid);
 		} else {
 			GSList *groups = NULL;
+
+			if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
+				if (!jabber_google_roster_incoming(js, item))
+					continue;
+
 			for(group = xmlnode_get_child(item, "group"); group; group = xmlnode_get_next_twin(group)) {
 				char *group_name;
 
@@ -237,10 +244,9 @@
 
 				if (g_slist_find_custom(groups, group_name, (GCompareFunc)purple_utf8_strcasecmp) == NULL)
 					groups = g_slist_append(groups, group_name);
+				else
+					g_free(group_name);
 			}
-			if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
-				if (!jabber_google_roster_incoming(js, item))
-					continue;
 			add_purple_buddies_to_groups(js, jid, name, groups);
 		}
 	}
@@ -263,6 +269,9 @@
 	JabberIq *iq;
 	xmlnode *query, *item, *group;
 
+	if(!(b = purple_find_buddy(js->gc->account, name)))
+		return;
+
 	if(grps) {
 		groups = grps;
 	} else {
@@ -277,9 +286,6 @@
 		}
 	}
 
-	if(!(b = purple_find_buddy(js->gc->account, name)))
-		return;
-
 	iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster");
 
 	query = xmlnode_get_child(iq->node, "query");
--- a/libpurple/tests/test_cipher.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/libpurple/tests/test_cipher.c	Fri Oct 19 18:14:53 2007 +0000
@@ -8,7 +8,6 @@
 #include "tests.h"
 
 #include "../cipher.h"
-#include "../signal.h"
 
 /******************************************************************************
  * MD4 Tests
--- a/pidgin/gtkblist.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/pidgin/gtkblist.c	Fri Oct 19 18:14:53 2007 +0000
@@ -5081,7 +5081,7 @@
 			   BUDDY_ICON_COLUMN, avatar,
 			   BUDDY_ICON_VISIBLE_COLUMN, biglist,
 			   EMBLEM_COLUMN, emblem,
-			   EMBLEM_VISIBLE_COLUMN, emblem,
+			   EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
 			   PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL),
 			   PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"),
 			   BGCOLOR_COLUMN, NULL,
@@ -5092,6 +5092,8 @@
 
 	g_free(mark);
 	g_free(idle);
+	if(emblem)
+		g_object_unref(emblem);
 	if(status)
 		g_object_unref(status);
 	if(avatar)
@@ -5260,6 +5262,8 @@
 				-1);
 
 		g_free(mark);
+		if(emblem)
+			g_object_unref(emblem);
 		if(status)
 			g_object_unref(status);
 		if(avatar)
--- a/pidgin/gtkconv.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/pidgin/gtkconv.c	Fri Oct 19 18:14:53 2007 +0000
@@ -2439,11 +2439,16 @@
 	gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), 
 			&(gtkconv->infopane_iter),
 			CONV_EMBLEM_COLUMN, emblem, -1);
+	if (emblem)
+		g_object_unref(emblem);
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) {
+		emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL);
 		gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
 			&(gtkconv->infopane_iter),
-			CONV_PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL), -1);
+			CONV_PROTOCOL_ICON_COLUMN, emblem, -1);
+		if (emblem)
+			g_object_unref(emblem);
 	}
 
 	/* XXX seanegan Why do I have to do this? */
@@ -4665,7 +4670,6 @@
 	g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
 #endif
 
-
 	rend = gtk_cell_renderer_pixbuf_new();
 	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
 	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_PROTOCOL_ICON_COLUMN, NULL);
--- a/pidgin/gtkutils.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/pidgin/gtkutils.c	Fri Oct 19 18:14:53 2007 +0000
@@ -111,19 +111,20 @@
 		desc = pango_font_description_from_string(font);
 	} else if (purple_running_gnome()) {
 		/* Use the GNOME "document" font, if applicable */
-		char *path, *font;
+		char *path;
 
 		if ((path = g_find_program_in_path("gconftool-2"))) {
+			char *font = NULL;
 			g_free(path);
-			if (!g_spawn_command_line_sync(
+			if (g_spawn_command_line_sync(
 					"gconftool-2 -g /desktop/gnome/interface/document_font_name",
-					&font, NULL, NULL, NULL))
-				return;
+					&font, NULL, NULL, NULL)) {
+				desc = pango_font_description_from_string(font);
+			}
+			g_free(font);
 		}
-		desc = pango_font_description_from_string(font);
-		g_free(font);
 	}
-	
+
 	if (desc) {
 		gtk_widget_modify_font(imhtml, desc);
 		pango_font_description_free(desc);
--- a/pidgin/win32/winpidgin.c	Fri Oct 19 18:10:30 2007 +0000
+++ b/pidgin/win32/winpidgin.c	Fri Oct 19 18:14:53 2007 +0000
@@ -545,7 +545,7 @@
 	if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) {
 		/* If stdout hasn't been redirected to a file, alloc a console
 		 *  (_istty() doesn't work for stuff using the GUI subsystem) */
-		if (_fileno(stdout) == -1) {
+		if (_fileno(stdout) == -1 || _fileno(stdout) == -2) {
 			LPFNATTACHCONSOLE MyAttachConsole = NULL;
 			if ((hmod = GetModuleHandle("kernel32.dll"))) {
 				MyAttachConsole =