changeset 18034:2a6fb7c6d030

propagate from branch 'im.pidgin.pidgin' (head 850e223e9597fdc482eebe75c00efda941b3bdb6) to branch 'im.pidgin.pidgin.2.1.0' (head 58a185e9b6801483bd8d4441fcf9e017a0a709d0)
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 03 Jun 2007 00:48:00 +0000
parents c3eb94e69ae7 (current diff) 98f27c7f0ef5 (diff)
children c168d1ae2012
files libpurple/conversation.c pidgin/gtkaccount.c pidgin/gtkutils.c pidgin/plugins/xmppconsole.c
diffstat 14 files changed, 117 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/conversation.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/conversation.c	Sun Jun 03 00:48:00 2007 +0000
@@ -1970,7 +1970,7 @@
 
 	for (l = purple_conv_chat_get_users(chat); l; l = l->next) {
 		cb = l->data;
-		if (!purple_utf8_strcasecmp(cb->name, name))
+		if (!g_utf8_collate(cb->name, name))
 			return cb;
 	}
 
--- a/libpurple/protocols/Makefile.am	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/Makefile.am	Sun Jun 03 00:48:00 2007 +0000
@@ -1,4 +1,4 @@
-EXTRA_DIST = Makefile.mingw null/
+EXTRA_DIST = Makefile.mingw
 
 DIST_SUBDIRS = bonjour gg irc jabber msn novell null oscar qq sametime silc toc simple yahoo zephyr
 
--- a/libpurple/protocols/msn/msn.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Jun 03 00:48:00 2007 +0000
@@ -1423,6 +1423,22 @@
 	if (found) \
 		sect_info = TRUE;
 
+#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \
+	found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \
+			"\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \
+	if (found) \
+		sect_info = TRUE;
+
+static char *
+msn_info_strip_search_link(const char *field, size_t len)
+{
+	const char *c;
+	if ((c = strstr(field, " (http://spaces.live.com/default.aspx?page=searchresults")) == NULL &&
+		(c = strstr(field, " (http://spaces.msn.com/default.aspx?page=searchresults")) == NULL)
+		return g_strndup(field, len);
+	return g_strndup(field, c - field);
+}
+
 static void
 msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data,
 		const gchar *url_text, size_t len, const gchar *error_message)
@@ -1538,10 +1554,10 @@
 	
 	/* General */
 	MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname"));
-	MSN_GOT_INFO_GET_FIELD("Age", _("Age"));
-	MSN_GOT_INFO_GET_FIELD("Gender", _("Gender"));
-	MSN_GOT_INFO_GET_FIELD("Occupation", _("Occupation"));
-	MSN_GOT_INFO_GET_FIELD("Location", _("Location"));
+	MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age"));
+	MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Gender", _("Gender"));
+	MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Occupation", _("Occupation"));
+	MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Location", _("Location"));
 
 	/* Extract their Interests and put it in */
 	found = purple_markup_extract_info_field(stripped, stripped_len, user_info,
@@ -1802,7 +1818,10 @@
 		/* This doesn't work with the new spaces profiles - Stu 3/2/06
 		char *p = strstr(url_buffer, "Unknown Member </TITLE>");
 		 * This might not work for long either ... */
+		/* Nope, it failed some time before 5/2/07 :(
 		char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\"");
+		 * Let's see how long this one holds out for ... */
+		char *p = strstr(url_buffer, "<form id=\"profile_form\" name=\"profile_form\" action=\"http&#58;&#47;&#47;spaces.live.com&#47;profile.aspx&#63;cid&#61;0\"");
 		PurpleBuddy *b = purple_find_buddy
 				(purple_connection_get_account(info_data->gc), info_data->name);
 		purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"),
--- a/libpurple/protocols/msn/msn.h	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/msn.h	Sun Jun 03 00:48:00 2007 +0000
@@ -67,7 +67,7 @@
 
 #define HOTMAIL_URL "http://www.hotmail.com/cgi-bin/folders"
 #define PASSPORT_URL "http://lc1.law13.hotmail.passport.com/cgi-bin/dologin?login="
-#define PROFILE_URL "http://spaces.msn.com/profile.aspx?mem="
+#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem="
 
 #define USEROPT_HOTMAIL 0
 
--- a/libpurple/protocols/msn/nexus.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/nexus.c	Sun Jun 03 00:48:00 2007 +0000
@@ -247,6 +247,8 @@
 				temp = g_strndup(error, c - error);
 				error = purple_url_decode(temp);
 				g_free(temp);
+				if ((temp = strstr(error, " Do one of the following or try again:")) != NULL)
+					*temp = '\0';
 			}
 		}
 
