changeset 28103:268b821de5c5

merge of '18135201f43ac87c932feae03881d46e30d93030' and '5e877772051b0cfb57b3eda07a70bb59562d0111'
author maiku@pidgin.im
date Thu, 27 Aug 2009 05:58:57 +0000
parents 18e361e0a3ec (diff) 7a66b8d66456 (current diff)
children f628e98e6dff 4bbf24889934 cbc06e756ead 1da2ea10c2d0
files
diffstat 8 files changed, 60 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 27 05:57:49 2009 +0000
+++ b/ChangeLog	Thu Aug 27 05:58:57 2009 +0000
@@ -5,7 +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.
+	* Fix using GNOME proxy settings properly.  (Erik van Pienbroek)
 
 	XMPP:
 	* Prompt the user before cancelling a presence subscription.
@@ -13,6 +13,7 @@
 	* 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)
--- a/libpurple/protocols/jabber/auth.c	Thu Aug 27 05:57:49 2009 +0000
+++ b/libpurple/protocols/jabber/auth.c	Thu Aug 27 05:58:57 2009 +0000
@@ -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	Thu Aug 27 05:57:49 2009 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Thu Aug 27 05:58:57 2009 +0000
@@ -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/jabber.c	Thu Aug 27 05:57:49 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Thu Aug 27 05:58:57 2009 +0000
@@ -1605,13 +1605,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	Thu Aug 27 05:57:49 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Thu Aug 27 05:58:57 2009 +0000
@@ -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	Thu Aug 27 05:57:49 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Aug 27 05:58:57 2009 +0000
@@ -2405,6 +2405,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/pidgin/gtkblist.c	Thu Aug 27 05:57:49 2009 +0000
+++ b/pidgin/gtkblist.c	Thu Aug 27 05:58:57 2009 +0000
@@ -496,12 +496,17 @@
 	for (tmp = merges; tmp; tmp = tmp->next) {
 		PurpleBlistNode *node = tmp->data;
 		PurpleBlistNode *b;
+		PurpleBlistNodeType type;
 		int i = 0;
 
-		if (purple_blist_node_get_type(node) == PURPLE_BLIST_BUDDY_NODE)
+		type = purple_blist_node_get_type(node);
+
+		if (type == PURPLE_BLIST_BUDDY_NODE) {
 			node = purple_blist_node_get_parent(node);
-
-		if (purple_blist_node_get_type(node) != 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/win32/nsis/pidgin-installer.nsi	Thu Aug 27 05:57:49 2009 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Thu Aug 27 05:58:57 2009 +0000
@@ -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}"