changeset 18623:439f35ee87b2

merge of '53b8831e57f625eca0980aca94f04416b32bcd8f' and '8fc0ffbe3c0f235feff0ff133d652737adfd1279'
author Richard Laager <rlaager@wiktel.com>
date Mon, 23 Jul 2007 20:49:01 +0000
parents b9a6272f4039 (diff) 27f2cdbbb701 (current diff)
children 7dafe1fafe36
files
diffstat 11 files changed, 99 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/finch/gntblist.c	Mon Jul 23 20:49:01 2007 +0000
@@ -98,7 +98,7 @@
 	} u;
 } StatusBoxItem;
 
-FinchBlist *ggblist;
+static FinchBlist *ggblist;
 
 static void add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist);
 static void add_contact(PurpleContact *contact, FinchBlist *ggblist);
@@ -1670,7 +1670,7 @@
 	}
 
 	/* Now the popular statuses */
-	for (iter = purple_savedstatuses_get_popular(6); iter; iter = iter->next)
+	for (iter = purple_savedstatuses_get_popular(6); iter; iter = g_list_delete_link(iter, iter))
 	{
 		item = g_new0(StatusBoxItem, 1);
 		item->type = STATUS_SAVED_POPULAR;
--- a/libpurple/protocols/oscar/flap_connection.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Mon Jul 23 20:49:01 2007 +0000
@@ -356,16 +356,21 @@
 	FlapConnection *conn;
 	OscarData *od;
 	PurpleAccount *account;
+	aim_rxcallback_t userfunc;
 
 	conn = data;
 	od = conn->od;
 	account = (PURPLE_CONNECTION_IS_VALID(od->gc) ? purple_connection_get_account(od->gc) : NULL);
 
 	purple_debug_info("oscar", "Destroying oscar connection of "
-			"type 0x%04hx\n", conn->type);
+			"type 0x%04hx.  Disconnect reason is %d\n",
+			conn->type, conn->disconnect_reason);
 
 	od->oscar_connections = g_slist_remove(od->oscar_connections, conn);
 
+	if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR)))
+		userfunc(od, conn, NULL, conn->disconnect_code, conn->error_message);
+
 	/*
 	 * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then
 	 * we should try to request one instead of disconnecting.
@@ -375,7 +380,10 @@
 	{
 		/* No more FLAP connections!  Sign off this PurpleConnection! */
 		gchar *tmp;
-		if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED)
+		if (conn->disconnect_code == 0x0001) {
+			tmp = g_strdup(_("You have signed on from another location."));
+			od->gc->wants_to_die = TRUE;
+		} else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED)
 			tmp = g_strdup(_("Server closed the connection."));
 		else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION)
 			tmp = g_strdup_printf(_("Lost connection with server:\n%s"),
@@ -695,8 +703,6 @@
 {
 	GSList *tlvlist;
 	char *msg = NULL;
-	guint16 code = 0;
-	aim_rxcallback_t userfunc;
 
 	if (byte_stream_empty(&frame->data) == 0) {
 		/* XXX should do something with this */
@@ -713,13 +719,17 @@
 	tlvlist = aim_tlvlist_read(&frame->data);
 
 	if (aim_tlv_gettlv(tlvlist, 0x0009, 1))
-		code = aim_tlv_get16(tlvlist, 0x0009, 1);
+		conn->disconnect_code = aim_tlv_get16(tlvlist, 0x0009, 1);
 
 	if (aim_tlv_gettlv(tlvlist, 0x000b, 1))
 		msg = aim_tlv_getstr(tlvlist, 0x000b, 1);
 
-	if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR)))
-		userfunc(od, conn, frame, code, msg);
+	/*
+	 * The server ended this FLAP connnection, so let's be nice and
+	 * close the physical TCP connection
+	 */
+	flap_connection_schedule_destroy(conn,
+			OSCAR_DISCONNECT_REMOTE_CLOSED, msg);
 
 	aim_tlvlist_free(tlvlist);
 
--- a/libpurple/protocols/oscar/oscar.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon Jul 23 20:49:01 2007 +0000
@@ -1383,7 +1383,6 @@
 		}
 		purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode);
 		purple_debug_info("oscar", "Error URL: %s\n", info->errorurl);
-		od->killme = TRUE;
 		return 1;
 	}
 
@@ -1410,7 +1409,6 @@
 	if (newconn->connect_data == NULL)
 	{
 		purple_connection_error(gc, _("Could Not Connect"));
-		od->killme = TRUE;
 		return 0;
 	}
 
@@ -1433,12 +1431,10 @@
 purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value)
 {
 	PurpleConnection *gc = user_data;
-	OscarData *od = gc->proto_data;
 
 	/* Disconnect */
 	gc->wants_to_die = TRUE;
 	purple_connection_error(gc, _("The SecurID key entered is invalid."));
-	od->killme = TRUE;
 }
 
 static int
@@ -3472,33 +3468,32 @@
 	purple_debug_info("oscar", "Disconnected.  Code is 0x%04x and msg is %s\n",
 					code, (msg != NULL ? msg : ""));
 