--- a/libpurple/protocols/msn/session.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/session.c	Sun Jun 03 00:48:00 2007 +0000
@@ -316,6 +316,7 @@
 							 "temporarily."));
 			break;
 		case MSN_ERROR_AUTH:
+			gc->wants_to_die = TRUE;
 			msg = g_strdup_printf(_("Unable to authenticate: %s"),
 								  (info == NULL ) ?
 								  _("Unknown error") : info);
--- a/libpurple/protocols/msn/switchboard.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sun Jun 03 00:48:00 2007 +0000
@@ -419,7 +419,14 @@
 				case MSN_SB_ERROR_TOO_FAST:
 					str_reason = _("Message could not be sent "
 								   "because we are sending too quickly:");
-					break;					
+					break;
+				case MSN_SB_ERROR_AUTHFAILED:
+					str_reason = _("Message could not be sent "
+								   "because we wer unable to establish a "
+								   "session with the server. This is "
+								   "likely a server problem, try again in "
+								   "a few minutes:");
+					break;
 				default:
 					str_reason = _("Message could not be sent "
 								   "because an error with "
@@ -963,9 +970,13 @@
  * Connect stuff
  **************************************************************************/
 static void
+ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error);
+
+static void
 connect_cb(MsnServConn *servconn)
 {
 	MsnSwitchBoard *swboard;
+	MsnTransaction *trans;
 	MsnCmdProc *cmdproc;
 	PurpleAccount *account;
 
@@ -980,16 +991,44 @@
 	{
 		swboard->empty = FALSE;
 
-		msn_cmdproc_send(cmdproc, "ANS", "%s %s %s",
-						 purple_account_get_username(account),
-						 swboard->auth_key, swboard->session_id);
+		trans = msn_transaction_new(cmdproc, "ANS", "%s %s %s",
+									purple_account_get_username(account),
+									swboard->auth_key, swboard->session_id);
 	}
 	else
 	{
-		msn_cmdproc_send(cmdproc, "USR", "%s %s",
-						 purple_account_get_username(account),
-						 swboard->auth_key);
+		trans = msn_transaction_new(cmdproc, "USR", "%s %s",
+									purple_account_get_username(account),
+									swboard->auth_key);
 	}
+
+	msn_transaction_set_error_cb(trans, ans_usr_error);
+	msn_transaction_set_data(trans, swboard);
+	msn_cmdproc_send_trans(cmdproc, trans);
+}
+
+static void
+ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
+{
+	MsnSwitchBoard *swboard;
+	char **params;
+	char *passport;
+	int reason = MSN_SB_ERROR_UNKNOWN;
+
+	if (error == 911)
+	{
+		reason = MSN_SB_ERROR_AUTHFAILED;
+	}
+
+	purple_debug_warning("msn", "ans_usr_error: command %s gave error %i\n", trans->command, error);
+
+	params = g_strsplit(trans->params, " ", 0);
+	passport = params[0];
+	swboard = trans->data;
+
+	swboard_error_helper(swboard, reason, passport);
+
+	g_strfreev(params);
 }
 
 static void
--- a/libpurple/protocols/msn/switchboard.h	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/msn/switchboard.h	Sun Jun 03 00:48:00 2007 +0000
@@ -46,6 +46,7 @@
 	MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */
 	MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */
 	MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */
+	MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */
 	MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */
 
 } MsnSBErrorType;
--- a/libpurple/protocols/null/nullprpl.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/libpurple/protocols/null/nullprpl.c	Sun Jun 03 00:48:00 2007 +0000
@@ -432,7 +432,7 @@
                     from_username, who, message);
 
   /* is the sender blocked by the recipient's privacy settings? */
-  if (!purple_privacy_check(to_acct, gc->account->username)) {
+  if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) {
     char *msg = g_strdup_printf(
       _("Your message was blocked by %s's privacy settings."), who);
     purple_debug_info("nullprpl",
--- a/pidgin/gtkaccount.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/pidgin/gtkaccount.c	Sun Jun 03 00:48:00 2007 +0000
@@ -433,7 +433,9 @@
 
 	/* Screen name */
 	dialog->screenname_entry = gtk_entry_new();
+#if GTK_CHECK_VERSION(2,10,0)
 	g_object_set(G_OBJECT(dialog->screenname_entry), "truncate-multiline", TRUE, NULL);
+#endif
 
 	add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry);
 
--- a/pidgin/gtkimhtmltoolbar.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Sun Jun 03 00:48:00 2007 +0000
@@ -857,19 +857,19 @@
  * Copyright (C) 2003 Ricardo Fernandez Pascual
  * Copyright (C) 2004 Paolo Borelli
  */
+static void
 menu_position_func (GtkMenu           *menu,
                     int               *x,
                     int               *y,
                     gboolean          *push_in,
-                    GtkWidget         *widget)
+                    gpointer data)
 {
-  GtkRequisition req;
   GtkRequisition menu_req;
-  GtkOrientation orientation;
   GtkTextDirection direction;
   GdkRectangle monitor;
   gint monitor_num;
   GdkScreen *screen;
+  GtkWidget *widget = data;
 
   gtk_widget_size_request (GTK_WIDGET (widget), &menu_req);
 
@@ -902,7 +902,7 @@
 }
 
 static void pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu) {
-	gtk_widget_show_all(menu);
+	gtk_widget_show_all(GTK_WIDGET(menu));
 	gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time());
 }
 
