changeset 28452:336d03cdced6

merged with im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 27 Aug 2009 02:37:46 +0900
parents 4a2adf413aaa (current diff) 18e361e0a3ec (diff)
children b4cbcb427e7d
files libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jabber.c libpurple/protocols/oscar/oscar.c libpurple/protocols/yahoo/libymsg.c pidgin/gtkblist.c
diffstat 14 files changed, 93 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 24 17:20:46 2009 +0900
+++ b/ChangeLog	Thu Aug 27 02:37:46 2009 +0900
@@ -5,6 +5,7 @@
 	* Fix --disable-avahi to actually disable it in configure, as opposed
 	  to just making the warning non-fatal.
 	* Sending custom smileys in MSN chats is now supported.
+	* Fix using GNOME proxy settings properly.  (Erik van Pienbroek)
 
 	XMPP:
 	* Prompt the user before cancelling a presence subscription.
@@ -12,10 +13,14 @@
 	* Fix connecting to XMPP domains with no SRV records from Pidgin on
 	  Windows.
 	* Fix typing notifications with Pidgin 2.5.9 or earlier.
+	* Fix connecting using BOSH and legacy authentication (XEP-0078).
 
 	Finch:
 	* Properly detect libpanel on OpenBSD.  (Brad Smith)
 
+	Pidgin:
+	* Fix the auto-personize functionality in the Buddy List.
+
 version 2.6.1 (08/18/2009):
 	* Fix a crash when some users send you a link in a Yahoo IM
 	* Fix compilation with GTK+ < 2.6.0
--- a/libpurple/account.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/account.c	Thu Aug 27 02:37:46 2009 +0900
@@ -1206,11 +1206,14 @@
 purple_account_disconnect(PurpleAccount *account)
 {
 	PurpleConnection *gc;
+	const char *username;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(!purple_account_is_disconnected(account));
 
-	purple_debug_info("account", "Disconnecting account %p\n", account);
+	username = purple_account_get_username(account);
+	purple_debug_info("account", "Disconnecting account %s (%p)\n",
+	                  username ? username : "(null)", account);
 
 	account->disconnecting = TRUE;
 
--- a/libpurple/media.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/media.c	Thu Aug 27 02:37:46 2009 +0900
@@ -2134,7 +2134,7 @@
 			GstElement *lastElement = NULL;
 			while (!GST_IS_PIPELINE(element)) {
 				if (element == media->priv->confbin) {
-					purple_media_error("media", _("Conference error."));
+					purple_media_error(media, _("Conference error."));
 					purple_media_end(media, NULL, NULL);
 					break;
 				}
--- a/libpurple/protocols/jabber/auth.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/jabber/auth.c	Thu Aug 27 02:37:46 2009 +0900
@@ -575,6 +575,7 @@
                                xmlnode *packet, gpointer data)
 {
 	if (type == JABBER_IQ_RESULT) {
+		jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH);
 		jabber_disco_items_server(js);
 	} else {
 		PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
@@ -1072,7 +1073,12 @@
 	}
 #endif
 
-	jabber_stream_set_state(js, JABBER_STREAM_REINITIALIZING);
+	/*
+	 * The stream will be reinitialized later in jabber_recv_cb_ssl() or
+	 * jabber_bosh_connection_send.
+	 */
+	js->reinit = TRUE;
+	jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH);
 }
 
 void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet)
--- a/libpurple/protocols/jabber/bosh.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/jabber/bosh.c	Thu Aug 27 02:37:46 2009 +0900
@@ -70,7 +70,6 @@
 
 	gboolean pipelining;
 	gboolean ssl;
-	gboolean needs_restart;
 
 	enum {
 		BOSH_CONN_OFFLINE,
@@ -197,7 +196,6 @@
 	conn->path = g_strdup_printf("/%s", path);
 	g_free(path);
 	conn->pipelining = TRUE;
-	conn->needs_restart = FALSE;
 
 	if ((user && user[0] != '\0') || (passwd && passwd[0] != '\0')) {
 		purple_debug_info("jabber", "Ignoring unexpected username and password "
@@ -377,10 +375,10 @@
 	                conn->sid,
 	                conn->js->user->domain);
 
-	if (conn->needs_restart) {
+	if (conn->js->reinit) {
 		packet = g_string_append(packet, " xmpp:restart='true'/>");
 		/* TODO: Do we need to wait for a response? */
-		conn->needs_restart = FALSE;
+		conn->js->reinit = FALSE;
 	} else {
 		gsize read_amt;
 		if (type == PACKET_TERMINATE)
@@ -406,12 +404,6 @@
 	jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL);
 }
 
-static void jabber_bosh_connection_stream_restart(PurpleBOSHConnection *conn)
-{
-	conn->needs_restart = TRUE;
-	jabber_bosh_connection_send(conn, PACKET_NORMAL, NULL);
-}
-
 static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) {
 	const char *type;
 
@@ -490,35 +482,8 @@
 	}
 }
 
