# HG changeset patch
# Node ID d3daf5a0d0f499d44f6cf99bc49de91523bc7172
# Parent  51bee36eb6cbcc7607b748ae2873d0f3bb5cba63
diff --git a/libpurple/purplenotification.c b/libpurple/purplenotification.c
--- a/libpurple/purplenotification.c
+++ b/libpurple/purplenotification.c
@@ -522,7 +522,7 @@
 {
 	g_return_val_if_fail(PURPLE_IS_ADD_CONTACT_REQUEST(request), NULL);
 
-	return purple_notification_add_contact_new(request);
+	return purple_notification_add_contact_new(NULL, request);
 }
 
 PurpleNotification *
diff --git a/libpurple/purplenotificationaddcontact.c b/libpurple/purplenotificationaddcontact.c
--- a/libpurple/purplenotificationaddcontact.c
+++ b/libpurple/purplenotificationaddcontact.c
@@ -77,10 +77,17 @@
 	g_return_if_fail(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification));
 
 	if(g_set_object(&notification->request, request)) {
+		PurpleAccount *account = NULL;
+		GObject *obj = G_OBJECT(notification);
+
+		g_object_freeze_notify(obj);
+
 		if(PURPLE_IS_ADD_CONTACT_REQUEST(request)) {
 			PurpleContact *contact = NULL;
 
 			contact = purple_add_contact_request_get_contact(request);
+			account = purple_contact_get_account(contact);
+
 			g_signal_connect_object(contact, "notify",
 			                        G_CALLBACK(purple_notification_add_contact_contact_notify_cb),
 			                        notification, G_CONNECT_DEFAULT);
@@ -91,8 +98,11 @@
 			                        notification, G_CONNECT_DEFAULT);
 		}
 
-		g_object_notify_by_pspec(G_OBJECT(notification),
-		                         properties[PROP_REQUEST]);
+		purple_notification_set_account(PURPLE_NOTIFICATION(notification),
+		                                account);
+
+		g_object_notify_by_pspec(obj, properties[PROP_REQUEST]);
+		g_object_thaw_notify(obj);
 
 		purple_notification_add_contact_update(notification);
 	}
@@ -208,11 +218,14 @@
  * Public API
  *****************************************************************************/
 PurpleNotification *
-purple_notification_add_contact_new(PurpleAddContactRequest *request) {
+purple_notification_add_contact_new(const char *id,
+                                    PurpleAddContactRequest *request)
+{
 	g_return_val_if_fail(PURPLE_IS_ADD_CONTACT_REQUEST(request), NULL);
 
 	return g_object_new(
 		PURPLE_TYPE_NOTIFICATION_ADD_CONTACT,
+		"id", id,
 		"request", request,
 		NULL);
 }
diff --git a/libpurple/purplenotificationaddcontact.h b/libpurple/purplenotificationaddcontact.h
--- a/libpurple/purplenotificationaddcontact.h
+++ b/libpurple/purplenotificationaddcontact.h
@@ -54,16 +54,20 @@
 
 /**
  * purple_notification_add_contact_new:
+ * @id: (nullable): An identifier for this notification.
  * @request: The add contact request.
  *
  * Creates a new [class@Notification] for @request.
  *
+ * Since @request has a [class@Contact] which has a [class@Account],
+ * [property@Notification:account] will automatically be set to that.
+ *
  * Returns: The new notification.
  *
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-PurpleNotification *purple_notification_add_contact_new(PurpleAddContactRequest *request);
+PurpleNotification *purple_notification_add_contact_new(const char *id, PurpleAddContactRequest *request);
 
 /**
  * purple_notification_add_contact_get_request:
diff --git a/libpurple/tests/test_notification_add_contact.c b/libpurple/tests/test_notification_add_contact.c
--- a/libpurple/tests/test_notification_add_contact.c
+++ b/libpurple/tests/test_notification_add_contact.c
@@ -49,7 +49,7 @@
 	account = purple_account_new("test", "test");
 	contact = purple_contact_new(account, "remote");
 	request = purple_add_contact_request_new(contact);
-	notification = purple_notification_add_contact_new(request);
+	notification = purple_notification_add_contact_new(NULL, request);
 
 	g_assert_true(PURPLE_IS_NOTIFICATION(notification));
 	g_assert_true(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification));
@@ -64,10 +64,12 @@
 static void
 test_purple_notification_add_contact_properties(void) {
 	PurpleAccount *account = NULL;
+	PurpleAccount *account1 = NULL;
 	PurpleAddContactRequest *request = NULL;
 	PurpleAddContactRequest *request1 = NULL;
 	PurpleContact *contact = NULL;
 	PurpleNotification *notification = NULL;
+	char *id = NULL;
 
 	account = purple_account_new("test", "test");
 	contact = purple_contact_new(account, "username");
@@ -75,14 +77,23 @@
 
 	notification = g_object_new(
 		PURPLE_TYPE_NOTIFICATION_ADD_CONTACT,
+		"id", "notification1",
 		"request", request,
 		NULL);
 
 	g_object_get(
 		notification,
+		"account", &account1,
+		"id", &id,
 		"request", &request1,
 		NULL);
 
+	g_assert_true(account1 == account);
+	g_clear_object(&account1);
+
+	g_assert_cmpstr(id, ==, "notification1");
+	g_clear_pointer(&id, g_free);
+
 	g_assert_true(request1 == request);
 	g_clear_object(&request1);
 
@@ -106,7 +117,7 @@
 	contact = purple_contact_new(account, "remote-username");
 	request = purple_add_contact_request_new(contact);
 
-	notification = purple_notification_add_contact_new(request);
+	notification = purple_notification_add_contact_new(NULL, request);
 	g_signal_connect(notification, "notify::title",
 	                 G_CALLBACK(test_purple_notification_add_contact_notify_cb),
 	                 &counter);
