# HG changeset patch
# Node ID 83d46478724e
# Parent  c5513eb740aa
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -72,7 +72,6 @@
 
 	GtkWidget *modify_button;
 	GtkWidget *delete_button;
-	GtkWidget *notebook;
 
 	GtkListStore *model;
 	GtkTreeIter drag_iter;
@@ -1241,8 +1240,8 @@
 }
 
 static void
-account_prefs_save(AccountPrefsDialog *dialog)
-{
+account_prefs_save(AccountPrefsDialog *dialog) {
+	PurpleAccountManager *manager = NULL;
 	PurpleProxyInfo *proxy_info = NULL;
 	GList *l, *l2;
 	const char *value;
@@ -1252,6 +1251,8 @@
 	PurpleAccount *account;
 	PurpleBuddyIconSpec *icon_spec = NULL;
 
+	manager = purple_account_manager_get_default();
+
 	/* Build the username string. */
 	username = g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)));
 
@@ -1284,22 +1285,29 @@
 
 	if (dialog->account == NULL)
 	{
-		if (purple_accounts_find(username, dialog->protocol_id) != NULL) {
-			purple_debug_warning("gtkaccount", "Trying to add a duplicate %s account (%s).\n",
-				dialog->protocol_id, username);
+		account = purple_account_manager_find(manager, username,
+		                                      dialog->protocol_id);
+		if(PURPLE_IS_ACCOUNT(account)) {
+			purple_debug_warning("gtkaccount",
+			                     "Trying to add a duplicate %s account (%s).\n",
+			                     dialog->protocol_id, username);
 
 			purple_notify_error(NULL, NULL, _("Unable to save new account"),
-				_("An account already exists with the specified criteria."), NULL);
+			                    _("An account already exists with the "
+			                      "specified criteria."),
+			                    NULL);
 
 			g_free(username);
+
 			return;
 		}
 
-		if (purple_accounts_get_all() == NULL) {
-			/* We're adding our first account.  Be polite and show the buddy list */
-			PidginBuddyList *blist =
-					pidgin_blist_get_default_gtk_blist();
-			if (blist != NULL && blist->window != NULL) {
+		if(purple_account_manager_get_all(manager) == NULL) {
+			/* We're adding our first account.  Be polite and show the buddy
+			 * list.
+			 */
+			PidginBuddyList *blist = pidgin_blist_get_default_gtk_blist();
+			if(blist != NULL && blist->window != NULL) {
 				gtk_window_present(GTK_WINDOW(blist->window));
 			}
 		}
@@ -1475,10 +1483,11 @@
 	}
 
 	/* If this is a new account, add it to our list */
-	if (new_acct)
-		purple_accounts_add(account);
-	else
+	if(new_acct) {
+		purple_account_manager_add(manager, account);
+	} else {
 		purple_signal_emit(pidgin_accounts_get_handle(), "account-modified", account);
+	}
 
 	/* If this is a new account, then sign on! */
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->register_button))) {
@@ -1699,31 +1708,38 @@
 signed_on_off_cb(PurpleConnection *gc, gpointer user_data)
 {
 	PurpleAccount *account;
+	PurpleAccountManager *manager = NULL;
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	GdkPixbuf *pixbuf;
+	GList *accounts = NULL;
 	size_t index;
 
 	/* Don't need to do anything if the accounts window is not visible */
-	if (accounts_window == NULL)
+	if(accounts_window == NULL) {
 		return;
+	}
+
+	manager = purple_account_manager_get_default();
+	accounts = purple_account_manager_get_all(manager);
 
 	account = purple_connection_get_account(gc);
 	model = GTK_TREE_MODEL(accounts_window->model);
-	index = g_list_index(purple_accounts_get_all(), account);
-
-	if (gtk_tree_model_iter_nth_child(model, &iter, NULL, index))
-	{
+	index = g_list_index(accounts, account);
+
+	if(gtk_tree_model_iter_nth_child(model, &iter, NULL, index)) {
 		pixbuf = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_MEDIUM);
-		if ((pixbuf != NULL) && purple_account_is_disconnected(account))
+		if((pixbuf != NULL) && purple_account_is_disconnected(account)) {
 			gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
+		}
 
 		gtk_list_store_set(accounts_window->model, &iter,
-				   COLUMN_ICON, pixbuf,
-				   -1);
-
-		if (pixbuf != NULL)
+		                   COLUMN_ICON, pixbuf,
+		                   -1);
+
+		if(pixbuf != NULL) {
 			g_object_unref(G_OBJECT(pixbuf));
+		}
 	}
 }
 
