changeset 32518:0087049160ad

merge of '081986627877141e126dc3bcd9b0ab5063e96e83' and 'c1fcac5fd1367b69d817021a3b50df463b53de0b'
author Paul Aurich <paul@darkrain42.org>
date Wed, 15 Feb 2012 22:27:43 +0000
parents 5e085a727f4e (current diff) de4e6af605a2 (diff)
children 13d06d60fc49
files
diffstat 9 files changed, 127 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 15 22:26:40 2012 +0000
+++ b/ChangeLog	Wed Feb 15 22:27:43 2012 +0000
@@ -1,5 +1,28 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.10.2 (02/22/2012):
+	General:
+	* Fix compilation when using binutils 2.22 and new GDK pixbuf. (#14799)
+
+	Pidgin:
+	* Add support for the GNOME3 Network dialog. (#13882)
+
+	libpurple:
+	* Support new connection states and signals for NetworkManager 0.9+.
+	  (Dan Williams) (#13859)
+
+	AIM and ICQ:
+	* Allow signing on with usernames containing periods and
+	  underscores. (#13500)
+	* Allow adding buddies containing periods and underscores. (#13500)
+
+	MSN:
+	* Fix possible crashes caused by not validating incoming messages as
+	  UTF-8. (Thijs Alkemade) (#14884)
+
+	Windows-Specific Changes:
+	* Fix compilation of the Bonjour protocol plugin. (#14802)
+
 version 2.10.1 (12/06/2011):
 	Finch:
 	* Fix compilation on OpenBSD.
--- a/configure.ac	Wed Feb 15 22:26:40 2012 +0000
+++ b/configure.ac	Wed Feb 15 22:27:43 2012 +0000
@@ -202,6 +202,12 @@
 dnl FreeBSD doesn't have libdl, dlopen is provided by libc
 AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
 
+dnl Haiku does not use libm for the math functions, they are part
+dnl of the C library
+AC_SEARCH_LIBS([ceil], [m], [], [
+  AC_MSG_ERROR([unable to find the floor() function])
+])
+
 AC_MSG_CHECKING(for fileno())
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <stdio.h>
--- a/libpurple/network.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/network.c	Wed Feb 15 22:27:43 2012 +0000
@@ -833,8 +833,20 @@
 			purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n");
 	}
 
-	if (nm_state == NM_STATE_UNKNOWN || nm_state == NM_STATE_CONNECTED)
-		return TRUE;
+	switch (nm_state)
+	{
+		case NM_STATE_UNKNOWN:
+#if NM_CHECK_VERSION(0,8,992)
+		case NM_STATE_CONNECTED_LOCAL:
+		case NM_STATE_CONNECTED_SITE:
+		case NM_STATE_CONNECTED_GLOBAL:
+#else
+		case NM_STATE_CONNECTED:
+#endif
+			return TRUE;
+		default:
+			break;
+	}
 
 	return FALSE;
 
@@ -1171,9 +1183,14 @@
 		                                     NM_DBUS_SERVICE,
 		                                     NM_DBUS_PATH,
 		                                     NM_DBUS_INTERFACE);
+		/* NM 0.6 signal */
 		dbus_g_proxy_add_signal(nm_proxy, "StateChange", G_TYPE_UINT, G_TYPE_INVALID);
 		dbus_g_proxy_connect_signal(nm_proxy, "StateChange",
 		                            G_CALLBACK(nm_state_change_cb), NULL, NULL);
+		/* NM 0.7 and later signal */
+		dbus_g_proxy_add_signal(nm_proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
+		dbus_g_proxy_connect_signal(nm_proxy, "StateChanged",
+		                            G_CALLBACK(nm_state_change_cb), NULL, NULL);
 
 		dbus_proxy = dbus_g_proxy_new_for_name(nm_conn,
 		                                       DBUS_SERVICE_DBUS,
@@ -1208,6 +1225,7 @@
 #ifdef HAVE_NETWORKMANAGER
 	if (nm_proxy) {
 		dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL);
+		dbus_g_proxy_disconnect_signal(nm_proxy, "StateChanged", G_CALLBACK(nm_state_change_cb), NULL);
 		g_object_unref(G_OBJECT(nm_proxy));
 	}
 	if (dbus_proxy) {
--- a/libpurple/protocols/msn/contact.h	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/protocols/msn/contact.h	Wed Feb 15 22:27:43 2012 +0000
@@ -62,7 +62,7 @@
 
 #define MSN_APPLICATION_ID "CFE80F9D-180F-4399-82AB-413F33A1FA11"
 
-#define MSN_CONTACT_SERVER	"omega.contacts.msn.com"
+#define MSN_CONTACT_SERVER	"local-bay.contacts.msn.com"
 
 /* Get Contact List */
 
--- a/libpurple/protocols/msn/oim.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/protocols/msn/oim.c	Wed Feb 15 22:27:43 2012 +0000
@@ -606,11 +606,12 @@
 	const char *date;
 	const char *from;
 	const char *boundary;
-	char *decode_msg = NULL;
+	char *decode_msg = NULL, *clean_msg = NULL;
 	gsize body_len;
 	char **tokens;
 	char *passport = NULL;
 	time_t stamp;
+	const char *charset = NULL;
 
 	message = msn_message_new(MSN_MSG_UNKNOWN);
 
@@ -638,6 +639,8 @@
 			type = msn_message_get_content_type(multipart);
 			if (type && !strcmp(type, "text/plain")) {
 				decode_msg = (char *)purple_base64_decode(multipart->body, &body_len);
+				charset = msn_message_get_charset(multipart);
+
 				msn_message_unref(multipart);
 				break;
 			}
@@ -654,6 +657,46 @@
 		}
 	} else {
 		decode_msg = (char *)purple_base64_decode(message->body, &body_len);
+		charset = msn_message_get_charset(message);
+	}
+
+	if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) {
+		clean_msg = g_convert(decode_msg, body_len, "UTF-8", charset, NULL, NULL, NULL);
+
+		if (!clean_msg) {
+			char *clean = purple_utf8_salvage(decode_msg);
+
+			purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s\n", charset, clean);
+
+			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. "
+			                              "Converting the encoding from %s to UTF-8 failed.)"),
+			                            clean, charset);
+			g_free(clean);
+		}
+
+		g_free(decode_msg);
+
+	} else if (!g_utf8_validate(decode_msg, body_len, NULL)) {
+		char *clean = purple_utf8_salvage(decode_msg);
+
+		purple_debug_error("msn", "Received an OIM message that is not UTF-8,"
+		                          " and no encoding specified: %s\n", clean);
+
+		if (charset) {
+			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
+			                              " The charset was %s, but it was not valid UTF-8.)"),
+			                            clean, charset);
+		} else {
+			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
+			                              " The charset was missing, but it was not valid UTF-8.)"),
+			                            clean);
+		}
+
+		g_free(clean);
+		g_free(decode_msg);
+
+	} else {
+		clean_msg = decode_msg;
 	}
 
 	from = msn_message_get_header_value(message, "X-OIM-originatingSource");