@@ -1070,43 +1070,43 @@
 	gtk_widget_show_all(font_button);
 
 	font_menu = gtk_menu_new();
-	
+
 	button = gtk_check_menu_item_new_with_mnemonic(_("_Bold"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->bold);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_check_menu_item_new_with_mnemonic(_("_Italic"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->italic);
-	gtk_menu_shell_append(font_menu, button);
-	
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
+
 	button = gtk_check_menu_item_new_with_mnemonic(_("_Underline"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->underline);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Larger"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->larger_size);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Normal"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->normal_size);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Smaller"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smaller_size);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Font face"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->font);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Foreground color"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->fgcolor);
-	gtk_menu_shell_append(font_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Background color"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->bgcolor);
-	gtk_menu_shell_append(font_menu, button);
-	
+	gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), button);
+
 	g_signal_connect(G_OBJECT(font_button), "clicked", G_CALLBACK(pidgin_menu_clicked), font_menu);
 	g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button);	
 
@@ -1148,21 +1148,21 @@
 	gtk_widget_show_all(insert_button);
 
 	insert_menu = gtk_menu_new();
-	
+
 	button = gtk_menu_item_new_with_mnemonic(_("_Smiley"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smiley);
-	gtk_menu_shell_append(insert_menu, button);
-	
+	gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button);
+
 	button = gtk_menu_item_new_with_mnemonic(_("_Image"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image);
-	gtk_menu_shell_append(insert_menu, button);
+	gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button);
 
 	button = gtk_menu_item_new_with_mnemonic(_("_Link"));
 	g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link);
-	gtk_menu_shell_append(insert_menu, button);
-	
+	gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), button);
+
 	g_signal_connect(G_OBJECT(insert_button), "clicked", G_CALLBACK(pidgin_menu_clicked), insert_menu);
-	g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button);	
+	g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button);
 	toolbar->sml = NULL;
 }
 
--- a/pidgin/gtkthemes.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/pidgin/gtkthemes.c	Sun Jun 03 00:48:00 2007 +0000
@@ -146,6 +146,9 @@
 				list->next = child;
 			else
 				theme->list = child;
+			/* Reverse the Smiley list since it was built in reverse order for efficiency reasons */
+			if (list != NULL)
+				list->smileys = g_slist_reverse(list->smileys);
 			list = child;
 		} else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) {
 			int len;
@@ -201,14 +204,16 @@
 
 			}
 
-			/* Reverse the Smiley list since it was built in reverse order for efficiency reasons */
-			list->smileys = g_slist_reverse(list->smileys);
 
 			if (!have_used_sfile)
 				g_free(sfile);
 		}
 	}
 
+	/* Reverse the Smiley list since it was built in reverse order for efficiency reasons */
+	if (list != NULL)
+		list->smileys = g_slist_reverse(list->smileys);
+
 	g_free(dirname);
 	fclose(f);
 
--- a/pidgin/gtkutils.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/pidgin/gtkutils.c	Sun Jun 03 00:48:00 2007 +0000
@@ -628,6 +628,7 @@
 				g_object_unref(pixbuf);
 
 			gtalk_name = NULL;
+			i++;
 		}
 
 		pixbuf = get_prpl_pixbuf(prpl_info);
--- a/pidgin/plugins/xmppconsole.c	Sat Jun 02 18:12:35 2007 +0000
+++ b/pidgin/plugins/xmppconsole.c	Sun Jun 03 00:48:00 2007 +0000
@@ -184,16 +184,17 @@
 	char *text;
 
 	gc = console->gc;
-	
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
-	
+
+	if (gc)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry));
 	gtk_text_buffer_get_start_iter(buffer, &start);
 	gtk_text_buffer_get_end_iter(buffer, &end);
-		
+
 	text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end);
-			
-	if (gc && prpl_info->convo_closed != NULL)
+
+	if (prpl_info && prpl_info->send_raw != NULL)
 		prpl_info->send_raw(gc, text, strlen(text));
 
 	g_free(text);