@@ -1766,18 +1782,18 @@
 	GtkTreeIter iter;
 
 	/* If the account was being modified, close the edit window */
-	if ((dialog = g_hash_table_lookup(account_pref_wins, account)) != NULL)
+	if((dialog = g_hash_table_lookup(account_pref_wins, account)) != NULL) {
 		account_win_destroy_cb(NULL, NULL, dialog);
-
-	if (accounts_window == NULL)
+	}
+
+	if(accounts_window == NULL) {
 		return;
+	}
 
 	/* Remove the account from the GtkListStore */
-	if (accounts_window_find_account_in_treemodel(&iter, account))
+	if(accounts_window_find_account_in_treemodel(&iter, account)) {
 		gtk_list_store_remove(accounts_window->model, &iter);
-
-	if (purple_accounts_get_all() == NULL)
-		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0);
+	}
 }
 
 static void
@@ -1885,11 +1901,13 @@
 		memcpy(&a, data, sizeof(a));
 
 		if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y,
-											  &path, &position)) {
-
+		                                      &path, &position))
+		{
 			GtkTreeIter iter;
 			PurpleAccount *account;
+			PurpleAccountManager *manager = NULL;
 			GValue val;
+			GList *accounts = NULL;
 
 			gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
 			val.g_type = 0;
@@ -1898,19 +1916,20 @@
 
 			account = g_value_get_pointer(&val);
 
+			manager = purple_account_manager_get_default();
+			accounts = purple_account_manager_get_all(manager);
+
 			switch (position) {
 				case GTK_TREE_VIEW_DROP_AFTER:
 				case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
 					move_account_after(dialog->model, &dialog->drag_iter,
 									   &iter);
-					dest_index = g_list_index(purple_accounts_get_all(),
-											  account) + 1;
+					dest_index = g_list_index(accounts, account) + 1;
 					break;
 
 				case GTK_TREE_VIEW_DROP_BEFORE:
 				case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-					dest_index = g_list_index(purple_accounts_get_all(),
-											  account);
+					dest_index = g_list_index(accounts, account);
 
 					move_account_before(dialog->model, &dialog->drag_iter,
 										&iter);
@@ -1920,8 +1939,9 @@
 					return;
 			}
 
-			if (dest_index >= 0)
-				purple_accounts_reorder(a, dest_index);
+			if (dest_index >= 0) {
+				purple_account_manager_reorder(manager, a, dest_index);
+			}
 		}
 	}
 }
@@ -2168,23 +2188,22 @@
 }
 
 static void
-add_account_to_liststore(PurpleAccount *account, gpointer user_data)
-{
+add_account_to_liststore(PurpleAccount *account, gpointer user_data) {
 	GtkTreeIter iter;
 	GdkPixbuf *global_buddyicon = user_data;
 
-	if (accounts_window == NULL)
+	if(accounts_window == NULL) {
 		return;
+	}
 
 	gtk_list_store_append(accounts_window->model, &iter);
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook),1);
 
 	set_account(accounts_window->model, &iter, account, global_buddyicon);
 }
 
-static gboolean
+static void
 populate_accounts_list(AccountsWindow *dialog) {
-	GList *l;
+	PurpleAccountManager *manager = NULL;
 	GdkPixbuf *global_buddyicon = NULL;
 	const gchar *path;
 
@@ -2200,14 +2219,13 @@
 		}
 	}
 
-	l = purple_accounts_get_all();
-	g_list_foreach(l, (GFunc)add_account_to_liststore, global_buddyicon);
+	manager = purple_account_manager_get_default();
+	purple_account_manager_foreach(manager, add_account_to_liststore,
+	                               global_buddyicon);
 
 	if(global_buddyicon != NULL) {
 		g_object_unref(G_OBJECT(global_buddyicon));
 	}
-
-	return l != NULL;
 }
 
 static void
