# HG changeset patch
# Node ID 86e007d98652
# Parent  0da91f053305
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -1764,9 +1764,17 @@
 	buf = purple_gdk_pixbuf_from_data(data, len);
 	purple_buddy_icon_unref(icon);
 	if (!buf) {
+		const char *account_name = "(no account)";
+
+		if(PURPLE_IS_ACCOUNT(account)) {
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+
+			account_name = purple_contact_info_get_username(info);
+		}
+
 		purple_debug_warning("gtkblist", "Couldn't load buddy icon on "
 			"account %s (%s); buddyname=%s; custom_img_size=%" G_GSIZE_FORMAT,
-			account ? purple_account_get_username(account) : "(no account)",
+			account_name,
 			account ? purple_account_get_protocol_id(account) : "(no account)",
 			buddy ? purple_buddy_get_name(buddy) : "(no buddy)",
 			custom_img ? purple_image_get_data_size(custom_img) : 0);
@@ -1886,6 +1894,7 @@
 static void
 add_tip_for_account(GtkWidget *grid, gint row, PurpleAccount *account)
 {
+	PurpleContactInfo *info = NULL;
 	PurpleProtocol *protocol = NULL;
 	GtkWidget *image = NULL;
 	GtkWidget *name = NULL;
@@ -1898,7 +1907,8 @@
 	gtk_image_set_pixel_size(GTK_IMAGE(image), STATUS_SIZE);
 	gtk_grid_attach(GTK_GRID(grid), image, 0, row, 1, 1);
 
-	name = gtk_label_new(purple_account_get_username(account));
+	info = PURPLE_CONTACT_INFO(account);
+	name = gtk_label_new(purple_contact_info_get_username(info));
 	gtk_label_set_xalign(GTK_LABEL(name), 0);
 	gtk_label_set_yalign(GTK_LABEL(name), 0);
 	gtk_label_set_wrap(GTK_LABEL(name), TRUE);
@@ -2173,7 +2183,9 @@
 		connections = purple_connections_get_all();
 		if (connections && connections->next)
 		{
-			tmp = g_markup_escape_text(purple_account_get_username(account), -1);
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+			tmp = g_markup_escape_text(purple_contact_info_get_username(info),
+			                           -1);
 			g_string_append_printf(str, _("<b>Account:</b> %s"), tmp);
 			g_free(tmp);
 		}
@@ -2277,8 +2289,11 @@
 		connections = purple_connections_get_all();
 		if (full && connections && connections->next)
 		{
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+			const char *username = purple_contact_info_get_username(info);
+
 			purple_notify_user_info_add_pair_plaintext(user_info, _("Account"),
-					purple_account_get_username(account));
+			                                           username);
 		}
 
 		/* Alias */
diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c
--- a/pidgin/gtknotify.c
+++ b/pidgin/gtknotify.c
@@ -116,6 +116,7 @@
 static void
 pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account)
 {
+	PurpleContactInfo *info = NULL;
 	PurpleProtocol *protocol = NULL;
 	GtkWidget *image;
 	const gchar *icon_name = NULL;
@@ -123,13 +124,13 @@
 	if (!account)
 		return;
 
+	info = PURPLE_CONTACT_INFO(account);
 	protocol = purple_account_get_protocol(account);
 	icon_name = purple_protocol_get_icon_name(protocol);
 
 	image = gtk_image_new_from_icon_name(icon_name);
 
-	gtk_widget_set_tooltip_text(image,
-		purple_account_get_username(account));
+	gtk_widget_set_tooltip_text(image, purple_contact_info_get_username(info));
 
 	if (GTK_IS_BOX(cont)) {
 		gtk_widget_set_halign(image, GTK_ALIGN_START);
@@ -539,7 +540,7 @@
 {
 	char key[256];
 	g_snprintf(key, sizeof(key), "%s - %s",
-	           purple_account_get_username(account),
+	           purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)),
 	           purple_normalize(account, who));
 	return g_utf8_strup(key, -1);
 }
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -87,6 +87,7 @@
 static void
 pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account)
 {
+	PurpleContactInfo *info = NULL;
 	PurpleProtocol *protocol = NULL;
 	GtkWidget *image;
 	const gchar *icon_name = NULL;
@@ -95,12 +96,13 @@
 		return;
 	}
 
+	info = PURPLE_CONTACT_INFO(account);
 	protocol = purple_account_get_protocol(account);
 	icon_name = purple_protocol_get_icon_name(protocol);
 
 	image = gtk_image_new_from_icon_name(icon_name);
 