-static void auth_response_cb(PurpleBOSHConnection *conn, xmlnode *node) {
-	xmlnode *child;
-
-	g_return_if_fail(node != NULL);
-	if (jabber_bosh_connection_error_check(conn, node))
-		return;
-
-	child = node->child;
-	while(child != NULL && child->type != XMLNODE_TYPE_TAG) {
-		child = child->next;
-	}
-
-	/* We're only expecting one XML node here, so only process the first one */
-	if (child != NULL && child->type == XMLNODE_TYPE_TAG) {
-		JabberStream *js = conn->js;
-		if (!strcmp(child->name, "success")) {
-			jabber_bosh_connection_stream_restart(conn);
-			jabber_process_packet(js, &child);
-			conn->receive_cb = jabber_bosh_connection_received;
-		} else {
-			js->state = JABBER_STREAM_AUTHENTICATING;
-			jabber_process_packet(js, &child);
-		}
-	} else {
-		purple_debug_warning("jabber", "Received unexepcted empty BOSH packet.\n");
-	}
-}
-
 static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) {
+	JabberStream *js = conn->js;
 	const char *sid, *version;
 	const char *inactivity, *requests;
 	xmlnode *packet;
@@ -536,7 +501,7 @@
 	if (sid) {
 		conn->sid = g_strdup(sid);
 	} else {
-		purple_connection_error_reason(conn->js->gc,
+		purple_connection_error_reason(js->gc,
 		        PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 		        _("No session ID given"));
 		return;
@@ -553,7 +518,7 @@
 			minor = atoi(dot + 1);
 
 		if (major != 1 || minor < 6) {
-			purple_connection_error_reason(conn->js->gc,
+			purple_connection_error_reason(js->gc,
 			        PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			        _("Unsupported version of BOSH protocol"));
 			return;
@@ -583,11 +548,13 @@
 	if (requests)
 		conn->max_requests = atoi(requests);
 
+	jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
+
 	/* FIXME: Depending on receiving features might break with some hosts */
 	packet = xmlnode_get_child(node, "features");
 	conn->state = BOSH_CONN_ONLINE;
-	conn->receive_cb = auth_response_cb;
-	jabber_stream_features_parse(conn->js, packet);
+	conn->receive_cb = jabber_bosh_connection_received;
+	jabber_stream_features_parse(js, packet);
 }
 
 static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) {
@@ -663,8 +630,8 @@
 	conn->headers_done = FALSE;
 	conn->handled_len = conn->body_len = 0;
 
-	if (conn->bosh->needs_restart)
-		jabber_bosh_connection_stream_restart(conn->bosh);
+	if (conn->bosh->js->reinit)
+		jabber_bosh_connection_send(conn->bosh, PACKET_NORMAL, NULL);
 	else if (conn->bosh->state == BOSH_CONN_ONLINE) {
 		purple_debug_info("jabber", "BOSH session already exists. Trying to reuse it.\n");
 		if (conn->bosh->requests == 0 || conn->bosh->pending->bufused > 0) {
--- a/libpurple/protocols/jabber/google.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/jabber/google.c	Thu Aug 27 02:37:46 2009 +0900
@@ -297,6 +297,9 @@
 		gchar *sid, gchar *name, gboolean local,
 		GoogleSession *session)
 {
+	if (sid != NULL || name != NULL)
+		return;
+
 	if (type == PURPLE_MEDIA_INFO_HANGUP) {
 		xmlnode *sess;
 		JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
@@ -315,6 +318,8 @@
 		xmlnode_insert_child(iq->node, sess);
 
 		jabber_iq_send(iq);
+	} else if (type == PURPLE_MEDIA_INFO_ACCEPT && local == TRUE) {
+		google_session_ready(session);
 	}
 }
 
--- a/libpurple/protocols/jabber/jabber.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/jabber/jabber.c	Thu Aug 27 02:37:46 2009 +0900
@@ -1607,13 +1607,10 @@
 				jabber_auth_start_old(js);
 			}
 			break;
-		case JABBER_STREAM_REINITIALIZING:
+		case JABBER_STREAM_POST_AUTH:
 			purple_connection_update_progress(js->gc, _("Re-initializing Stream"),
 					(js->gsc ? 8 : 4), JABBER_CONNECT_STEPS);
 
-			/* The stream will be reinitialized later, in jabber_recv_cb_ssl() */
-			js->reinit = TRUE;
-
 			break;
 		case JABBER_STREAM_CONNECTED:
 			/* Send initial presence */
--- a/libpurple/protocols/jabber/jabber.h	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/jabber/jabber.h	Thu Aug 27 02:37:46 2009 +0900
@@ -87,7 +87,7 @@
 	JABBER_STREAM_INITIALIZING,
 	JABBER_STREAM_INITIALIZING_ENCRYPTION,
 	JABBER_STREAM_AUTHENTICATING,
-	JABBER_STREAM_REINITIALIZING,
+	JABBER_STREAM_POST_AUTH,
 	JABBER_STREAM_CONNECTED
 } JabberStreamState;
 
--- a/libpurple/protocols/oscar/oscar.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/oscar/oscar.c	Thu Aug 27 02:37:46 2009 +0900
@@ -2435,6 +2435,21 @@
 	if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
 	{
 		const char *ichattextcolor, *ichatballooncolor;
+		const char *start2, *end2;
+		GData *unused;
+
+		/*
+		 * Find the ending </body> so we can strip off the outer <html/>
+		 * and <body/>
+		 */
+		if (purple_markup_find_tag("/body", end + 1, &start2, &end2, &unused))
+		{
+			gchar *tmp2;
+			tmp2 = g_strndup(end + 1, (start2 - 1) - (end + 1) + 1);
+			g_free(tmp);
+			tmp = tmp2;
+			g_datalist_clear(&unused);
+		}
 
 		ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor");
 		if (ichattextcolor != NULL)
--- a/libpurple/protocols/yahoo/libymsg.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/protocols/yahoo/libymsg.c	Thu Aug 27 02:37:46 2009 +0900
@@ -4431,7 +4431,7 @@
 		else
 			yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
 	                  14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
-	                  5, who+4, 1002, "1");
+	                  5, who, 1002, "1");
 		yahoo_packet_send_and_free(pkt, yd);
 	}
 
@@ -4781,6 +4781,7 @@
 void yahoo_add_deny(PurpleConnection *gc, const char *who) {
 	YahooData *yd = (YahooData *)gc->proto_data;
 	struct yahoo_packet *pkt;
+	gboolean msn = FALSE;
 
 	if (!yd->logged_in)
 		return;
@@ -4788,15 +4789,21 @@
 	if (!who || who[0] == '\0')
 		return;
 
+	msn = !g_ascii_strncasecmp(who, "msn/", 4);
 	pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
-	yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
-	                  7, who, 13, "1");
+
+	if(msn)
+		yahoo_packet_hash(pkt, "ssss", 1, purple_connection_get_display_name(gc), 7, who+4, 241, "2", 13, "1");
+	else
+		yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "1");
+
 	yahoo_packet_send_and_free(pkt, yd);
 }
 
 void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
 	YahooData *yd = (YahooData *)gc->proto_data;
 	struct yahoo_packet *pkt;