@@ -2261,42 +2279,13 @@
 create_accounts_list(AccountsWindow *dialog)
 {
 	GtkWidget *frame;
-	GtkWidget *label;
 	GtkWidget *treeview;
 	GtkTreeSelection *sel;
 	GtkTargetEntry gte[] = {{"PURPLE_ACCOUNT", GTK_TARGET_SAME_APP, 0}};
-	gchar *text;
 
 	frame = gtk_frame_new(NULL);
 	gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
 
-	accounts_window->notebook = gtk_notebook_new();
-	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(accounts_window->notebook), FALSE);
-	gtk_notebook_set_show_border(GTK_NOTEBOOK(accounts_window->notebook), FALSE);
-	gtk_container_add(GTK_CONTAINER(frame), accounts_window->notebook);
-
-	/* Create a helpful first-time-use label */
-	label = gtk_label_new(NULL);
-	/* Translators: Please maintain the use of ⇦ or ⇨ to represent the menu hierarchy */
-	text = g_strdup_printf(_(
-						 "<span size='larger' weight='bold'>Welcome to %s!</span>\n\n"
-
-						 "You have no IM accounts configured. To start connecting with %s "
-						 "press the <b>Add...</b> button below and configure your first "
-						 "account. If you want %s to connect to multiple IM accounts, "
-						 "press <b>Add...</b> again to configure them all.\n\n"
-
-						 "You can come back to this window to add, edit, or remove "
-						 "accounts from <b>Accounts⇨Manage Accounts</b> in the Buddy "
-						 "List window"), PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
-	gtk_label_set_markup(GTK_LABEL(label), text);
-	g_free(text);
-
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-	gtk_widget_show(label);
-
-	gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook), label, NULL);
-
 	/* Create the list model. */
 	dialog->model = gtk_list_store_new(NUM_COLUMNS,
 					GDK_TYPE_PIXBUF,   /* COLUMN_ICON */
@@ -2321,17 +2310,13 @@
 	g_signal_connect(G_OBJECT(treeview), "button_press_event",
 					 G_CALLBACK(account_treeview_double_click_cb), dialog);
 
-	gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook),
-		pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1),
-		NULL);
+	gtk_container_add(GTK_CONTAINER(frame),
+	                  pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1));
 
 	add_columns(treeview, dialog);
 	gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview));
 
-	if (populate_accounts_list(dialog))
-		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 1);
-	else
-		gtk_notebook_set_current_page(GTK_NOTEBOOK(accounts_window->notebook), 0);
+	populate_accounts_list(dialog);
 
 	/* Setup DND. I wanna be an orc! */
 	gtk_tree_view_enable_model_drag_source(
@@ -2351,8 +2336,8 @@
 }
 
 static void