@@ -695,7 +738,7 @@
 	purple_debug_info("msn", "oim Date:{%s},passport{%s}\n",
 	                  date, passport);
 
-	serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0,
+	serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, clean_msg, 0,
 	            stamp);
 
 	/*Now get the oim message ID from the oim_list.
@@ -704,7 +747,7 @@
 	msn_oim_post_delete_msg(rdata);
 
 	g_free(passport);
-	g_free(decode_msg);
+	g_free(clean_msg);
 	msn_message_unref(message);
 }
 
--- a/libpurple/protocols/oscar/peer.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/protocols/oscar/peer.c	Wed Feb 15 22:27:43 2012 +0000
@@ -660,6 +660,7 @@
 	char *tmp;
 	FlapConnection *bos_conn;
 	const char *listener_ip;
+	const guchar *ip_atoi;
 	unsigned short listener_port;
 
 	conn = data;
@@ -694,11 +695,28 @@
 		listener_ip = purple_network_get_my_ip(bos_conn->gsc->fd);
 	else
 		listener_ip = purple_network_get_my_ip(bos_conn->fd);
+
+	ip_atoi = purple_network_ip_atoi(listener_ip);
+	if (ip_atoi == NULL) {
+		/* Could not convert IP to 4 byte array--weird, but this does
+		   happen for some users (#4829, Adium #15839).  Maybe they're
+		   connecting with IPv6...?  Maybe through a proxy? */
+		purple_debug_error("oscar", "Can't ask peer to connect to us "
+				"because purple_network_ip_atoi(%s) returned NULL. "
+				"fd=%d. is_ssl=%d\n",
+				listener_ip ? listener_ip : "(null)",
+				bos_conn->gsc ? bos_conn->gsc->fd : bos_conn->fd,
+				bos_conn->gsc ? 1 : 0);
+		peer_connection_trynext(conn);
+		return;
+	}
+
 	listener_port = purple_network_get_port_from_fd(conn->listenerfd);
