# HG changeset patch
# Node ID 3dae31b8c564
# Parent  83144d32517f
diff --git a/libpurple/plugins/idle/idle.c b/libpurple/plugins/idle/idle.c
--- a/libpurple/plugins/idle/idle.c
+++ b/libpurple/plugins/idle/idle.c
@@ -57,21 +57,22 @@
 static void
 set_idle_time(PurpleAccount *acct, int mins_idle)
 {
+	PurpleConnection *gc = purple_account_get_connection(acct);
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(acct);
+	PurplePresence *presence = purple_account_get_presence(acct);
 	time_t t;
-	PurpleConnection *gc = purple_account_get_connection(acct);
-	PurplePresence *presence = purple_account_get_presence(acct);
 
 	if (!gc)
 		return;
 
-	purple_debug_info("idle",
-			"setting idle time for %s to %d\n",
-			purple_account_get_username(acct), mins_idle);
+	purple_debug_info("idle", "setting idle time for %s to %d\n",
+	                  purple_contact_info_get_username(info), mins_idle);
 
-	if (mins_idle)
+	if (mins_idle) {
 		t = time(NULL) - (60 * mins_idle); /* subtract seconds idle from current time */
-	else
+	} else {
 		t = 0; /* time idle is irrelevant */
+	}
 
 	purple_presence_set_idle(presence, mins_idle ? TRUE : FALSE, t);
 }