-account_modified_cb(PurpleAccount *account, AccountsWindow *window)
-{
+account_modified_cb(PurpleAccount *account, gpointer data) {
+	AccountsWindow *window = (AccountsWindow *)data;
 	GtkTreeIter iter;
 
 	if (!accounts_window_find_account_in_treemodel(&iter, account))
@@ -2362,11 +2347,13 @@
 }
 
 static void
-global_buddyicon_changed(const char *name, PurplePrefType type,
-			gconstpointer value, gpointer window)
+global_buddyicon_changed(const gchar *name, PurplePrefType type,
+                         gconstpointer value, gpointer window)
 {
-	GList *list = purple_accounts_get_all();
-	g_list_foreach(list, (GFunc)account_modified_cb, window);
+	PurpleAccountManager *manager = NULL;
+
+	manager = purple_account_manager_get_default();
+	purple_account_manager_foreach(manager, account_modified_cb, window);
 }
 
 void
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -4345,12 +4345,14 @@
 static void
 show_initial_account_errors(PidginBuddyList *gtkblist)
 {
-	GList *l = purple_accounts_get_all();
+	PurpleAccountManager *manager = NULL;
+	GList *l = NULL;
 	PurpleAccount *account;
 	const PurpleConnectionErrorInfo *err;
 
-	for (; l; l = l->next)
-	{
+	manager = purple_account_manager_get_default();
+	l = purple_account_manager_get_all(manager);
+	for(; l; l = l->next) {
 		account = l->data;
 		err = purple_account_get_current_error(account);
 
diff --git a/pidgin/gtkconn.c b/pidgin/gtkconn.c
--- a/pidgin/gtkconn.c
+++ b/pidgin/gtkconn.c
@@ -154,34 +154,40 @@
 	}
 }
 
-static void pidgin_connection_network_connected (void)
-{
-	GList *list, *l;
+static void
+pidgin_connection_network_connected(void) {
+	PurpleAccountManager *manager = NULL;
+	GList *l = NULL;
 
-	l = list = purple_accounts_get_all_active();
-	while (l) {
+	manager = purple_account_manager_get_default();
+	l = purple_account_manager_get_active(manager);
+
+	while(l != NULL) {
 		PurpleAccount *account = (PurpleAccount*)l->data;
 		g_hash_table_remove(auto_reconns, account);
 		if (purple_account_is_disconnected(account))
 			do_signon(account);
-		l = l->next;
+
+		l = g_list_delete_link(l, l);
 	}
-	g_list_free(list);
 }
 
-static void pidgin_connection_network_disconnected (void)
-{
-	GList *list, *l;
+static void
+pidgin_connection_network_disconnected(void) {
+	PurpleAccountManager *manager = NULL;
+	GList *l = NULL;
 
-	l = list = purple_accounts_get_all_active();
-	while (l) {
+	manager = purple_account_manager_get_default();
+	l = purple_account_manager_get_active(manager);
+
+	while(l != NULL) {
 		PurpleAccount *a = (PurpleAccount*)l->data;
 		if (!purple_account_is_disconnected(a)) {
 			purple_account_disconnect(a);
 		}
-		l = l->next;
+
+		l = g_list_delete_link(l, l);
 	}
-	g_list_free(list);
 }
 
 static void pidgin_connection_notice(PurpleConnection *gc, const char *text)
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1520,6 +1520,7 @@
 
 	if (purple_strequal(domain, "protocol")) {
 		PurpleAccount *account;
+		PurpleAccountManager *manager = NULL;
 		gchar *protocol_id, *accountname;
 
 		protocol_id = id;
@@ -1533,8 +1534,10 @@
 		accountname[0] = '\0';
 		accountname++;
 
-		account = purple_accounts_find(accountname, protocol_id);
-		if (account) {
+		manager = purple_account_manager_get_default();
+		account = purple_account_manager_find(manager, accountname,
+		                                      protocol_id);
+		if(account) {
 			image = pidgin_create_protocol_icon(account,
 				PIDGIN_PROTOCOL_ICON_SMALL);
 		}
diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c
--- a/pidgin/gtksavedstatuses.c
+++ b/pidgin/gtksavedstatuses.c
@@ -1031,18 +1031,22 @@
 status_editor_populate_list(StatusEditor *dialog, PurpleSavedStatus *saved_status)
 {
 	GList *iter;
+	PurpleAccountManager *manager = NULL;
 	PurpleSavedStatusSub *substatus;
 
 	gtk_list_store_clear(dialog->model);
 
-	for (iter = purple_accounts_get_all(); iter != NULL; iter = iter->next)
-	{
+	manager = purple_account_manager_get_default();
+	iter = purple_account_manager_get_all(manager);
+
+	for(; iter != NULL; iter = iter->next) {
 		PurpleAccount *account = (PurpleAccount *)iter->data;
 
-		if (saved_status != NULL)
+		if (saved_status != NULL) {
 			substatus = purple_savedstatus_get_substatus(saved_status, account);
-		else
+		} else {
 			substatus = NULL;
+		}
 
 		status_editor_add_account(dialog, account, substatus);
 	}
diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -702,12 +702,16 @@
 
 /* This returns NULL if the active accounts don't have identical
  * statuses and a token account if they do */
-static PurpleAccount* check_active_accounts_for_identical_statuses(void)
-{
-	GList *iter, *active_accts = purple_accounts_get_all_active();
+static
+PurpleAccount *check_active_accounts_for_identical_statuses(void) {
+	PurpleAccountManager *manager = NULL;
+	GList *iter, *active_accts = NULL;
 	PurpleAccount *acct1 = NULL;
 	const char *proto1 = NULL;
 
+	manager = purple_account_manager_get_default();
+	active_accts = purple_account_manager_get_active(manager);
+
 	if (active_accts) {
 		acct1 = active_accts->data;
 		proto1 = purple_account_get_protocol_id(acct1);
@@ -1713,8 +1717,12 @@
 		{
 			/* Manually find the appropriate transient status */
 			if (status_box->token_status_account) {
+				PurpleAccountManager *manager = NULL;
 				GList *iter = purple_savedstatuses_get_all();
-				GList *tmp, *active_accts = purple_accounts_get_all_active();
+				GList *active_accts = NULL;
+
+				manager = purple_account_manager_get_default();
+				active_accts = purple_account_manager_get_active(manager);
 
 				for (; iter != NULL; iter = iter->next) {
 					PurpleSavedStatus *ss = iter->data;
@@ -1727,8 +1735,8 @@
 					{
 						gboolean found = FALSE;
 						/* this status must have substatuses for all the active accts */
-						for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
-							PurpleAccount *acct = tmp->data;
+						while(active_accts != NULL) {
+							PurpleAccount *acct = active_accts->data;
 							PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
 							if (sub) {
 								const PurpleStatusType *sub_type =
@@ -1739,6 +1747,9 @@
 									break;
 								}
 							}
+
+							active_accts = g_list_delete_link(active_accts,
+							                                  active_accts);
 						}
 
 						if (found) {
@@ -1756,17 +1767,28 @@
 			}
 
 			/* If this type+message is unique then create a new transient saved status */
-			if (saved_status == NULL)
-			{
+			if(saved_status == NULL) {
 				saved_status = purple_savedstatus_new(NULL, primitive);
 				purple_savedstatus_set_message(saved_status, message);
+
 				if (status_box->token_status_account) {
-					GList *tmp, *active_accts = purple_accounts_get_all_active();
-					for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
-						purple_savedstatus_set_substatus(saved_status,
-							(PurpleAccount*) tmp->data, acct_status_type, message);
+					PurpleAccountManager *manager = NULL;
+					GList *active_accts = NULL;
+
+					manager = purple_account_manager_get_default();
+					active_accts = purple_account_manager_get_active(manager);
+
+					while(active_accts != NULL) {
+						PurpleAccount *account = NULL;
+
+						account = PURPLE_ACCOUNT(active_accts->data);
+						purple_savedstatus_set_substatus(saved_status, account,
+						                                 acct_status_type,
+						                                 message);
+
+						active_accts = g_list_delete_link(active_accts,
+						                                  active_accts);
 					}
-					g_list_free(active_accts);
 				}
 			}
 
@@ -1889,10 +1911,16 @@
 	 * message attribute on any protocol that is enabled,
 	 * or our protocol, if we have account set
 	 */
-	if (status_box->account)
+	if(status_box->account) {
 		accounts = g_list_prepend(accounts, status_box->account);
-	else
-		accounts = purple_accounts_get_all_active();
+	} else {
+		PurpleAccountManager *manager = NULL;
+
+		manager = purple_account_manager_get_default();
+
+		accounts = purple_account_manager_get_active(manager);
+	}
+
 	status_box->editor_visible = FALSE;
 	for (node = accounts; node != NULL; node = node->next)
 	{
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -363,8 +363,8 @@
 
 gboolean
 pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts,
-							PurpleAccount **ret_account, char **ret_protocol,
-							char **ret_username, char **ret_alias)
+                          PurpleAccount **ret_account, char **ret_protocol,
+                          char **ret_username, char **ret_alias)
 {
 	char *protocol = NULL;
 	char *username = NULL;
@@ -434,17 +434,21 @@
 			*ret_alias = alias;
 
 		/* Check for a compatible account. */
-		if (ret_account != NULL)
-		{
+		if(ret_account != NULL) {
+			PurpleAccount *account = NULL;
 			GList *list;
-			PurpleAccount *account = NULL;
 			GList *l;
 			const char *protoname;
 
-			if (all_accounts)
-				list = purple_accounts_get_all();
-			else
+
+			if(all_accounts) {
+				PurpleAccountManager *manager = NULL;
+
+				manager = purple_account_manager_get_default();
+				list = purple_account_manager_get_all(manager);
+			} else {
 				list = purple_connections_get_all();
+			}
 
 			for (l = list; l != NULL; l = l->next)
 			{
diff --git a/pidgin/pidginaccountsmenu.c b/pidgin/pidginaccountsmenu.c
--- a/pidgin/pidginaccountsmenu.c
+++ b/pidgin/pidginaccountsmenu.c
@@ -133,21 +133,25 @@
 }
 
 static void
-pidgin_accounts_menu_add_current(PidginAccountsMenu *menu) {
-	GList *accounts = NULL, *l = NULL;
-
-	accounts = purple_accounts_get_all();
-	for(l = accounts; l != NULL; l = l->next) {
-		PurpleAccount *account = PURPLE_ACCOUNT(l->data);
+pidgin_accounts_menu_foreach_cb(PurpleAccount *account, gpointer data) {
+	PidginAccountsMenu *menu = PIDGIN_ACCOUNTS_MENU(data);
 
-		if(purple_account_get_enabled(account, PIDGIN_UI)) {
-			pidgin_accounts_menu_add_enabled_account(menu, account);
-		} else {
-			pidgin_accounts_menu_add_disabled_account(menu, account);
-		}
+	if(purple_account_get_enabled(account, PIDGIN_UI)) {
+		pidgin_accounts_menu_add_enabled_account(menu, account);
+	} else {
+		pidgin_accounts_menu_add_disabled_account(menu, account);
 	}
 }
 
+static void
+pidgin_accounts_menu_add_current(PidginAccountsMenu *menu) {
+	PurpleAccountManager *manager = NULL;
+
+	manager = purple_account_manager_get_default();
+	purple_account_manager_foreach(manager, pidgin_accounts_menu_foreach_cb,
+	                               menu);
+}
+
 /******************************************************************************
  * Purple Signal Callbacks
  *****************************************************************************/
diff --git a/pidgin/pidginaccountstore.c b/pidgin/pidginaccountstore.c
--- a/pidgin/pidginaccountstore.c
+++ b/pidgin/pidginaccountstore.c
@@ -71,17 +71,21 @@
 }
 
 static void
-pidgin_account_store_add_account_helper(gpointer data, gpointer user_data) {
-	if(PURPLE_IS_ACCOUNT(data)) {
-		pidgin_account_store_add_account(PIDGIN_ACCOUNT_STORE(user_data),
-		                                 PURPLE_ACCOUNT(data));
+pidgin_account_store_add_account_helper(PurpleAccount *account, gpointer data) {
+	if(PURPLE_IS_ACCOUNT(account)) {
+		pidgin_account_store_add_account(PIDGIN_ACCOUNT_STORE(data),
+		                                 PURPLE_ACCOUNT(account));
 	}
 }
 
 static void
 pidgin_account_store_add_accounts(PidginAccountStore *store) {
-	g_list_foreach(purple_accounts_get_all(),
-	               pidgin_account_store_add_account_helper, store);
+	PurpleAccountManager *manager = NULL;
+
+	manager = purple_account_manager_get_default();
+	purple_account_manager_foreach(manager,
+	                               pidgin_account_store_add_account_helper,
+	                               store);
 }
 
 static void
diff --git a/pidgin/pidginapplication.c b/pidgin/pidginapplication.c
--- a/pidgin/pidginapplication.c
+++ b/pidgin/pidginapplication.c
@@ -502,6 +502,7 @@
  *****************************************************************************/
 static void
 pidgin_application_startup(GApplication *application) {
+	PurpleAccountManager *manager = NULL;
 	GtkCssProvider *provider = NULL;
 	GError *error = NULL;
 	GList *active_accounts = NULL;
@@ -609,7 +610,9 @@
 		purple_accounts_restore_current_statuses();
 	}
 
-	if((active_accounts = purple_accounts_get_all_active()) == NULL) {
+	manager = purple_account_manager_get_default();
+	active_accounts = purple_account_manager_get_active(manager);
+	if(active_accounts == NULL) {
 		pidgin_accounts_window_show();
 	} else {
 		g_list_free(active_accounts);
diff --git a/pidgin/pidginmooddialog.c b/pidgin/pidginmooddialog.c
--- a/pidgin/pidginmooddialog.c
+++ b/pidgin/pidginmooddialog.c
@@ -95,7 +95,8 @@
 
 		update_status_with_mood(account, mood, text);
 	} else {
-		GList *accounts = purple_accounts_get_all_active();
+		PurpleAccountManager *manager = purple_account_manager_get_default();
+		GList *accounts = purple_account_manager_get_all(manager);
 
 		for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
 			PurpleAccount *account = (PurpleAccount *) accounts->data;
@@ -130,6 +131,7 @@
  */
 static PurpleMood *
 pidgin_mood_get_global_moods(void) {
+	PurpleAccountManager *manager = NULL;
 	GHashTable *global_moods = NULL;
 	GHashTable *mood_counts = NULL;
 	GList *accounts = NULL;
@@ -141,7 +143,8 @@
 	global_moods = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
 	mood_counts = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
 
-	accounts = purple_accounts_get_all_active();
+	manager = purple_account_manager_get_default();
+	accounts = purple_account_manager_get_active(manager);
 	for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
 		PurpleAccount *account = (PurpleAccount *) accounts->data;
 		if (purple_account_is_connected(account)) {
@@ -202,9 +205,12 @@
  */
 static const gchar *
 pidgin_mood_get_global_status(void) {
-	GList *accounts = purple_accounts_get_all_active();
+	PurpleAccountManager *manager = NULL;
+	GList *accounts = NULL;
 	const gchar *found_mood = NULL;
 
+	manager = purple_account_manager_get_default();
+	accounts = purple_account_manager_get_active(manager);
 	for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
 		PurpleAccount *account = (PurpleAccount *) accounts->data;
 
diff --git a/pidgin/plugins/unity.c b/pidgin/plugins/unity.c
--- a/pidgin/plugins/unity.c
+++ b/pidgin/plugins/unity.c
@@ -259,24 +259,29 @@
 {
 	gchar **sections = g_strsplit(id, ":", 0);
 	PurpleConversation *conv = NULL;
-	PurpleConversationManager *manager = NULL;
+	PurpleConversationManager *conversation_manager = NULL;
 	PurpleAccount *account;
+	PurpleAccountManager *account_manager = NULL;
 
 	char *type     = sections[0];
 	char *cname    = sections[1];
 	char *aname    = sections[2];
 	char *protocol = sections[3];
 
-	manager = purple_conversation_manager_get_default();
+	conversation_manager = purple_conversation_manager_get_default();
 
-	account = purple_accounts_find(aname, protocol);
+	account_manager = purple_account_manager_get_default();
+	account = purple_account_manager_find(account_manager, aname, protocol);
 
 	if (g_strcmp0(type, "im") == 0) {
-		conv = purple_conversation_manager_find_im(manager, account, cname);
+		conv = purple_conversation_manager_find_im(conversation_manager,
+		                                           account, cname);
 	} else if (g_strcmp0(type, "chat") == 0) {
-		conv = purple_conversation_manager_find_chat(manager, account, cname);
+		conv = purple_conversation_manager_find_chat(conversation_manager,
+		                                             account, cname);
 	} else {
-		conv = purple_conversation_manager_find(manager, account, cname);
+		conv = purple_conversation_manager_find(conversation_manager,
+		                                        account, cname);
 	}
 
 	if (conv) {
@@ -295,17 +300,26 @@
 }
 
 static PurpleSavedStatus *
-create_transient_status(PurpleStatusPrimitive primitive, PurpleStatusType *status_type)
+create_transient_status(PurpleStatusPrimitive primitive,
+                        PurpleStatusType *status_type)
 {
 	PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive);
 
 	if(status_type != NULL) {
-		GList *tmp, *active_accts = purple_accounts_get_all_active();
-		for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
-			purple_savedstatus_set_substatus(saved_status,
-				(PurpleAccount*) tmp->data, status_type, NULL);
+		PurpleAccountManager *manager = NULL;
+		GList *active_accts = NULL;
+
+		manager = purple_account_manager_get_default();
+		active_accts = purple_account_manager_get_active(manager);
+
+		while(active_accts != NULL) {
+			PurpleAccount *account = PURPLE_ACCOUNT(active_accts->data);
+
+			purple_savedstatus_set_substatus(saved_status, account,
+			                                 status_type, NULL);
+
+			active_accts = g_list_delete_link(active_accts, active_accts);
 		}
-		g_list_free(active_accts);
 	}
 
 	return saved_status;
