# HG changeset patch
# Node ID 9bb73a3b9b20726e16337136e78cf220b404d775
# Parent  0bf52e85b83689dacbe1daecd60efa2417751df7
diff --git a/libpurple/purpleauthorizationrequest.c b/libpurple/purpleauthorizationrequest.c
--- a/libpurple/purpleauthorizationrequest.c
+++ b/libpurple/purpleauthorizationrequest.c
@@ -25,10 +25,7 @@
 struct _PurpleAuthorizationRequest {
 	GObject parent;
 
-	PurpleAccount *account;
-
-	char *username;
-	char *alias;
+	PurpleContact *contact;
 	char *message;
 	gboolean add;
 
@@ -45,9 +42,7 @@
 
 enum {
 	PROP_0,
-	PROP_ACCOUNT,
-	PROP_USERNAME,
-	PROP_ALIAS,
+	PROP_CONTACT,
 	PROP_MESSAGE,
 	PROP_ADD,
 	N_PROPERTIES,
@@ -58,25 +53,14 @@
  * Helpers
  *****************************************************************************/
 static void
-purple_authorization_request_set_account(PurpleAuthorizationRequest *request,
-                                         PurpleAccount *account)
+purple_authorization_request_set_contact(PurpleAuthorizationRequest *request,
+                                         PurpleContact *contact)
 {
 	g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
-	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-
-	if(g_set_object(&request->account, account)) {
-		g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_ACCOUNT]);
-	}
-}
+	g_return_if_fail(PURPLE_IS_CONTACT(contact));
 
-static void
-purple_authorization_request_set_username(PurpleAuthorizationRequest *request,
-                                          const char *username)
-{
-	g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
-
-	if(g_set_str(&request->username, username)) {
-		g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_USERNAME]);
+	if(g_set_object(&request->contact, contact)) {
+		g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_CONTACT]);
 	}
 }
 
