# HG changeset patch
# Node ID a40974216fb1
# Parent  f550a2d2c0f6
diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -64,15 +64,17 @@
 static GList *accountdialogs;
 
 static void
-account_add(PurpleAccount *account)
-{
-	gnt_tree_add_choice(GNT_TREE(accounts.tree), account,
-			gnt_tree_create_row(GNT_TREE(accounts.tree),
-				purple_account_get_username(account),
-				purple_account_get_protocol_name(account)),
-			NULL, NULL);
+account_add(PurpleAccount *account) {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+	GntTreeRow *row = NULL;
+
+	row = gnt_tree_create_row(GNT_TREE(accounts.tree),
+	                          purple_contact_info_get_username(info),
+	                          purple_account_get_protocol_name(account));
+
+	gnt_tree_add_choice(GNT_TREE(accounts.tree), account, row, NULL, NULL);
 	gnt_tree_set_choice(GNT_TREE(accounts.tree), account,
-			purple_account_get_enabled(account));
+	                    purple_account_get_enabled(account));
 }
 
 static void
@@ -88,6 +90,7 @@
 save_account_cb(AccountEditDialog *dialog)
 {
 	PurpleAccount *account;
+	PurpleContactInfo *info = NULL;
 	PurpleProtocol *protocol;
 	const char *value;
 	GString *username;
@@ -136,14 +139,17 @@
 		PurpleAccountManager *manager = purple_account_manager_get_default();
 
 		account = purple_account_new(username->str, purple_protocol_get_id(protocol));
+		info = PURPLE_CONTACT_INFO(account);
 		purple_account_manager_add(manager, account);
 	} else {
 		account = dialog->account;
+		info = PURPLE_CONTACT_INFO(account);
 
 		/* Protocol */
 		if (purple_account_is_disconnected(account)) {
-			purple_account_set_protocol_id(account, purple_protocol_get_id(protocol));
-			purple_account_set_username(account, username->str);
+			purple_account_set_protocol_id(account,
+			                               purple_protocol_get_id(protocol));
+			purple_contact_info_set_username(info, username->str);
 		} else {
 			const char *old = purple_account_get_protocol_id(account);
 			char *oldproto;
@@ -159,7 +165,7 @@
 				return;
 			}
 
-			oldproto = g_strdup(purple_normalize(account, purple_account_get_username(account)));
+			oldproto = g_strdup(purple_normalize(account, purple_contact_info_get_username(info)));
 			if (g_utf8_collate(oldproto, purple_normalize(account, username->str))) {
 				purple_notify_error(NULL, _("Error"),
 					_("Account was not modified"),
@@ -173,14 +179,14 @@
 				return;
 			}
 			g_free(oldproto);
-			purple_account_set_username(account, username->str);
+			purple_contact_info_set_username(info, username->str);
 		}
 	}
 	g_string_free(username, TRUE);
 
 	/* Alias */
 	value = gnt_entry_get_text(GNT_ENTRY(dialog->alias));
-	purple_account_set_private_alias(account, value);
+	purple_contact_info_set_alias(info, value);
 
 	/* Remember password and require password */
 	purple_account_set_remember_password(account,
@@ -257,7 +263,7 @@
 	 */
 	if (dialog->account != NULL && accounts.window) {
 		gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account,
-				0, purple_account_get_username(dialog->account));
+				0, purple_contact_info_get_username(info));
 		gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account,
 				1, purple_account_get_protocol_name(dialog->account));
 	}
@@ -291,7 +297,11 @@
 	if (!protocol)
 		return;
 
-	username = dialog->account ? g_strdup(purple_account_get_username(dialog->account)) : NULL;
+	if(PURPLE_IS_ACCOUNT(dialog->account)) {
+		PurpleContactInfo *info = PURPLE_CONTACT_INFO(dialog->account);
+
+		username = g_strdup(purple_contact_info_get_username(info));
+	}
 
 	splits = purple_protocol_get_user_splits(protocol);
 	for (iter = splits; iter; iter = iter->next)