-	g_return_val_if_fail(fr       != NULL, 1);
 	g_return_val_if_fail(conn != NULL, 1);
 
-	if (conn->type == SNAC_FAMILY_LOCATE) {
-		if (code == 0x0001) {
-			gc->wants_to_die = TRUE;
-			purple_connection_error(gc, _("You have signed on from another location."));
-		} else {
-			purple_connection_error(gc, _("You have been signed off for an unknown reason."));
-		}
-		od->killme = TRUE;
-	} else if (conn->type == SNAC_FAMILY_CHAT) {
+	if (conn->type == SNAC_FAMILY_CHAT) {
 		struct chat_connection *cc;
-		PurpleConversation *conv;
+		PurpleConversation *conv = NULL;
 
 		cc = find_oscar_chat_by_conn(gc, conn);
-		conv = purple_find_chat(gc, cc->id);
-
-		if (conv != NULL)
+		if (cc != NULL)
 		{
-			gchar *buf;
-			buf = g_strdup_printf(_("You have been disconnected from chat "
-									"room %s."), cc->name);
-			purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
-			g_free(buf);
+			conv = purple_find_chat(gc, cc->id);
+
+			if (conv != NULL)
+			{
+				/*
+				 * TOOD: Have flap_connection_destroy_cb() send us the
+				 *       error message stored in 'tmp', which should be
+				 *       human-friendly, and print that to the chat room.
+				 */
+				gchar *buf;
+				buf = g_strdup_printf(_("You have been disconnected from chat "
+										"room %s."), cc->name);
+				purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
+				g_free(buf);
+			}
+			oscar_chat_kill(gc, cc);
 		}
-		oscar_chat_kill(gc, cc);
 	}
 
 	return 1;
@@ -4328,10 +4323,15 @@
 			
 			tmp2 = purple_markup_strip_html(tmp1);
 			g_free(tmp1);
-			
-			tmp1 = purple_strdup_withhtml(tmp2);
+
+			/* re-escape the entities */
+			tmp1 = g_markup_escape_text(tmp2, -1);
 			g_free(tmp2);
 			
+			tmp2 = purple_strdup_withhtml(tmp1);
+			g_free(tmp1);
+			tmp1 = tmp2;
+
 			purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset);
 
 			purple_debug_info("oscar", "Sending %s as %s because the original was too long.",
--- a/libpurple/protocols/oscar/oscar.h	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Mon Jul 23 20:49:01 2007 +0000
@@ -378,6 +378,7 @@
 	guint destroy_timeout;
 	OscarDisconnectReason disconnect_reason;
 	gchar *error_message;
+	guint16 disconnect_code;
 
 	/* A few variables that are only used when connecting */
 	PurpleProxyConnectData *connect_data;
@@ -442,7 +443,6 @@
 	GHashTable *buddyinfo;
 	GSList *requesticon;
 
-	gboolean killme;
 	gboolean icq;
 	guint icontimer;
 	guint getblisttimer;
--- a/libpurple/protocols/oscar/tlv.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/protocols/oscar/tlv.c	Mon Jul 23 20:49:01 2007 +0000
@@ -718,12 +718,10 @@
 
 	for (cur = list, i = 0; cur != NULL; cur = cur->next) {
 		tlv = cur->data;
-		if (tlv != NULL) { /* TODO: This NULL check shouldn't be needed */
-			if (tlv->type == type)
-				i++;
-			if (i >= nth)
-				return tlv;
-		}
+		if (tlv->type == type)
+			i++;
+		if (i >= nth)
+			return tlv;
 	}
 
 	return NULL;
--- a/libpurple/protocols/sametime/sametime.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Mon Jul 23 20:49:01 2007 +0000
@@ -3189,7 +3189,8 @@
   pd = gc->proto_data;
 
   ret = mwServiceAware_getText(pd->srvc_aware, &t);
-  return ret? g_markup_escape_text(ret, -1): NULL;
+  
+  return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL;
 }
 
 
@@ -3254,7 +3255,7 @@
   message = mwServiceAware_getText(pd->srvc_aware, &idb);
   status = status_text(b);
 
-  if(message != NULL && purple_utf8_strcasecmp(status, message)) {
+  if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) {
     tmp = g_markup_escape_text(message, -1);
 	purple_notify_user_info_add_pair(user_info, status, tmp);
     g_free(tmp);
@@ -4151,7 +4152,7 @@
 
 	/* XXX Is this adding a status message in its own section rather than with the "Status" label? */
     tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb);