@@ -93,17 +77,9 @@
 	PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
 
 	switch(param_id) {
-	case PROP_ACCOUNT:
+	case PROP_CONTACT:
 		g_value_set_object(value,
-		                   purple_authorization_request_get_account(request));
-		break;
-	case PROP_USERNAME:
-		g_value_set_string(value,
-		                   purple_authorization_request_get_username(request));
-		break;
-	case PROP_ALIAS:
-		g_value_set_string(value,
-		                   purple_authorization_request_get_alias(request));
+		                   purple_authorization_request_get_contact(request));
 		break;
 	case PROP_MESSAGE:
 		g_value_set_string(value,
@@ -127,18 +103,10 @@
 	PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
 
 	switch(param_id) {
-	case PROP_ACCOUNT:
-		purple_authorization_request_set_account(request,
+	case PROP_CONTACT:
+		purple_authorization_request_set_contact(request,
 		                                         g_value_get_object(value));
 		break;
-	case PROP_USERNAME:
-		purple_authorization_request_set_username(request,
-		                                          g_value_get_string(value));
-		break;
-	case PROP_ALIAS:
-		purple_authorization_request_set_alias(request,
-		                                       g_value_get_string(value));
-		break;
 	case PROP_MESSAGE:
 		purple_authorization_request_set_message(request,
 		                                         g_value_get_string(value));
@@ -157,7 +125,7 @@
 purple_authorization_request_dispose(GObject *obj) {
 	PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
 
-	g_clear_object(&request->account);
+	g_clear_object(&request->contact);
 
 	G_OBJECT_CLASS(purple_authorization_request_parent_class)->dispose(obj);
 }
@@ -166,8 +134,6 @@
 purple_authorization_request_finalize(GObject *obj) {
 	PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
 
-	g_clear_pointer(&request->username, g_free);
-	g_clear_pointer(&request->alias, g_free);
 	g_clear_pointer(&request->message, g_free);
 
 	G_OBJECT_CLASS(purple_authorization_request_parent_class)->finalize(obj);
@@ -189,42 +155,18 @@
 	obj_class->finalize = purple_authorization_request_finalize;
 
 	/**
-	 * PurpleAuthorizationRequest:account:
+	 * PurpleAuthorizationRequest:contact:
 	 *
-	 * The account that this authorization request is for.
+	 * The contact that this authorization request is for.
 	 *
 	 * Since: 3.0
 	 */
-	properties[PROP_ACCOUNT] = g_param_spec_object(
-		"account", NULL, NULL,
-		PURPLE_TYPE_ACCOUNT,
+	properties[PROP_CONTACT] = g_param_spec_object(
+		"contact", NULL, NULL,
+		PURPLE_TYPE_CONTACT,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
 	/**
-	 * PurpleAuthorizationRequest:username:
-	 *
-	 * The username of the remote user that is requesting authorization.
-	 *
-	 * Since: 3.0
-	 */
-	properties[PROP_USERNAME] = g_param_spec_string(
-		"username", NULL, NULL,
-		NULL,
-		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
-	/**
-	 * PurpleAuthorizationRequest:alias:
-	 *
-	 * The alias of the remote user that is requesting authorization.
-	 *
-	 * Since: 3.0
-	 */
-	properties[PROP_ALIAS] = g_param_spec_string(
-		"alias", NULL, NULL,
-		NULL,
-		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
-	/**
 	 * PurpleAuthorizationRequest:message:
 	 *
 	 * The optional message sent from the remote user.
@@ -298,49 +240,20 @@
  * Public API
  *****************************************************************************/
 PurpleAuthorizationRequest *
-purple_authorization_request_new(PurpleAccount *account, const char *username)
-{
-	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
-	g_return_val_if_fail(username != NULL, NULL);
+purple_authorization_request_new(PurpleContact *contact) {
+	g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL);
 
 	return g_object_new(
 		PURPLE_TYPE_AUTHORIZATION_REQUEST,
-		"account", account,
-		"username", username,
+		"contact", contact,
 		NULL);
 }
 
-PurpleAccount *
-purple_authorization_request_get_account(PurpleAuthorizationRequest *request) {
-	g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
-
-	return request->account;
-}
-
-const char *
-purple_authorization_request_get_username(PurpleAuthorizationRequest *request)
-{
+PurpleContact *
+purple_authorization_request_get_contact(PurpleAuthorizationRequest *request) {
 	g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
 
-	return request->username;
-}
-
-void
-purple_authorization_request_set_alias(PurpleAuthorizationRequest *request,
-                                       const char *alias)
-{
-	g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
-
-	if(g_set_str(&request->alias, alias)) {
-		g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_ALIAS]);
-	}
-}
-
-const char *
-purple_authorization_request_get_alias(PurpleAuthorizationRequest *request) {
-	g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
-
-	return request->alias;
+	return request->contact;
 }
 
 void
diff --git a/libpurple/purpleauthorizationrequest.h b/libpurple/purpleauthorizationrequest.h
--- a/libpurple/purpleauthorizationrequest.h
+++ b/libpurple/purpleauthorizationrequest.h
@@ -30,7 +30,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include "purpleaccount.h"
+#include "purplecontact.h"
 #include "purpleversion.h"
 
 G_BEGIN_DECLS
@@ -53,10 +53,9 @@
 
 /**
  * purple_authorization_request_new:
- * @account: The account that this request is for.
- * @username: The username of the user requesting authorization.
+ * @contact: The contact of the user requesting authorization.
  *
- * Creates a new [class@Purple.AuthorizationRequest] for @username on @account.
+ * Creates a new [class@Purple.AuthorizationRequest] for @contact.
  *
  * This is typically only used by libpurple itself.
  *
@@ -65,59 +64,20 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-PurpleAuthorizationRequest *purple_authorization_request_new(PurpleAccount *account, const char *username);
+PurpleAuthorizationRequest *purple_authorization_request_new(PurpleContact *contact);
 
 /**
- * purple_authorization_request_get_account:
+ * purple_authorization_request_get_contact:
  * @request: The instance.
  *
- * Gets the [class@Account] for @request.
- *
- * Returns: (transfer none): The account.
+ * Gets the contact for the user requesting authorization.
  *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-PurpleAccount *purple_authorization_request_get_account(PurpleAuthorizationRequest *request);
-
-/**
- * purple_authorization_request_get_username:
- * @request: The instance.
- *
- * Gets the username for the user requesting authorization.
- *
- * Returns: The username of the remote user.
+ * Returns: (transfer none): The contact of the remote user.
  *
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-const char *purple_authorization_request_get_username(PurpleAuthorizationRequest *request);
-
-/**
- * purple_authorization_request_set_alias:
- * @request: The instance.
- * @alias: (nullable): The alias of the remote user.
- *
- * Sets the alias of the remote user to @alias. User interfaces can use this
- * when presenting the authorization request to the end user.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_authorization_request_set_alias(PurpleAuthorizationRequest *request, const char *alias);
-
-/**
- * purple_authorization_request_get_alias:
- * @request: The instance.
- *
- * Gets the alias of the remote user if one was set.
- *
- * Returns: (nullable): The alias if one was set.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-const char *purple_authorization_request_get_alias(PurpleAuthorizationRequest *request);
+PurpleContact *purple_authorization_request_get_contact(PurpleAuthorizationRequest *request);
 
 /**
  * purple_authorization_request_set_message:
diff --git a/libpurple/purplenotificationauthorizationrequest.c b/libpurple/purplenotificationauthorizationrequest.c
--- a/libpurple/purplenotificationauthorizationrequest.c
+++ b/libpurple/purplenotificationauthorizationrequest.c
@@ -40,9 +40,9 @@
 };
 
 static void
-purple_notification_authorization_request_request_changed_cb(GObject *obj,
-                                                             GParamSpec *pspec,
-                                                             gpointer data);
+purple_notification_authorization_request_notify_cb(GObject *obj,
+                                                    GParamSpec *pspec,
+                                                    gpointer data);
 
 /******************************************************************************
  * Helpers
@@ -52,28 +52,22 @@
 {
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
+	PurpleContact *contact = NULL;
+	PurpleContactInfo *account_info = NULL;
+	PurpleContactInfo *contact_info = NULL;
 	PurpleNotification *notification = PURPLE_NOTIFICATION(auth_notification);
 	char *title = NULL;
-	const char *alias = NULL;
-	const char *username = NULL;
 
 	request = auth_notification->authorization_request;
-	account = purple_authorization_request_get_account(request);
-	username = purple_authorization_request_get_username(request);
-	alias = purple_authorization_request_get_alias(request);
+	contact = purple_authorization_request_get_contact(request);
+	contact_info = PURPLE_CONTACT_INFO(contact);
 
-	if(!purple_strempty(alias)) {
-		title = g_strdup_printf(_("%s (%s) would like to add %s to their"
-		                          " contact list"),
-		                        alias, username,
-		                        purple_account_get_username(account));
-	} else {
-		title = g_strdup_printf(_("%s would like to add %s to their contact"
-		                          " list"),
-		                        username,
-		                        purple_account_get_username(account));
-	}
+	account = purple_contact_get_account(contact);
+	account_info = purple_account_get_contact_info(account);
 
+	title = g_strdup_printf(_("%s would like to add %s to their contact list"),
+	                        purple_contact_info_get_name_for_display(contact_info),
+	                        purple_contact_info_get_name_for_display(account_info));
 	purple_notification_set_title(notification, title);
 	g_free(title);
 }
@@ -91,12 +85,18 @@
 		g_object_freeze_notify(obj);
 
 		if(PURPLE_IS_AUTHORIZATION_REQUEST(request)) {
-			account = purple_authorization_request_get_account(request);
+			PurpleContact *contact = NULL;
+
+			contact = purple_authorization_request_get_contact(request);
+			account = purple_contact_get_account(contact);
 
 			g_signal_connect_object(request, "notify",
-			                        G_CALLBACK(purple_notification_authorization_request_request_changed_cb),
-			                        notification, 0);
+			                        G_CALLBACK(purple_notification_authorization_request_notify_cb),
+			                        notification, G_CONNECT_DEFAULT);
 
+			g_signal_connect_object(contact, "notify::name-for-display",
+			                        G_CALLBACK(purple_notification_authorization_request_notify_cb),
+			                        notification, G_CONNECT_DEFAULT);
 		}
 
 		purple_notification_set_account(PURPLE_NOTIFICATION(notification),
@@ -113,9 +113,9 @@
  * Callbacks
  *****************************************************************************/
 static void
-purple_notification_authorization_request_request_changed_cb(G_GNUC_UNUSED GObject *obj,
-                                                             G_GNUC_UNUSED GParamSpec *pspec,
-                                                             gpointer data)
+purple_notification_authorization_request_notify_cb(G_GNUC_UNUSED GObject *obj,
+                                                    G_GNUC_UNUSED GParamSpec *pspec,
+                                                    gpointer data)
 {
 	purple_notification_authorization_request_update(data);
 }
@@ -136,11 +136,12 @@
 
 	account = purple_notification_get_account(notification);
 	if(!PURPLE_IS_ACCOUNT(account)) {
+		PurpleContact *contact = NULL;
 		PurpleNotificationAuthorizationRequest *auth_notification = NULL;
 
 		auth_notification = PURPLE_NOTIFICATION_AUTHORIZATION_REQUEST(obj);
-
-		account = purple_authorization_request_get_account(auth_notification->authorization_request);
+		contact = purple_authorization_request_get_contact(auth_notification->authorization_request);
+		account = purple_contact_get_account(contact);
 
 		purple_notification_set_account(notification, account);
 	}
diff --git a/libpurple/tests/test_authorization_request.c b/libpurple/tests/test_authorization_request.c
--- a/libpurple/tests/test_authorization_request.c
+++ b/libpurple/tests/test_authorization_request.c
@@ -57,59 +57,61 @@
  *****************************************************************************/
 static void
 test_purple_authorization_request_new(void) {
-	PurpleAccount *account1 = NULL, *account2 = NULL;
+	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
-	const char *username = NULL;
+	PurpleContact *contact = NULL;
+	PurpleContact *contact1 = NULL;
 
-	account1 = purple_account_new("test", "test");
-
-	request = purple_authorization_request_new(account1, "remote-username");
+	account = purple_account_new("test", "test");
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 
 	/* Make sure we got a valid authorization request. */
 	g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
 
-	/* Verify the account is set properly. */
-	account2 = purple_authorization_request_get_account(request);
-	g_assert_nonnull(account2);
-	g_assert_true(account1 == account2);
+	/* Verify the contact is set properly. */
+	contact1 = purple_authorization_request_get_contact(request);
+	g_assert_true(contact1 == contact);
 
-	/* Verify the username set properly. */
-	username = purple_authorization_request_get_username(request);
-	g_assert_cmpstr(username, ==, "remote-username");
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 
-	/* Unref it to destroy it. */
-	g_clear_object(&request);
-
-	/* Clean up the account. */
-	g_clear_object(&account1);
+	g_clear_object(&account);
 }
 
 static void
 test_purple_authorization_request_properties(void) {
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
+	PurpleContact *contact = NULL;
+	PurpleContact *contact1 = NULL;
+	char *message = NULL;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "username");
+	contact = purple_contact_new(account, NULL);
+
+	request = g_object_new(
+		PURPLE_TYPE_AUTHORIZATION_REQUEST,
+		"contact", contact,
+		"message", "hello friend",
+		NULL);
 
 	g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
 
-	/* Verify the alias property works and is nullable. */
-	purple_authorization_request_set_alias(request, "alias");
-	g_assert_cmpstr(purple_authorization_request_get_alias(request), ==,
-	                "alias");
-	purple_authorization_request_set_alias(request, NULL);
-	g_assert_null(purple_authorization_request_get_alias(request));
+	g_object_get(
+		request,
+		"contact", &contact1,
+		"message", &message,
+		NULL);
 
-	/* Verify the message property works and is nullable. */
-	purple_authorization_request_set_message(request, "message");
-	g_assert_cmpstr(purple_authorization_request_get_message(request), ==,
-	                "message");
-	purple_authorization_request_set_message(request, NULL);
-	g_assert_null(purple_authorization_request_get_message(request));
+	g_assert_true(contact1 == contact);
+	g_clear_object(&contact1);
 
-	/* Cleanup. */
-	g_clear_object(&request);
+	g_assert_cmpstr(message, ==, "hello friend");
+	g_clear_pointer(&message, g_free);
+
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
 }
 
@@ -118,12 +120,12 @@
 	if(g_test_subprocess()) {
 		PurpleAccount *account = NULL;
 		PurpleAuthorizationRequest *request = NULL;
+		PurpleContact *contact = NULL;
 		guint counter = 0;
 
 		account = purple_account_new("test", "test");
-		request = purple_authorization_request_new(account, "username");
-
-		g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+		contact = purple_contact_new(account, NULL);
+		request = purple_authorization_request_new(contact);
 
 		g_signal_connect(request, "accepted",
 		                 G_CALLBACK(test_purple_authorization_request_accepted_counter_cb),
@@ -138,8 +140,9 @@
 		g_assert_cmpuint(counter, ==, 1);
 
 		/* Cleanup. */
+		g_assert_finalize_object(request);
+		g_assert_finalize_object(contact);
 		g_clear_object(&account);
-		g_clear_object(&request);
 	}
 
 	g_test_trap_subprocess(NULL, 0, 0);
@@ -151,12 +154,12 @@
 	if(g_test_subprocess()) {
 		PurpleAccount *account = NULL;
 		PurpleAuthorizationRequest *request = NULL;
+		PurpleContact *contact = NULL;
 		guint counter = 0;
 
 		account = purple_account_new("test", "test");
-		request = purple_authorization_request_new(account, "username");
-
-		g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+		contact = purple_contact_new(account, NULL);
+		request = purple_authorization_request_new(contact);
 
 		g_signal_connect(request, "accepted",
 		                 G_CALLBACK(test_purple_authorization_request_accepted_counter_cb),
@@ -174,8 +177,9 @@
 		g_assert_cmpuint(counter, ==, 1);
 
 		/* Cleanup. */
+		g_assert_finalize_object(request);
+		g_assert_finalize_object(contact);
 		g_clear_object(&account);
-		g_clear_object(&request);
 	}
 
 	g_test_trap_subprocess(NULL, 0, 0);
@@ -187,12 +191,12 @@
 	if(g_test_subprocess()) {
 		PurpleAccount *account = NULL;
 		PurpleAuthorizationRequest *request = NULL;
+		PurpleContact *contact = NULL;
 		guint counter = 0;
 
 		account = purple_account_new("test", "test");
-		request = purple_authorization_request_new(account, "username");
-
-		g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+		contact = purple_contact_new(account, NULL);
+		request = purple_authorization_request_new(contact);
 
 		g_signal_connect(request, "denied",
 		                 G_CALLBACK(test_purple_authorization_request_denied_counter_cb),
@@ -207,8 +211,9 @@
 		g_assert_cmpuint(counter, ==, 1);
 
 		/* Cleanup. */
+		g_assert_finalize_object(request);
+		g_assert_finalize_object(contact);
 		g_clear_object(&account);
-		g_clear_object(&request);
 	}
 
 	g_test_trap_subprocess(NULL, 0, 0);
@@ -220,12 +225,12 @@
 	if(g_test_subprocess()) {
 		PurpleAccount *account = NULL;
 		PurpleAuthorizationRequest *request = NULL;
+		PurpleContact *contact = NULL;
 		guint counter = 0;
 
 		account = purple_account_new("test", "test");
-		request = purple_authorization_request_new(account, "username");
-
-		g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+		contact = purple_contact_new(account, NULL);
+		request = purple_authorization_request_new(contact);
 
 		g_signal_connect(request, "denied",
 		                 G_CALLBACK(test_purple_authorization_request_denied_counter_cb),
@@ -243,8 +248,9 @@
 		g_assert_cmpuint(counter, ==, 1);
 
 		/* Cleanup. */
+		g_assert_finalize_object(request);
+		g_assert_finalize_object(contact);
 		g_clear_object(&account);
-		g_clear_object(&request);
 	}
 
 	g_test_trap_subprocess(NULL, 0, 0);
@@ -255,11 +261,11 @@
 test_purple_authorization_request_deny_message_null(void) {
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
+	PurpleContact *contact = NULL;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "username");
-
-	g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 
 	g_signal_connect(request, "denied",
 	                 G_CALLBACK(test_purple_authorization_request_denied_message_cb),
@@ -269,19 +275,20 @@
 	purple_authorization_request_deny(request, NULL);
 
 	/* Cleanup. */
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
-	g_clear_object(&request);
 }
 
 static void
 test_purple_authorization_request_deny_message_non_null(void) {
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
+	PurpleContact *contact = NULL;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "username");
-
-	g_assert_true(PURPLE_IS_AUTHORIZATION_REQUEST(request));
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 
 	g_signal_connect(request, "denied",
 	                 G_CALLBACK(test_purple_authorization_request_denied_message_cb),
@@ -291,8 +298,9 @@
 	purple_authorization_request_deny(request, "this is a message");
 
 	/* Cleanup. */
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
-	g_clear_object(&request);
 }
 
 /******************************************************************************
diff --git a/libpurple/tests/test_notification_authorization_request.c b/libpurple/tests/test_notification_authorization_request.c
--- a/libpurple/tests/test_notification_authorization_request.c
+++ b/libpurple/tests/test_notification_authorization_request.c
@@ -43,12 +43,14 @@
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
 	PurpleAuthorizationRequest *request1 = NULL;
+	PurpleContact *contact = NULL;
 	PurpleNotification *notification = NULL;
 	PurpleNotificationAuthorizationRequest *auth_notification = NULL;
 	const char *id = NULL;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "remote-username");
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 	notification = purple_notification_authorization_request_new("id",
 	                                                             request);
 
@@ -63,8 +65,8 @@
 	g_assert_true(request1 == request);
 
 	g_assert_finalize_object(notification);
-
-	g_clear_object(&request);
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
 }
 
@@ -74,11 +76,13 @@
 	PurpleAccount *account1 = NULL;
 	PurpleAuthorizationRequest *request = NULL;
 	PurpleAuthorizationRequest *request1 = NULL;
+	PurpleContact *contact = NULL;
 	PurpleNotification *notification = NULL;
 	char *id = NULL;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "username");
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 
 	notification = g_object_new(
 		PURPLE_TYPE_NOTIFICATION_AUTHORIZATION_REQUEST,
@@ -103,8 +107,8 @@
 	g_clear_pointer(&id, g_free);
 
 	g_assert_finalize_object(notification);
-
-	g_clear_object(&request);
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
 }
 
@@ -112,11 +116,13 @@
 test_purple_notification_authorization_request_updates_title(void) {
 	PurpleAccount *account = NULL;
 	PurpleAuthorizationRequest *request = NULL;
+	PurpleContact *contact = NULL;
 	PurpleNotification *notification = NULL;
 	guint counter = 0;
 
 	account = purple_account_new("test", "test");
-	request = purple_authorization_request_new(account, "remote-username");
+	contact = purple_contact_new(account, NULL);
+	request = purple_authorization_request_new(contact);
 
 	notification = purple_notification_authorization_request_new(NULL,
 	                                                             request);
@@ -126,13 +132,13 @@
 
 	g_assert_cmpuint(counter, ==, 0);
 
-	purple_authorization_request_set_alias(request, "foo");
+	purple_contact_info_set_alias(PURPLE_CONTACT_INFO(contact), "foo");
 
 	g_assert_cmpuint(counter, ==, 1);
 
 	g_assert_finalize_object(notification);
-
-	g_clear_object(&request);
+	g_assert_finalize_object(request);
+	g_assert_finalize_object(contact);
 	g_clear_object(&account);
 }
 