@@ -79,15 +80,14 @@
 static void
 idle_action_ok(void *ignored, PurpleRequestFields *fields)
 {
+	PurpleAccount *acct = purple_request_fields_get_account(fields, "acct");
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(acct);
 	int tm = purple_request_fields_get_integer(fields, "mins");
-	PurpleAccount *acct = purple_request_fields_get_account(fields, "acct");
 
 	/* only add the account to the GList if it's not already been idled */
-	if (!unidle_filter(acct))
-	{
-		purple_debug_misc("idle",
-				"%s hasn't been idled yet; adding to list.\n",
-				purple_account_get_username(acct));
+	if(!unidle_filter(acct)) {
+		purple_debug_misc("idle", "%s hasn't been idled yet; adding to list.\n",
+		                  purple_contact_info_get_username(info));
 		idled_accts = g_list_append(idled_accts, acct);
 	}
 
@@ -108,8 +108,10 @@
 		acct = (PurpleAccount *)(iter->data);
 
 		if(acct && idleable_filter(acct)) {
+			PurpleContactInfo *info = PURPLE_CONTACT_INFO(acct);
+
 			purple_debug_misc("idle", "Idling %s.\n",
-					purple_account_get_username(acct));
+			                  purple_contact_info_get_username(info));
 
 			set_idle_time(acct, tm);
 
diff --git a/libpurple/plugins/keychain-access/keychain-access.c b/libpurple/plugins/keychain-access/keychain-access.c
--- a/libpurple/plugins/keychain-access/keychain-access.c
+++ b/libpurple/plugins/keychain-access/keychain-access.c
@@ -90,6 +90,7 @@
                                            GAsyncReadyCallback callback,
                                            gpointer data)
 {
+	PurpleContactInfo *info = NULL;
 	GTask *task = NULL;
 	const gchar *account_name = NULL;
 	CFStringRef keys[4];
@@ -102,7 +103,8 @@
 	g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
-	account_name = purple_account_get_username(account);
+	info = PURPLE_CONTACT_INFO(account);
+	account_name = purple_contact_info_get_username(info);
 	cf_account_name = CFStringCreateWithCString(kCFAllocatorDefault,
 	                                            account_name,
 	                                            kCFStringEncodingUTF8);
@@ -186,6 +188,7 @@
                                             GAsyncReadyCallback callback,
                                             gpointer data)
 {
+	PurpleContactInfo *info = NULL;
 	GTask *task = NULL;
 	const gchar *account_name = NULL;
 	CFStringRef keys[3];
@@ -198,7 +201,8 @@
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(password != NULL);
 
-	account_name = purple_account_get_username(account);
+	info = PURPLE_CONTACT_INFO(account);
+	account_name = purple_contact_info_get_username(info);
 	cf_account_name = CFStringCreateWithCString(kCFAllocatorDefault,
 	                                            account_name,
 	                                            kCFStringEncodingUTF8);
@@ -259,6 +263,7 @@
                                             GAsyncReadyCallback callback,
                                             gpointer data)
 {
+	PurpleContactInfo *info = NULL;
 	GTask *task = NULL;
 	const gchar *account_name = NULL;
 	CFStringRef keys[2];
@@ -270,7 +275,8 @@
 	g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
-	account_name = purple_account_get_username(account);
+	info = PURPLE_CONTACT_INFO(account);
+	account_name = purple_contact_info_get_username(info);
 	cf_account_name = CFStringCreateWithCString(kCFAllocatorDefault,
 	                                            account_name,
 	                                            kCFStringEncodingUTF8);
diff --git a/libpurple/plugins/kwallet/purplekwallet.cpp b/libpurple/plugins/kwallet/purplekwallet.cpp
--- a/libpurple/plugins/kwallet/purplekwallet.cpp
+++ b/libpurple/plugins/kwallet/purplekwallet.cpp
@@ -70,8 +70,10 @@
 
 static QString
 purple_kwallet_provider_account_key(PurpleAccount *account) {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+
 	return QString(purple_account_get_protocol_id(account)) + ":" +
-	               purple_account_get_username(account);
+	               purple_contact_info_get_username(info);
 }
 
 /******************************************************************************
diff --git a/libpurple/plugins/libsecret/libsecret.c b/libpurple/plugins/libsecret/libsecret.c
--- a/libpurple/plugins/libsecret/libsecret.c
+++ b/libpurple/plugins/libsecret/libsecret.c
@@ -147,11 +147,12 @@
                                      GAsyncReadyCallback callback,
                                      gpointer data)
 {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
 
 	secret_password_lookup(&purple_libsecret_schema, cancellable,
                            purple_libsecret_read_password_callback, task,
-                           "user", purple_account_get_username(account),
+                           "user", purple_contact_info_get_username(info),
                            "protocol", purple_account_get_protocol_id(account),
                            NULL);
 }
@@ -175,12 +176,13 @@
                                       GAsyncReadyCallback callback,
                                       gpointer data)
 {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = NULL;
 	gchar *label = NULL;
 	const gchar *username = NULL;
 
 	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
-	username = purple_account_get_username(account);
+	username = purple_contact_info_get_username(info);
 
 	label = g_strdup_printf(_("libpurple password for account %s"), username);
 	secret_password_store(&purple_libsecret_schema,
@@ -211,11 +213,12 @@
                                       GAsyncReadyCallback callback,
                                       gpointer data)
 {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
 
 	secret_password_clear(&purple_libsecret_schema, cancellable,
 	                      purple_libsecret_clear_password_callback, task,
-	                      "user", purple_account_get_username(account),
+	                      "user", purple_contact_info_get_username(info),
 	                      "protocol", purple_account_get_protocol_id(account),
 	                      NULL);
 }
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
@@ -59,14 +59,17 @@
 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(account != NULL, NULL);
+	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_account_get_username(account));
+		purple_contact_info_get_username(info));
 
 	target_name_utf16 =
 	        g_utf8_to_utf16(target_name_utf8, -1, NULL, NULL, error);
@@ -104,9 +107,10 @@
 
 		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_account_get_username(account));
+				                  "No password found for account %s\n",
+				                  purple_contact_info_get_username(info));
 			}
 			error = g_error_new(PURPLE_WINCRED_ERROR,
 				error_code,
@@ -150,9 +154,10 @@
 		g_object_unref(G_OBJECT(task));
 		return;
 	} else {
+		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 		purple_debug_misc("keyring-wincred",
-			_("Got password for account %s.\n"),
-			purple_account_get_username(account));
+		                  _("Got password for account %s.\n"),
+		                  purple_contact_info_get_username(info));
 	}
 
 	g_task_return_pointer(task, password, g_free);
@@ -176,8 +181,10 @@
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback, gpointer data)
 {
+	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = NULL;
 	GError *error = NULL;
+	const char *username_utf8 = NULL;
 	gunichar2 *target_name = NULL;
 	gunichar2 *username_utf16 = NULL;
 	gunichar2 *password_utf16 = NULL;
@@ -193,8 +200,8 @@
 		return;
 	}
 
-	username_utf16 = g_utf8_to_utf16(purple_account_get_username(account), -1,
-	                                 NULL, NULL, &error);
+	username_utf8 = purple_contact_info_get_username(info);
+	username_utf16 = g_utf8_to_utf16(username_utf8, -1, NULL, NULL, &error);
 	if (username_utf16 == NULL) {
 		g_free(target_name);
 		purple_debug_error("keyring-wincred", "Couldn't convert username");
@@ -239,7 +246,7 @@
 		}
 	} else {
 		purple_debug_misc("keyring-wincred", "Password updated for account %s.",
-		                  purple_account_get_username(account));
+		                  purple_contact_info_get_username(info));
 	}
 
 	g_free(target_name);
@@ -285,8 +292,10 @@
 	}
 
 	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_account_get_username(account));
+		                  purple_contact_info_get_username(info));
 		g_task_return_boolean(task, TRUE);
 	} else {
 		DWORD error_code = GetLastError();
