changeset 16504:089531c08d75

merge of '419acaddea48001a61de3599d3b48005b3860373' and 'c4af5d58ae0a812912ffe29dc285f3d08afb5425'
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 27 Apr 2007 04:40:22 +0000
parents 513b52cb013a (current diff) d8d5b7f45466 (diff)
children 2ae39a056179 5ad28c23e899
files
diffstat 5 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Fri Apr 27 04:17:20 2007 +0000
+++ b/finch/gntblist.c	Fri Apr 27 04:40:22 2007 +0000
@@ -114,6 +114,7 @@
 static void account_signed_on_cb(void);
 
 /* Sort functions */
+static int blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2);
 static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2);
 static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2);
 static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2);
@@ -1778,6 +1779,15 @@
 }
 
 static int
+blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2)
+{
+	while ((n1 = n1->prev) != NULL)
+		if (n1 == n2)
+			return 1;
+	return -1;
+}
+
+static int
 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2)
 {
 	const char *s1, *s2;
@@ -1788,10 +1798,6 @@
 	
 	switch (n1->type)
 	{
-		case PURPLE_BLIST_GROUP_NODE:
-			s1 = ((PurpleGroup*)n1)->name;
-			s2 = ((PurpleGroup*)n2)->name;
-			break;
 		case PURPLE_BLIST_CHAT_NODE:
 			s1 = purple_chat_get_name((PurpleChat*)n1);
 			s2 = purple_chat_get_name((PurpleChat*)n2);
@@ -1805,7 +1811,7 @@
 			s2 = purple_contact_get_alias((PurpleContact*)n2);
 			break;
 		default:
-			return -1;
+			return blist_node_compare_position(n1, n2);
 	}
 
 	us1 = g_utf8_strup(s1, -1);
@@ -1836,6 +1842,7 @@
 				return ret;
 			break;
 		default:
+			return blist_node_compare_position(n1, n2);
 			break;
 	}
 
@@ -1882,6 +1889,7 @@
 				return ret;
 			break;
 		default:
+			return blist_node_compare_position(n1, n2);
 			break;
 	}
 	ret = blist_node_compare_text(n1, n2);
--- a/libpurple/account.c	Fri Apr 27 04:17:20 2007 +0000
+++ b/libpurple/account.c	Fri Apr 27 04:40:22 2007 +0000
@@ -792,6 +792,8 @@
 	}
 
 	xmlnode_free(node);
+
+	purple_buddy_icons_account_loaded_cb();
 }
 
 
--- a/libpurple/buddyicon.c	Fri Apr 27 04:17:20 2007 +0000
+++ b/libpurple/buddyicon.c	Fri Apr 27 04:40:22 2007 +0000
@@ -960,6 +960,31 @@
 }
 
 void
+purple_buddy_icons_account_loaded_cb()
+{
+	const char *dirname = purple_buddy_icons_get_cache_dir();
+	GList *cur;
+
+	for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
+	{
+		PurpleAccount *account = cur->data;
+		const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL);
+
+		if (account_icon_file != NULL)
+		{
+			char *path = g_build_filename(dirname, account_icon_file, NULL);
+			if (!g_file_test(path, G_FILE_TEST_EXISTS))
+			{
+				purple_account_set_string(account, "buddy_icon", NULL);
+			} else {
+				ref_filename(account_icon_file);
+			}
+			g_free(path);
+		}
+	}
+}
+
+void
 purple_buddy_icons_blist_loaded_cb()
 {
 	PurpleBlistNode *node = purple_blist_get_root();
@@ -999,7 +1024,7 @@
 				else
 				{
 					char *path = g_build_filename(dirname, filename, NULL);
-					if (!g_file_test(filename, G_FILE_TEST_EXISTS))
+					if (!g_file_test(path, G_FILE_TEST_EXISTS))
 					{
 						purple_blist_node_remove_setting(node,
 						                                 "buddy_icon");
--- a/libpurple/internal.h	Fri Apr 27 04:17:20 2007 +0000
+++ b/libpurple/internal.h	Fri Apr 27 04:40:22 2007 +0000
@@ -184,6 +184,11 @@
 
 #define PURPLE_WEBSITE "http://pidgin.im/"
 
+/* This is for the accounts code to notify the buddy icon code that
+ * it's done loading.  We may want to replace this with a signal. */
+void
+purple_buddy_icons_account_loaded_cb(void);
+
 /* This is for the buddy list to notify the buddy icon code that
  * it's done loading.  We may want to replace this with a signal. */
 void
--- a/libpurple/protocols/jabber/auth.c	Fri Apr 27 04:17:20 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c	Fri Apr 27 04:40:22 2007 +0000
@@ -294,7 +294,7 @@
 					purple_request_yes_no(js->gc, _("Plaintext Authentication"),
 							_("Plaintext Authentication"),
 							_("This server requires plaintext authentication over an unencrypted connection.  Allow this and continue authentication?"),
-							2, js->gc->account,
+							2, js->gc->account, NULL, NULL, NULL,
 							allow_cyrus_plaintext_auth,
 							disallow_plaintext_auth);
 					return;