# HG changeset patch
# Node ID 52c409c8495258e7a64d7c31f0bc2566bd7dcbf6
# Parent  6cd6a24b3365cc1f54181cf81043d42d18b00cfa
diff --git a/libpurple/plugins/wincred/wincred.c b/libpurple/plugins/wincred/wincred.c
--- a/libpurple/plugins/wincred/wincred.c
+++ b/libpurple/plugins/wincred/wincred.c
@@ -60,17 +60,14 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED(PurpleWin
 static gunichar2 *
 wincred_get_target_name(PurpleAccount *account, GError **error)
 {
-	PurpleContactInfo *info = NULL;
 	gchar target_name_utf8[WINCRED_MAX_TARGET_NAME];
 	gunichar2 *target_name_utf16;
 
 	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
 
-	info = PURPLE_CONTACT_INFO(account);
-
 	g_snprintf(target_name_utf8, WINCRED_MAX_TARGET_NAME, "libpurple_%s_%s",
 		purple_account_get_protocol_id(account),
-		purple_contact_info_get_username(info));
+		purple_account_get_username(account));
 
 	target_name_utf16 =
 	        g_utf8_to_utf16(target_name_utf8, -1, NULL, NULL, error);
@@ -110,10 +107,9 @@ purple_wincred_read_password_async(Purpl
 
 		if (error_code == ERROR_NOT_FOUND) {
 			if (purple_debug_is_verbose()) {
-				PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 				purple_debug_misc("keyring-wincred",
 				                  "No password found for account %s\n",
-				                  purple_contact_info_get_username(info));
+				                  purple_account_get_username(account));
 			}
 			error = g_error_new(PURPLE_WINCRED_ERROR,
 				error_code,
@@ -157,10 +153,9 @@ purple_wincred_read_password_async(Purpl
 		g_object_unref(task);
 		return;
 	} else {
-		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 		purple_debug_misc("keyring-wincred",
 		                  _("Got password for account %s.\n"),
-		                  purple_contact_info_get_username(info));
+		                  purple_account_get_username(account));
 	}
 
 	g_task_return_pointer(task, password, g_free);
@@ -184,7 +179,6 @@ purple_wincred_write_password_async(Purp
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback, gpointer data)
 {
-	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = NULL;
 	GError *error = NULL;
 	const char *username_utf8 = NULL;
@@ -204,7 +198,7 @@ purple_wincred_write_password_async(Purp
 		return;
 	}
 
-	username_utf8 = purple_contact_info_get_username(info);
+	username_utf8 = purple_account_get_username(account);
 	username_utf16 = g_utf8_to_utf16(username_utf8, -1, NULL, NULL, &error);
 	if (username_utf16 == NULL) {
 		g_free(target_name);
@@ -250,7 +244,7 @@ purple_wincred_write_password_async(Purp
 		}
 	} else {
 		purple_debug_misc("keyring-wincred", "Password updated for account %s.",
-		                  purple_contact_info_get_username(info));
+		                  username_utf8);
 	}
 
 	g_free(target_name);
@@ -297,10 +291,8 @@ purple_wincred_clear_password_async(Purp
 	}
 
 	if (CredDeleteW(target_name, CRED_TYPE_GENERIC, 0)) {
-		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
-
 		purple_debug_misc("keyring-wincred", "Password for account %s removed",
-		                  purple_contact_info_get_username(info));
+		                  purple_account_get_username(account));
 		g_task_return_boolean(task, TRUE);
 	} else {
 		DWORD error_code = GetLastError();
diff --git a/libpurple/purpleaccount.c b/libpurple/purpleaccount.c
--- a/libpurple/purpleaccount.c
+++ b/libpurple/purpleaccount.c
@@ -247,8 +247,9 @@ request_password_write_cb(GObject *obj, 
 
 	if(!purple_credential_manager_write_password_finish(manager, res, &error))
 	{
-		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
-		const char *name = purple_contact_info_get_name_for_display(info);
+		const char *name = NULL;
+
+		name = purple_contact_info_get_name_for_display(account->contact_info);
 
 		/* we can't error an account without a connection, so we just drop a
 		 * debug message for now and continue to connect the account.
@@ -1259,7 +1260,7 @@ purple_account_request_password(PurpleAc
 	/* Close any previous password request windows */
 	purple_request_close_with_handle(account);
 
-	username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
+	username = purple_account_get_username(account);
 	primary = g_strdup_printf(_("Enter password for %s (%s)"), username,
 	                          purple_protocol_get_name(account->protocol));
 
@@ -1762,7 +1763,7 @@ purple_account_thaw_notify_settings(Purp
 
 		g_critical("purple_account_settings_thaw_notify called for account %s "
 		           "(%s) when not frozen",
-		           purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)),
+		           purple_account_get_username(account),
 		           purple_account_get_protocol_id(account));
 
 		return;