+	gboolean msn = FALSE;
 
 	if (!yd->logged_in)
 		return;
@@ -4804,8 +4811,14 @@
 	if (!who || who[0] == '\0')
 		return;
 
+	msn = !g_ascii_strncasecmp(who, "msn/", 4);
 	pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
-	yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2");
+
+	if(msn)
+		yahoo_packet_hash(pkt, "ssss", 1, purple_connection_get_display_name(gc), 7, who+4, 241, "2", 13, "2");
+	else
+		yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2");
+	
 	yahoo_packet_send_and_free(pkt, yd);
 }
 
--- a/libpurple/proxy.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/libpurple/proxy.c	Thu Aug 27 02:37:46 2009 +0900
@@ -245,7 +245,7 @@
 		return &info;
 	}
 
-	if (purple_strequal(tmp, "manual\n")) {
+	if (!purple_strequal(tmp, "manual\n")) {
 		/* Unknown setting.  Fallback to using our global proxy settings. */
 		g_free(tmp);
 		return purple_global_proxy_get_info();
--- a/pidgin/gtkblist.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/pidgin/gtkblist.c	Thu Aug 27 02:37:46 2009 +0900
@@ -506,10 +506,12 @@
 
 		type = purple_blist_node_get_type(node);
 
-		if(type == PURPLE_BLIST_BUDDY_NODE)
+		if (type == PURPLE_BLIST_BUDDY_NODE) {
 			node = purple_blist_node_get_parent(node);
-
-		if(type == PURPLE_BLIST_CONTACT_NODE)
+			type = purple_blist_node_get_type(node);
+		}
+
+		if (type != PURPLE_BLIST_CONTACT_NODE)
 			continue;
 
 		for (b = purple_blist_node_get_first_child(node);
--- a/pidgin/gtkdialogs.c	Mon Aug 24 17:20:46 2009 +0900
+++ b/pidgin/gtkdialogs.c	Thu Aug 27 02:37:46 2009 +0900
@@ -476,9 +476,11 @@
 				" <A HREF=\"http://pidgin.im/cgi-bin/mailman/listinfo/support\">"
 				"mailing list</A>, and messages sent here are"
 				" <A HREF=\"http://pidgin.im/pipermail/support/\">publicly"
-				" archived!</A>  Furthermore, we do <I><B>not</B></I> support"
-				" MXit, Facebook, Skype, or any other third-party plugins on"
-				" this list.)<BR/><BR/>"));
+				" archived!</A>  Please note that this list's primary language"
+				" is English.  Posts in other languages may not receive answers"
+				" as complete or as helpful as those in English. Additionally,"
+				" we do <U><I><B>not</B></I></U> support MXit, Facebook, Skype,"
+				" or any other third-party plugins on this list.)<BR/><BR/>"));
 	g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC Channel:</FONT> "
 				"#pidgin on irc.freenode.net<BR><BR>"));
 	g_string_append_printf(str, _("<FONT SIZE=\"4\">XMPP MUC:</FONT> "
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Mon Aug 24 17:20:46 2009 +0900
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Thu Aug 27 02:37:46 2009 +0900
@@ -12,6 +12,7 @@
 Var ISSILENT
 Var STARTUP_RUN_KEY
 Var SPELLCHECK_SEL
+Var LANGUAGE_SET
 
 ;--------------------------------
 ;Configuration
@@ -74,7 +75,7 @@
 !define PERL_REG_KEY				"SOFTWARE\Perl"
 !define PERL_DLL				"perl510.dll"
 !define GTK_DEFAULT_INSTALL_PATH		"$COMMONFILES\GTK\2.0"
-!define GTK_RUNTIME_INSTALLER			"..\..\..\..\gtk_installer\gtk-runtime*.exe"
+!define GTK_RUNTIME_INSTALLER			"..\..\..\..\gtk_installer\gtk-runtime-${GTK_INSTALL_VERSION}*.exe"
 
 !define ASPELL_REG_KEY				"SOFTWARE\Aspell"
 !define DOWNLOADER_URL				"http://pidgin.im/win32/download_redir.php"
@@ -1341,10 +1342,12 @@
   IfSilent 0 +2
     StrCpy $ISSILENT "/NOUI"
 
+  StrCpy $LANGUAGE_SET "0"
   ClearErrors
   ${GetOptions} "$R3" "/L=" $R1
   IfErrors +3
   StrCpy $LANGUAGE $R1
+  StrCpy $LANGUAGE_SET "1"
   Goto skip_lang
 
   ; Select Language
@@ -1407,6 +1410,17 @@
   Pop $R0
 FunctionEnd
 
+Function .onInstSuccess
+  ; NSIS doesn't appear to save the language when in Silent Mode, so we do so manually
+  IfSilent 0 done
+
+  StrCmp $LANGUAGE_SET "0" done
+
+  WriteRegStr "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" $LANGUAGE
+
+  done:
+FunctionEnd
+
 Function un.onInit
   Call un.RunCheck
   StrCpy $name "Pidgin ${PIDGIN_VERSION}"