@@ -688,15 +698,19 @@
 static void
 delete_account_cb(GntWidget *widget, GntTree *tree)
 {
-	PurpleAccount *account;
-	char *prompt;
+	PurpleAccount *account = NULL;
+	PurpleContactInfo *info = NULL;
+	char *prompt = NULL;
 
-	account  = gnt_tree_get_selection_data(tree);
-	if (!account)
+	account = gnt_tree_get_selection_data(tree);
+	if(!PURPLE_IS_ACCOUNT(account)) {
 		return;
+	}
+
+	info = PURPLE_CONTACT_INFO(account);
 
 	prompt = g_strdup_printf(_("Are you sure you want to delete %s?"),
-			purple_account_get_username(account));
+	                         purple_contact_info_get_username(info));
 
 	purple_request_action(account, _("Delete Account"), prompt, NULL,
 		PURPLE_DEFAULT_ACTION_NONE,
diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -254,12 +254,17 @@
 
 		title = g_strdup(purple_group_get_name(group));
 	} else if (PURPLE_IS_CHAT(node)) {
-		PurpleChat *chat = (PurpleChat *)node;
-		PurpleAccount *account = purple_chat_get_account(chat);
+		PurpleAccount *account = NULL;
+		PurpleContactInfo *info = NULL;
+		PurpleChat *chat = NULL;
+
+		chat = PURPLE_CHAT(node);
+		account = purple_chat_get_account(chat);
+		info = PURPLE_CONTACT_INFO(account);
 
 		g_string_append_printf(str, _("Account: %s (%s)"),
-				purple_account_get_username(account),
-				purple_account_get_protocol_name(account));
+		                       purple_contact_info_get_username(info),
+		                       purple_account_get_protocol_name(account));
 
 		title = g_strdup(purple_chat_get_name(chat));
 	} else {
@@ -1544,16 +1549,18 @@
 static void
 tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full)
 {
-	PurpleProtocol *protocol;
-	PurpleAccount *account;
+	PurpleAccount *account = NULL;
+	PurpleContactInfo *info = NULL;
+	PurplePresence *presence = NULL;
+	PurpleProtocol *protocol = NULL;
 	PurpleNotifyUserInfo *user_info;
-	PurplePresence *presence;
 	const char *alias = purple_buddy_get_alias(buddy);
 	char *tmp, *strip;
 
 	user_info = purple_notify_user_info_new();
 
 	account = purple_buddy_get_account(buddy);
+	info = PURPLE_CONTACT_INFO(account);
 	presence = purple_buddy_get_presence(buddy);
 
 	if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) {
@@ -1561,8 +1568,8 @@
 	}
 
 	tmp = g_strdup_printf("%s (%s)",
-			purple_account_get_username(account),
-			purple_account_get_protocol_name(account));
+	                      purple_contact_info_get_username(info),
+	                      purple_account_get_protocol_name(account));
 	purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp);
 	g_free(tmp);
 
@@ -2413,7 +2420,8 @@
 #if 0
 		/* TODO: port to PurpleProtocolActions */
 		if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT, get_actions)) {
-			item = gnt_menuitem_new(purple_account_get_username(account));
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+			item = gnt_menuitem_new(purple_contact_info_get_username(info));
 			gnt_menu_add_item(GNT_MENU(sub), item);
 			build_protocol_actions(item, protocol, gc);
 		}
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -233,12 +233,13 @@
 }
 
 static char *
-get_conversation_title(PurpleConversation *conv, PurpleAccount *account)
-{
+get_conversation_title(PurpleConversation *conv, PurpleAccount *account) {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+
 	return g_strdup_printf(_("%s (%s -- %s)"),
-		purple_conversation_get_title(conv),
-		purple_account_get_username(account),
-		purple_account_get_protocol_name(account));
+	                       purple_conversation_get_title(conv),
+	                       purple_contact_info_get_username(info),
+	                       purple_account_get_protocol_name(account));
 }
 
 static void
@@ -537,8 +538,10 @@
 		PurplePresence *pre = list->data;
 		PurpleBuddy *buddy = purple_buddy_presence_get_buddy(PURPLE_BUDDY_PRESENCE(pre));
 		PurpleAccount *account = purple_buddy_get_account(buddy);
+		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 		gchar *name = g_strdup(purple_buddy_get_name(buddy));
-		gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_account_get_username(account));
+		gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_contact_info_get_username(info));
+
 		item = gnt_menuitem_new(text);
 		g_free(text);
 		gnt_menu_add_item(GNT_MENU(sub), item);
diff --git a/finch/gntnotify.c b/finch/gntnotify.c
--- a/finch/gntnotify.c
+++ b/finch/gntnotify.c
@@ -157,7 +157,11 @@
 userinfo_hash(PurpleAccount *account, const char *who)
 {
 	char key[256];
-	g_snprintf(key, sizeof(key), "%s - %s", purple_account_get_username(account), purple_normalize(account, who));
+
+	g_snprintf(key, sizeof(key), "%s - %s",
+	           purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)),
+	           purple_normalize(account, who));
+
 	return g_utf8_strup(key, -1);
 }
 
diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -516,10 +516,11 @@
 
 static void
 add_account_to_combo(GntWidget *combo, PurpleAccount *account) {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	char *text = NULL;
 
 	text = g_strdup_printf("%s (%s)",
-	                       purple_account_get_username(account),
+	                       purple_contact_info_get_username(info),
 	                       purple_account_get_protocol_name(account));
 	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text);
 	g_free(text);
diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c
--- a/finch/gntroomlist.c
+++ b/finch/gntroomlist.c
@@ -165,12 +165,16 @@
 		PurpleConnection *gc = list->data;
 
 		protocol = purple_connection_get_protocol(gc);
-		if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
-		        PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)) {
+		if(PURPLE_CONNECTION_IS_CONNECTED(gc) &&
+		   PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list))
+		{
 			PurpleAccount *account = purple_connection_get_account(gc);
-			char *text = g_strdup_printf("%s (%s)",
-					purple_account_get_username(account),
-					purple_account_get_protocol_name(account));
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+			char *text = NULL;
+
+			text = g_strdup_printf("%s (%s)",
+			                       purple_contact_info_get_username(info),
+			                       purple_account_get_protocol_name(account));
 			gnt_combo_box_add_data(accounts, account, text);
 			g_free(text);
 		}
diff --git a/finch/gntstatus.c b/finch/gntstatus.c
--- a/finch/gntstatus.c
+++ b/finch/gntstatus.c
@@ -334,36 +334,44 @@
 static void
 add_substatus(EditStatus *edit, PurpleAccount *account)
 {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+	PurpleSavedStatusSub *sub = NULL;
+	GntTreeRow *row = NULL;
 	char *name;
 	const char *type = NULL, *message = NULL;
-	PurpleSavedStatusSub *sub = NULL;
 	RowInfo *key;
 
-	if (!edit || !edit->tree)
+	if(!edit || !edit->tree) {
 		return;
+	}
 
-	if (edit->saved)
+	if(edit->saved) {
 		sub = purple_savedstatus_get_substatus(edit->saved, account);
+	}
 
 	key = g_new0(RowInfo, 1);
 	key->account = account;
 
-	if (sub)
-	{
+	if(sub) {
 		key->type = purple_savedstatus_substatus_get_status_type(sub);
 		type = purple_status_type_get_name(key->type);
 		message = purple_savedstatus_substatus_get_message(sub);
 		key->message = g_strdup(message);
 	}
 
-	name = g_strdup_printf("%s (%s)", purple_account_get_username(account),
-			purple_account_get_protocol_name(account));
-	gnt_tree_add_choice(GNT_TREE(edit->tree), key,
-			gnt_tree_create_row(GNT_TREE(edit->tree),
-				name, type ? type : "", message ? message : ""), NULL, NULL);
+	name = g_strdup_printf("%s (%s)",
+	                       purple_contact_info_get_username(info),
+	                       purple_account_get_protocol_name(account));
 
-	if (sub)
+	row = gnt_tree_create_row(GNT_TREE(edit->tree), name,
+	                          type ? type : "",
+	                          message ? message : "");
+	gnt_tree_add_choice(GNT_TREE(edit->tree), key, row, NULL, NULL);
+
+	if(sub) {
 		gnt_tree_set_choice(GNT_TREE(edit->tree), key, TRUE);
+	}
+
 	g_free(name);
 }
 
@@ -406,6 +414,7 @@
 	{
 		EditSubStatus *sub;
 		GntWidget *window, *combo, *entry, *box, *button, *l;
+		PurpleContactInfo *info = NULL;
 		PurpleSavedStatusSub *substatus = NULL;
 		GList *iter;
 		char *name;
@@ -442,8 +451,10 @@
 
 		box = gnt_hbox_new(FALSE);
 		gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Account:")));
-		name = g_strdup_printf("%s (%s)", purple_account_get_username(account),
-				purple_account_get_protocol_name(account));
+		info = PURPLE_CONTACT_INFO(account);
+		name = g_strdup_printf("%s (%s)",
+		                       purple_contact_info_get_username(info),
+		                       purple_account_get_protocol_name(account));
 		gnt_box_add_widget(GNT_BOX(box), gnt_label_new(name));
 		g_free(name);
 		gnt_box_add_widget(GNT_BOX(window), box);
