changeset 18621:3700c41dd0db

merge of '4d22d26e21a84d8f6fbb484b3b01e88eff143ca3' and 'c5667c23f0afbeaad2ec711f202f2f0b13c699dc'
author Sean Egan <seanegan@gmail.com>
date Mon, 23 Jul 2007 04:26:49 +0000
parents cec3ced34a7d (diff) 302ab7b3171d (current diff)
children b9a6272f4039
files pidgin/gtkconv.c
diffstat 7 files changed, 52 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Mon Jul 23 04:26:11 2007 +0000
+++ b/finch/gntblist.c	Mon Jul 23 04:26:49 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	Mon Jul 23 04:26:11 2007 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Mon Jul 23 04:26:49 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	Mon Jul 23 04:26:11 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon Jul 23 04:26:49 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;
--- a/libpurple/protocols/oscar/oscar.h	Mon Jul 23 04:26:11 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Mon Jul 23 04:26:49 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	Mon Jul 23 04:26:11 2007 +0000
+++ b/libpurple/protocols/oscar/tlv.c	Mon Jul 23 04:26:49 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/util.c	Mon Jul 23 04:26:11 2007 +0000
+++ b/libpurple/util.c	Mon Jul 23 04:26:49 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/gtkrequest.c	Mon Jul 23 04:26:11 2007 +0000
+++ b/pidgin/gtkrequest.c	Mon Jul 23 04:26:49 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