-	gtk_widget_set_tooltip_text(image, purple_account_get_username(account));
+	gtk_widget_set_tooltip_text(image, purple_contact_info_get_username(info));
 
 	if (GTK_IS_BOX(cont)) {
 		gtk_widget_set_halign(image, GTK_ALIGN_START);
diff --git a/pidgin/gtkxfer.c b/pidgin/gtkxfer.c
--- a/pidgin/gtkxfer.c
+++ b/pidgin/gtkxfer.c
@@ -222,6 +222,8 @@
 static void
 update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer)
 {
+	PurpleAccount *account = NULL;
+	PurpleContactInfo *info = NULL;
 	PidginXferUiData *data;
 	char *kbsec, *time_elapsed, *time_remaining;
 	char *status, *utf8;
@@ -257,11 +259,15 @@
 							 _("<b>Sending As:</b>"));
 	}
 
+	account = purple_xfer_get_account(xfer);
+	info = PURPLE_CONTACT_INFO(account);
+
 	gtk_label_set_text(GTK_LABEL(dialog->local_user_label),
-								 purple_account_get_username(purple_xfer_get_account(xfer)));
-	gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), purple_xfer_get_remote_user(xfer));
+	                   purple_contact_info_get_username(info));
+	gtk_label_set_text(GTK_LABEL(dialog->remote_user_label),
+	                   purple_xfer_get_remote_user(xfer));
 	gtk_label_set_text(GTK_LABEL(dialog->protocol_label),
-								 purple_account_get_protocol_name(purple_xfer_get_account(xfer)));
+	                   purple_account_get_protocol_name(account));
 
 	if (purple_xfer_get_xfer_type(xfer) == PURPLE_XFER_TYPE_RECEIVE) {
 		gtk_label_set_text(GTK_LABEL(dialog->filename_label),
diff --git a/pidgin/pidginaccountchooser.c b/pidgin/pidginaccountchooser.c
--- a/pidgin/pidginaccountchooser.c
+++ b/pidgin/pidginaccountchooser.c
@@ -67,22 +67,23 @@
                                 G_GNUC_UNUSED gpointer data)
 {
 	gchar *markup = NULL;
-	const gchar *alias = NULL;
+	const char *alias = NULL;
+	const char *protocol_name = NULL;
+	const char *username = NULL;
 
 	if(!PURPLE_IS_ACCOUNT(account)) {
 		return NULL;
 	}
 
 	alias = purple_account_get_private_alias(account);
+	protocol_name = purple_account_get_protocol_name(account);
+	username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
+
 	if(alias != NULL) {
-		markup = g_strdup_printf(_("%s (%s) (%s)"),
-		                         purple_account_get_username(account),
-		                         alias,
-		                         purple_account_get_protocol_name(account));
+		markup = g_strdup_printf(_("%s (%s) (%s)"), username, alias,
+		                         protocol_name);
 	} else {
-		markup = g_strdup_printf(_("%s (%s)"),
-		                         purple_account_get_username(account),
-		                         purple_account_get_protocol_name(account));
+		markup = g_strdup_printf(_("%s (%s)"), username, protocol_name);
 	}
 
 	return markup;
diff --git a/pidgin/pidginaccounteditor.c b/pidgin/pidginaccounteditor.c
--- a/pidgin/pidginaccounteditor.c
+++ b/pidgin/pidginaccounteditor.c
@@ -135,7 +135,9 @@
 		/* The username will be split apart below and eventually set as the text
 		 * in the username entry.
 		 */
-		username = g_strdup(purple_account_get_username(editor->account));
+		PurpleContactInfo *info = PURPLE_CONTACT_INFO(editor->account);
+
+		username = g_strdup(purple_contact_info_get_username(info));
 	}
 
 	/* Filling out the user splits is a pain. If we have an account, we created
@@ -763,7 +765,9 @@
 		editor->account = purple_account_new(username->str, protocol_id);
 		new_account = TRUE;
 	} else {
-		purple_account_set_username(editor->account, username->str);
+		PurpleContactInfo *info = PURPLE_CONTACT_INFO(editor->account);
+
+		purple_contact_info_set_username(info, username->str);
 		purple_account_set_protocol_id(editor->account, protocol_id);
 	}
 
diff --git a/pidgin/pidginaccountmanager.c b/pidgin/pidginaccountmanager.c
--- a/pidgin/pidginaccountmanager.c
+++ b/pidgin/pidginaccountmanager.c
@@ -114,6 +114,7 @@
                                        PurpleAccount *account,
                                        GtkTreeIter *iter)
 {
+	PurpleContactInfo *info = NULL;
 	PurpleImage *image = NULL;
 	PurpleProtocol *protocol = NULL;
 	GdkPixbuf *avatar = NULL;
@@ -140,10 +141,11 @@
 		protocol_name = _("Unknown");
 	}
 
+	info = PURPLE_CONTACT_INFO(account);
 	gtk_list_store_set(manager->model, iter,
 	                   COLUMN_ENABLED, purple_account_get_enabled(account),
 	                   COLUMN_AVATAR, avatar,
-	                   COLUMN_USERNAME, purple_account_get_username(account),
+	                   COLUMN_USERNAME, purple_contact_info_get_username(info),
 	                   COLUMN_PROTOCOL_ICON, protocol_icon,
 	                   COLUMN_PROTOCOL_NAME, protocol_name,
 	                   COLUMN_ACCOUNT, account,
diff --git a/pidgin/pidginaccountsdisabledmenu.c b/pidgin/pidginaccountsdisabledmenu.c
--- a/pidgin/pidginaccountsdisabledmenu.c
+++ b/pidgin/pidginaccountsdisabledmenu.c
@@ -100,6 +100,7 @@
 {
 	PidginAccountsDisabledMenu *menu = NULL;
 	PurpleAccount *account = NULL;
+	PurpleContactInfo *info = NULL;
 	PurpleProtocol *protocol = NULL;
 	GVariant *value = NULL;
 	const gchar *account_name = NULL, *protocol_name = NULL;
@@ -130,7 +131,8 @@
 		return;
 	}
 
-	account_name = purple_account_get_username(account);
+	info = PURPLE_CONTACT_INFO(account);
+	account_name = purple_contact_info_get_username(info);
 	protocol_name = purple_account_get_protocol_name(account);
 
 	/* translators: This format string is intended to contain the account
@@ -145,7 +147,7 @@
 	g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION,
 	                    g_variant_ref_sink(value));
 
-	value = g_variant_new_printf("%s", purple_account_get_id(account));
+	value = g_variant_new_printf("%s", purple_contact_info_get_id(info));
 	g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET,
 	                    g_variant_ref_sink(value));
 
diff --git a/pidgin/pidginaccountsenabledmenu.c b/pidgin/pidginaccountsenabledmenu.c
--- a/pidgin/pidginaccountsenabledmenu.c
+++ b/pidgin/pidginaccountsenabledmenu.c
@@ -190,7 +190,7 @@
 		return;
 	}
 
-	account_name = purple_account_get_username(account);
+	account_name = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
 
 	/* Get the protocol from the account. */
 	protocol = purple_account_get_protocol(account);
@@ -240,7 +240,7 @@
 		return;
 	}
 