+
 	if (conn->type == OSCAR_CAPABILITY_DIRECTIM)
 	{
 		aim_im_sendch2_odc_requestdirect(od,
-				conn->cookie, conn->bn, purple_network_ip_atoi(listener_ip),
+				conn->cookie, conn->bn, ip_atoi,
 				listener_port, ++conn->lastrequestnumber);
 
 		/* Print a message to a local conversation window */
@@ -710,15 +728,6 @@
 	}
 	else if (conn->type == OSCAR_CAPABILITY_SENDFILE)
 	{
-		const guchar *ip_atoi = purple_network_ip_atoi(listener_ip);
-		if (ip_atoi == NULL) {
-			purple_debug_error("oscar", "Cannot send file. atoi(%s) failed.\n"
-					"Other possibly useful information: fd = %d, port = %d\n",
-					listener_ip ? listener_ip : "(null!)", conn->listenerfd,
-					listener_port);
-			purple_xfer_cancel_local(conn->xfer);
-			return;
-		}
 		aim_im_sendch2_sendfile_requestdirect(od,
 				conn->cookie, conn->bn,
 				ip_atoi,
--- a/libpurple/protocols/oscar/util.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/protocols/oscar/util.c	Wed Feb 15 22:27:43 2012 +0000
@@ -141,12 +141,12 @@
 	if (purple_email_is_valid(name))
 		return TRUE;
 
-	/* Normal AIM usernames can't start with a number */
-	if (isdigit(name[0]))
+	/* Normal AIM usernames can't start with a number, period or underscore */
+	if (isalnum(name[0]) == 0)
 		return FALSE;
 
 	for (i = 0; name[i] != '\0'; i++) {
-		if (!isalnum(name[i]) && (name[i] != ' '))
+		if (!isalnum(name[i]) && name[i] != ' ' && name[i] != '.' && name[i] != '_')
 			return FALSE;
 	}
 
--- a/libpurple/proxy.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/libpurple/proxy.c	Wed Feb 15 22:27:43 2012 +0000
@@ -2404,7 +2404,7 @@
 						  PurpleProxyConnectFunction connect_cb,
 						  gpointer data)
 {
-	return purple_proxy_connect_socks5_account(NULL, handle, gpi,
+	return purple_proxy_connect_socks5_account(handle, NULL, gpi,
 						  host, port, connect_cb, data);
 }
 
--- a/pidgin/gtkprefs.c	Wed Feb 15 22:26:40 2012 +0000
+++ b/pidgin/gtkprefs.c	Wed Feb 15 22:27:43 2012 +0000
@@ -2036,6 +2036,14 @@
 		path = g_find_program_in_path("gnome-network-properties");
 		if (path == NULL)
 			path = g_find_program_in_path("gnome-network-preferences");
+		if (path == NULL) {
+			path = g_find_program_in_path("gnome-control-center");
+			if (path != NULL) {
+				char *tmp = g_strdup_printf("%s network", path);
+				g_free(path);
+				path = tmp;
+			}
+		}
 
 		if (path == NULL) {
 			label = gtk_label_new(NULL);