-    if(tmp2) {
+    if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) {
       tmp = g_markup_escape_text(tmp2, -1);
 	  purple_notify_user_info_add_section_break(user_info);
 	  purple_notify_user_info_add_pair(user_info, NULL, tmp);
--- a/libpurple/purple-remote	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/purple-remote	Mon Jul 23 20:49:01 2007 +0000
@@ -59,7 +59,7 @@
     quit
 
     PurpleAccountsFindConnected?name=&protocol=prpl-jabber
-    PurpleAccountFindConnected(,prpl-jabber)
+    PurpleAccountsFindConnected(,prpl-jabber)
 """ % sys.argv[0]
 
 cpurple = CheckedObject(purple)
--- a/libpurple/util.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/libpurple/util.c	Mon Jul 23 20:49:01 2007 +0000
@@ -3994,6 +3994,10 @@
 		if (*c <= ' ' || *c >= 127) return FALSE;
 		if (strchr(rfc822_specials, *c)) return FALSE;
 	}
+
+	/* It's obviously not an email address if we didn't find an '@' above */
+	if (*c == '\0') return FALSE;
+
 	/* strictly we should return false if (*(c - 1) == '.') too, but I think
 	 * we should permit user.@domain type addresses - they do work :) */
 	if (c == address) return FALSE;
--- a/pidgin/gtkconv.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/pidgin/gtkconv.c	Mon Jul 23 20:49:01 2007 +0000
@@ -4804,6 +4804,11 @@
 	else
 		gtk_widget_hide(gtkconv->toolbar);
 
+	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
+		gtk_widget_show(gtkconv->infopane_hbox);
+	else
+		gtk_widget_hide(gtkconv->infopane_hbox);
+
 	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
 		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps"));
 	gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
@@ -6783,9 +6788,14 @@
 
 	for (l = purple_get_conversations(); l != NULL; l = l->next) {
 		PurpleConversation *conv = l->data;
-
-		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
+		if (GPOINTER_TO_INT(value)) 
+			gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
+		else
+			gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
+
+		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
 			pidgin_conv_update_buddy_icon(conv);
+		}
 	}
 }
 
@@ -8438,6 +8448,10 @@
 	win->gtkconvs = g_list_append(win->gtkconvs, gtkconv);
 	gtkconv->win = win;
 
+	if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL) 
+		pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data));
+
+
 	/* Close button. */
 	gtkconv->close = gtk_button_new();
 	gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height);
@@ -8507,9 +8521,11 @@
 		/* Er, bug in notebooks? Switch to the page manually. */
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
 
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
-	} else
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), 
+					   purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs"));
+	} else {
 		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE);
+	}
 
 	focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win),
 	                             gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)));
@@ -8535,11 +8551,14 @@
 		angle = 270;
 
 #if GTK_CHECK_VERSION(2,6,0)
-	if (!angle)
+	if (!angle && pidgin_conv_window_get_gtkconv_count(win) > 1) {
 		g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END,  NULL);
-	else
+		gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6);
+	} else {
 		g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_NONE, NULL);
-	gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6);
+		gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), -1);
+	}
+
 	if (tabs_side) {
 		gtk_label_set_width_chars(
 			GTK_LABEL(gtkconv->tab_label),
@@ -8598,10 +8617,12 @@
 		gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox);
 	}
 
-	gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START);
+	gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, 
+					   !tabs_side && !angle && pidgin_conv_window_get_gtkconv_count(win) > 1, 
+					   TRUE, GTK_PACK_START);
 
 	/* show the widgets */
-/* XXX	gtk_widget_show(gtkconv->icon); */
+	gtk_widget_show(gtkconv->icon);
 	gtk_widget_show(gtkconv->tab_label);
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs"))
 		gtk_widget_show(gtkconv->close);
@@ -8625,13 +8646,14 @@
 
 	/* go back to tabless */
 	if (pidgin_conv_window_get_gtkconv_count(win) <= 2) {
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), 
+  					   purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs"));
 	}
 
 	win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv);
 
-	if (!win->gtkconvs || !win->gtkconvs->next)
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
+	if (win->gtkconvs && win->gtkconvs->next == NULL)
+		pidgin_conv_tab_pack(win, win->gtkconvs->data);
 
 	if (!win->gtkconvs && win != hidden_convwin)
 		pidgin_conv_window_destroy(win);
--- a/pidgin/gtkprefs.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/pidgin/gtkprefs.c	Mon Jul 23 20:49:01 2007 +0000
@@ -994,7 +994,7 @@
 	pidgin_prefs_checkbox(_("Show _formatting on incoming messages"),
 				PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", vbox);
 
-	iconpref1 = pidgin_prefs_checkbox(_("Show buddy _icons"),
+	iconpref1 = pidgin_prefs_checkbox(_("Show Buddy _Details"),
 			PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons", vbox);
 	iconpref2 = pidgin_prefs_checkbox(_("Enable buddy ic_on animation"),
 			PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons", vbox);
--- a/pidgin/gtkrequest.c	Sun Jul 22 00:08:10 2007 +0000
+++ b/pidgin/gtkrequest.c	Mon Jul 23 20:49:01 2007 +0000
@@ -581,9 +581,14 @@
 	/* Create the dialog. */
 	data->dialog = dialog = gtk_dialog_new();
 
+#if GTK_CHECK_VERSION(2,10,0)
+	gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE);
+#endif
+
 	if (title != NULL)
 		gtk_window_set_title(GTK_WINDOW(dialog), title);
 #ifdef _WIN32
+	else
 		gtk_window_set_title(GTK_WINDOW(dialog), PIDGIN_ALERT_TITLE);
 #endif