-	account_id = purple_account_get_id(account);
+	account_id = purple_contact_info_get_id(PURPLE_CONTACT_INFO(account));
 
 	connection = purple_account_get_connection(account);
 	if(PURPLE_IS_CONNECTION(connection)) {
diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c
--- a/pidgin/plugins/disco/gtkdisco.c
+++ b/pidgin/plugins/disco/gtkdisco.c
@@ -206,6 +206,7 @@
 {
 	PidginDiscoDialog *dialog = data;
 	PurpleConnection *pc;
+	PurpleContactInfo *info = NULL;
 	PidginDiscoList *pdl;
 	const char *username;
 	const char *at, *slash;
@@ -234,7 +235,8 @@
 
 	gtk_widget_set_sensitive(dialog->account_chooser, FALSE);
 
-	username = purple_account_get_username(dialog->account);
+	info = PURPLE_CONTACT_INFO(dialog->account);
+	username = purple_contact_info_get_username(info);
 	at = strchr(username, '@');
 	slash = strchr(username, '/');
 	if (at && !slash) {
diff --git a/pidgin/plugins/unity/unity.c b/pidgin/plugins/unity/unity.c
--- a/pidgin/plugins/unity/unity.c
+++ b/pidgin/plugins/unity/unity.c
@@ -89,12 +89,20 @@
 conversation_id(PurpleConversation *conv)
 {
 	PurpleAccount *account = purple_conversation_get_account(conv);
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+	const char *type = "misc";
 
-	return g_strconcat((PURPLE_IS_IM_CONVERSATION(conv) ? "im" :
-				PURPLE_IS_CHAT_CONVERSATION(conv) ? "chat" : "misc"), ":",
-			purple_conversation_get_name(conv), ":",
-			purple_account_get_username(account), ":",
-			purple_account_get_protocol_id(account), NULL);
+	if(PURPLE_IS_IM_CONVERSATION(conv)) {
+		type = "im";
+	} else if(PURPLE_IS_CHAT_CONVERSATION(conv)) {
+		type = "chat";
+	}
+
+	return g_strdup_printf("%s:%s:%s:%s",
+	                       type,
+	                       purple_conversation_get_name(conv),
+	                       purple_contact_info_get_username(info),
+	                       purple_account_get_protocol_id(account));
 }
 
 static void
