# HG changeset patch
# Node ID a8a653c4949a1a3116fdd9241b317ef0a3ffa3b1
# Parent  3978d8a6af7f1de301fb6bcc7dd6b80a75ef4253
diff --git a/libpurple/purpleconversation.c b/libpurple/purpleconversation.c
--- a/libpurple/purpleconversation.c
+++ b/libpurple/purpleconversation.c
@@ -72,6 +72,8 @@
 
 	gboolean logging;
 	gboolean drafting;
+
+	char *error;
 };
 
 enum {
@@ -104,6 +106,7 @@
 	PROP_TYPING_STATE,
 	PROP_LOGGING,
 	PROP_DRAFTING,
+	PROP_ERROR,
 	N_PROPERTIES,
 };
 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
@@ -577,6 +580,9 @@
 		purple_conversation_set_drafting(conversation,
 		                                 g_value_get_boolean(value));
 		break;
+	case PROP_ERROR:
+		purple_conversation_set_error(conversation, g_value_get_string(value));
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
 		break;
@@ -696,6 +702,9 @@
 		g_value_set_boolean(value,
 		                    purple_conversation_get_drafting(conversation));
 		break;
+	case PROP_ERROR:
+		g_value_set_string(value, purple_conversation_get_error(conversation));
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
 		break;
@@ -776,6 +785,8 @@
 	g_clear_handle_id(&conversation->typing_state_source, g_source_remove);
 	g_clear_pointer(&conversation->last_typing, g_date_time_unref);
 
+	g_clear_pointer(&conversation->error, g_free);
+
 	G_OBJECT_CLASS(purple_conversation_parent_class)->finalize(object);
 }
 
@@ -1239,6 +1250,18 @@
 		FALSE,
 		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
+	/**
+	 * PurpleConversation:error:
+	 *
+	 * Sets an error message for the conversation.
+	 *
+	 * Since: 3.0
+	 */
+	properties[PROP_ERROR] = g_param_spec_string(
+		"error", NULL, NULL,
+		NULL,
+		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
 	g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
 
 	/**
@@ -2054,3 +2077,21 @@
 		                         properties[PROP_DRAFTING]);
 	}
 }
+
+const char *
+purple_conversation_get_error(PurpleConversation *conversation) {
+	g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL);
+
+	return conversation->error;
+}
+
+void
+purple_conversation_set_error(PurpleConversation *conversation,
+                              const char *error)
+{
+	g_return_if_fail(PURPLE_IS_CONVERSATION(conversation));
+
+	if (g_set_str(&conversation->error, error)) {
+		g_object_notify_by_pspec(G_OBJECT(conversation), properties[PROP_ERROR]);
+	}
+}
diff --git a/libpurple/purpleconversation.h b/libpurple/purpleconversation.h
--- a/libpurple/purpleconversation.h
+++ b/libpurple/purpleconversation.h
@@ -919,6 +919,31 @@
 PURPLE_AVAILABLE_IN_3_0
 void purple_conversation_set_drafting(PurpleConversation *conversation, gboolean drafting);
 
+/**
+ * purple_conversation_get_error:
+ * @conversation: The instance.
+ *
+ * Gets the error message of @conversation.
+ *
+ * Returns: The error of @conversation or %NULL.
+ *
+ * Since: 3.0
+ */
+PURPLE_AVAILABLE_IN_3_0
+const char *purple_conversation_get_error(PurpleConversation *conversation);
+
+/**
+ * purple_conversation_set_error:
+ * @conversation: The instance.
+ * @error: (nullable): The new error.
+ *
+ * Sets the error message of @conversation to @error.
+ *
+ * Since: 3.0
+ */
+PURPLE_AVAILABLE_IN_3_0
+void purple_conversation_set_error(PurpleConversation *conversation, const char *error);
+
 G_END_DECLS
 
 #endif /* PURPLE_CONVERSATION_H */
diff --git a/libpurple/tests/test_conversation.c b/libpurple/tests/test_conversation.c
--- a/libpurple/tests/test_conversation.c
+++ b/libpurple/tests/test_conversation.c
@@ -61,6 +61,7 @@
 	GListModel *members = NULL;
 	char *alias = NULL;
 	char *description = NULL;
+	char *error = NULL;
 	char *global_id = NULL;
 	char *id = NULL;
 	char *name = NULL;
@@ -100,6 +101,7 @@
 		"creator", creator,
 		"description", "to describe or not to describe...",
 		"drafting", TRUE,
+		"error", "no error",
 		"favorite", TRUE,
 		"id", "id1",
 		"logging", TRUE,
@@ -124,6 +126,7 @@
 		"creator", &creator1,
 		"description", &description,
 		"drafting", &drafting,
+		"error", &error,
 		"favorite", &favorite,
 		"global-id", &global_id,
 		"id", &id,
@@ -166,6 +169,9 @@
 
 	g_assert_true(drafting);
 
+	g_assert_cmpstr(error, ==, "no error");
+	g_clear_pointer(&error, g_free);
+
 	g_assert_true(favorite);
 
 	g_assert_cmpstr(global_id, ==, "test-id1");
