# HG changeset patch
# Node ID 23a2276b38c12e420fdb68f4042f695df7c26592
# Parent  30a19ec025e9d915716e9830787cd17751130343
diff --git a/libpurple/purplehistorymanager.c b/libpurple/purplehistorymanager.c
--- a/libpurple/purplehistorymanager.c
+++ b/libpurple/purplehistorymanager.c
@@ -32,8 +32,8 @@
 
 enum {
 	SIG_ACTIVE_CHANGED,
-	SIG_REGISTERED,
-	SIG_UNREGISTERED,
+	SIG_ADDED,
+	SIG_REMOVED,
 	N_SIGNALS,
 };
 static guint signals[N_SIGNALS] = {0, };
@@ -100,16 +100,16 @@
 		PURPLE_TYPE_HISTORY_ADAPTER);
 
 	/**
-	 * PurpleHistoryManager::registered:
+	 * PurpleHistoryManager::added:
 	 * @manager: The #PurpleHistoryManager instance.
-	 * @adapter: The #PurpleHistoryAdapter that was registered.
+	 * @adapter: The #PurpleHistoryAdapter that was added.
 	 *
-	 * Emitted after @adapter has been registered in @manager.
+	 * Emitted after @adapter has been added to @manager.
 	 *
 	 * Since: 3.0
 	 */
-	signals[SIG_REGISTERED] = g_signal_new_class_handler(
-		"registered",
+	signals[SIG_ADDED] = g_signal_new_class_handler(
+		"added",
 		G_OBJECT_CLASS_TYPE(klass),
 		G_SIGNAL_RUN_LAST,
 		NULL,
@@ -121,16 +121,16 @@
 		PURPLE_TYPE_HISTORY_ADAPTER);
 
 	/**
-	 * PurpleHistoryManager::unregistered:
+	 * PurpleHistoryManager::removed:
 	 * @manager: The #PurpleHistoryManager instance.
-	 * @adapter: The #PurpleHistoryAdapter that was unregistered.
+	 * @adapter: The #PurpleHistoryAdapter that was removed.
 	 *
-	 * Emitted after @adapter has been unregistered for @manager.
+	 * Emitted after @adapter has been removed from @manager.
 	 *
 	 * Since: 3.0
 	 */
-	signals[SIG_UNREGISTERED] = g_signal_new_class_handler(
-		"unregistered",
+	signals[SIG_REMOVED] = g_signal_new_class_handler(
+		"removed",
 		G_OBJECT_CLASS_TYPE(klass),
 		G_SIGNAL_RUN_LAST,
 		NULL,
@@ -151,9 +151,8 @@
 }
 
 gboolean
-purple_history_manager_register(PurpleHistoryManager *manager,
-                                PurpleHistoryAdapter *adapter,
-                                GError **error)
+purple_history_manager_add(PurpleHistoryManager *manager,
+                           PurpleHistoryAdapter *adapter, GError **error)
 {
 	const gchar *id = NULL;
 
@@ -163,7 +162,7 @@
 	id = purple_history_adapter_get_id(adapter);
 	if(g_hash_table_lookup(manager->adapters, id) != NULL) {
 		g_set_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0,
-		            _("adapter %s is already registered"), id);
+		            _("adapter %s has already been added"), id);
 
 		return FALSE;
 	}
@@ -171,15 +170,14 @@
 	g_hash_table_insert(manager->adapters, g_strdup(id),
 	                    g_object_ref(adapter));
 
-	g_signal_emit(G_OBJECT(manager), signals[SIG_REGISTERED], 0, adapter);
+	g_signal_emit(G_OBJECT(manager), signals[SIG_ADDED], 0, adapter);
 
 	return TRUE;
 }
 
 gboolean
-purple_history_manager_unregister(PurpleHistoryManager *manager,
-                                  PurpleHistoryAdapter *adapter,
-                                  GError **error)
+purple_history_manager_remove(PurpleHistoryManager *manager,
+                              PurpleHistoryAdapter *adapter, GError **error)
 {
 	const gchar *id = NULL;
 	gboolean ret = FALSE;
@@ -199,13 +197,12 @@
 	id = purple_history_adapter_get_id(adapter);
 
 	if(g_hash_table_remove(manager->adapters, id)) {
-		g_signal_emit(G_OBJECT(manager), signals[SIG_UNREGISTERED], 0,
-		              adapter);
+		g_signal_emit(G_OBJECT(manager), signals[SIG_REMOVED], 0, adapter);
 
 		ret = TRUE;
 	} else {
 		g_set_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0,
-		            _("adapter %s is not registered"), id);
+		            _("adapter %s has not been added"), id);
 
 		ret = FALSE;
 	}
@@ -216,28 +213,6 @@
 }
 
 PurpleHistoryAdapter *
-purple_history_manager_find(PurpleHistoryManager *manager, const gchar *id) {
-	gpointer value = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_HISTORY_MANAGER(manager), NULL);
-	g_return_val_if_fail(id != NULL, NULL);
-
-	value = g_hash_table_lookup(manager->adapters, id);
-	if(value == NULL) {
-		return NULL;
-	}
-
-	return PURPLE_HISTORY_ADAPTER(value);
-}
-
-GList *
-purple_history_manager_get_all(PurpleHistoryManager *manager) {
-	g_return_val_if_fail(PURPLE_IS_HISTORY_MANAGER(manager), NULL);
-
-	return g_hash_table_get_values(manager->adapters);
-}
-
-PurpleHistoryAdapter *
 purple_history_manager_get_active(PurpleHistoryManager *manager) {
 	g_return_val_if_fail(PURPLE_IS_HISTORY_MANAGER(manager), NULL);
 
@@ -318,9 +293,9 @@
 }
 
 gboolean
-purple_history_manager_remove(PurpleHistoryManager *manager,
-                              const gchar *query,
-                              GError **error)
+purple_history_manager_remove_query(PurpleHistoryManager *manager,
+                                    const gchar *query,
+                                    GError **error)
 {
 	g_return_val_if_fail(PURPLE_IS_HISTORY_MANAGER(manager), FALSE);
 
@@ -354,23 +329,6 @@
 	                                    message, error);
 }
 
-void
-purple_history_manager_foreach(PurpleHistoryManager *manager,
-                               PurpleHistoryManagerForeachFunc func,
-                               gpointer data)
-{
-	GHashTableIter iter;
-	gpointer value;
-
-	g_return_if_fail(PURPLE_IS_HISTORY_MANAGER(manager));
-	g_return_if_fail(func != NULL);
-
-	g_hash_table_iter_init(&iter, manager->adapters);
-	while (g_hash_table_iter_next(&iter, NULL, &value)) {
-		func(PURPLE_HISTORY_ADAPTER(value), data);
-	}
-}
-
 gboolean
 purple_history_manager_startup(PurpleHistoryAdapter *adapter, GError **error) {
 	const char *id = NULL;
@@ -385,7 +343,7 @@
 		adapter = purple_sqlite_history_adapter_new(":memory:");
 	}
 
-	if(!purple_history_manager_register(default_manager, adapter, error)) {
+	if(!purple_history_manager_add(default_manager, adapter, error)) {
 		g_clear_object(&adapter);
 
 		return FALSE;
@@ -416,8 +374,7 @@
 
 		adapter = g_object_ref(default_manager->active_adapter);
 		purple_history_manager_set_active(default_manager, NULL, NULL);
-		purple_history_manager_unregister(default_manager,
-		                                  adapter, error);
+		purple_history_manager_remove(default_manager, adapter, error);
 
 		g_clear_object(&adapter);
 	}
diff --git a/libpurple/purplehistorymanager.h b/libpurple/purplehistorymanager.h
--- a/libpurple/purplehistorymanager.h
+++ b/libpurple/purplehistorymanager.h
@@ -56,25 +56,12 @@
  * PurpleHistoryManager:
  *
  * #PurpleHistoryManager keeps track of all adapters and emits signals when
- * adapters are registered and unregistered.
+ * adapters are added and removed.
  *
  * Since: 3.0
  */
 
 /**
- * PurpleHistoryManagerForeachFunc:
- * @adapter: The #PurpleHistoryAdapter instance.
- * @data: User supplied data.
- *
- * A function to be used as a callback with
- * purple_history_manager_foreach().
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_TYPE_IN_3_0
-typedef void (*PurpleHistoryManagerForeachFunc)(PurpleHistoryAdapter *adapter, gpointer data);
-
-/**
  * purple_history_manager_startup:
  * @adapter: (transfer full) (nullable): The history adapter to use by default.
  * @error: A return address for a #GError.
@@ -142,65 +129,36 @@
 gboolean purple_history_manager_set_active(PurpleHistoryManager *manager, const gchar *id, GError **error);
 
 /**
- * purple_history_manager_register:
+ * purple_history_manager_add:
  * @manager: The #PurpleHistoryManager instance.
- * @adapter: The #PurpleHistoryAdapter to register.
+ * @adapter: The #PurpleHistoryAdapter to add.
  * @error: A return address for a #GError.
  *
- * Registers @adapter with @manager.
- *
- * Returns: %TRUE if @adapter was successfully registered with @manager,
- *          %FALSE otherwise.
+ * Adds @adapter to @manager.
  *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-gboolean purple_history_manager_register(PurpleHistoryManager *manager, PurpleHistoryAdapter *adapter, GError **error);
-
-/**
- * purple_history_manager_unregister:
- * @manager: The #PurpleHistoryManager instance.
- * @adapter: The #PurpleHistoryAdapter to unregister.
- * @error: A return address for a #GError.
- *
- * Unregisters @adapter from @manager.
- *
- * Returns: %TRUE if @adapter was successfully unregistered from @manager,
- *          %FALSE otherwise.
+ * Returns: %TRUE if @adapter was successfully added to @manager, %FALSE
+ *          otherwise.
  *
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-gboolean purple_history_manager_unregister(PurpleHistoryManager *manager, PurpleHistoryAdapter *adapter, GError **error);
+gboolean purple_history_manager_add(PurpleHistoryManager *manager, PurpleHistoryAdapter *adapter, GError **error);
 
 /**
- * purple_history_manager_find:
+ * purple_history_manager_remove:
  * @manager: The #PurpleHistoryManager instance.
- * @id: The id of the #PurpleHistoryAdapter to find.
+ * @adapter: The #PurpleHistoryAdapter to remove.
+ * @error: A return address for a #GError.
  *
- * Gets the #PurpleHistoryAdapter identified by @id if found, otherwise %NULL.
+ * Removes @adapter from @manager.
  *
- * Returns: (transfer none): The #PurpleHistoryAdapter identified by @id or %NULL.
+ * Returns: %TRUE if @adapter was successfully removed from @manager, %FALSE
+ *          otherwise.
  *
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-PurpleHistoryAdapter *purple_history_manager_find(PurpleHistoryManager *manager, const gchar *id);
-
-/**
- * purple_history_manager_get_all:
- * @manager: The #PurpleHistoryManager instance.
- *
- * Gets a list of all #PurpleHistoryAdapter's that are currently registered in
- * @manager.
- *
- * Returns: (transfer container) (element-type PurpleHistoryAdapter): The list
- *          containing all of the #PurpleHistoryAdapter's registered with @manager.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-GList *purple_history_manager_get_all(PurpleHistoryManager *manager);
+gboolean purple_history_manager_remove(PurpleHistoryManager *manager, PurpleHistoryAdapter *adapter, GError **error);
 
 /**
  * purple_history_manager_query:
@@ -220,12 +178,13 @@
 GList *purple_history_manager_query(PurpleHistoryManager *manager, const gchar *query, GError **error);
 
 /**
- * purple_history_manager_remove:
+ * purple_history_manager_remove_query:
  * @manager: The #PurpleHistoryManager instance.
  * @query: A query to send to the @manager instance.
  * @error: A return address for a #GError.
  *
- * Removes messages from the active #PurpleHistoryAdapter of @manager that match @query.
+ * Removes messages from the active #PurpleHistoryAdapter of @manager that
+ * match @query.
  *
  * Returns: %TRUE if messages matching @query were successfully removed from
  *          the active adapter of @manager, %FALSE otherwise.
@@ -233,7 +192,7 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-gboolean purple_history_manager_remove(PurpleHistoryManager *manager, const gchar *query, GError **error);
+gboolean purple_history_manager_remove_query(PurpleHistoryManager *manager, const gchar *query, GError **error);
 
 /**
  * purple_history_manager_write:
@@ -251,19 +210,6 @@
 PURPLE_AVAILABLE_IN_3_0
 gboolean purple_history_manager_write(PurpleHistoryManager *manager, PurpleConversation *conversation, PurpleMessage *message, GError **error);
 
-/**
- * purple_history_manager_foreach:
- * @manager: The #PurpleHistoryManager instance.
- * @func: (scope call): The #PurpleHistoryManagerForeachFunc to call.
- * @data: User data to pass to @func.
- *
- * Calls @func for each #PurpleHistoryAdapter that @manager knows about.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_history_manager_foreach(PurpleHistoryManager *manager, PurpleHistoryManagerForeachFunc func, gpointer data);
-
 G_END_DECLS
 
 #endif /* PURPLE_HISTORY_MANAGER_H */
diff --git a/libpurple/tests/test_history_manager.c b/libpurple/tests/test_history_manager.c
--- a/libpurple/tests/test_history_manager.c
+++ b/libpurple/tests/test_history_manager.c
@@ -166,24 +166,24 @@
 
 	adapter = test_purple_history_adapter_new();
 
-	/* Register the first time cleanly. */
-	r = purple_history_manager_register(manager, adapter, &error);
+	/* Add the first time cleanly. */
+	r = purple_history_manager_add(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(r);
 
-	/* Register again and verify the error. */
-	r = purple_history_manager_register(manager, adapter, &error);
+	/* Add again and verify the error. */
+	r = purple_history_manager_add(manager, adapter, &error);
 	g_assert_false(r);
 	g_assert_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
 
-	/* Unregister the adapter. */
-	r = purple_history_manager_unregister(manager, adapter, &error);
+	/* Add the adapter. */
+	r = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(r);
 
-	/* Unregister the adapter again and verify the error. */
-	r = purple_history_manager_unregister(manager, adapter, &error);
+	/* Remove the adapter again and verify the error. */
+	r = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_false(r);
 	g_assert_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
@@ -237,10 +237,10 @@
 
 	manager = g_object_new(PURPLE_TYPE_HISTORY_MANAGER, NULL);
 
-	/* Create the adapter and register it in the manager. */
+	/* Create the adapter and add it to the manager. */
 	adapter = test_purple_history_adapter_new();
 	ta = TEST_PURPLE_HISTORY_ADAPTER(adapter);
-	r = purple_history_manager_register(manager, adapter, &error);
+	r = purple_history_manager_add(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(r);
 
@@ -251,8 +251,8 @@
 	g_assert_true(r);
 	g_assert_true(ta->activate_called);
 
-	/* Verify that unregistering the active adapter fails */
-	r = purple_history_manager_unregister(manager, adapter,
+	/* Verify that removing the active adapter fails */
+	r = purple_history_manager_remove(manager, adapter,
 	                                      &error);
 	g_assert_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0);
 	g_assert_false(r);
@@ -264,8 +264,8 @@
 	g_assert_true(r);
 	g_assert_true(ta->deactivate_called);
 
-	/* Finally unregister the adapter now that it's no longer active. */
-	r = purple_history_manager_unregister(manager, adapter, &error);
+	/* Finally remove the adapter now that it's no longer active. */
+	r = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(r);
 
@@ -295,13 +295,13 @@
 }
 
 static void
-test_purple_history_manager_no_adapter_remove(void) {
+test_purple_history_manager_no_adapter_remove_query(void) {
 	PurpleHistoryManager *manager = NULL;
 	GError *error = NULL;
 	gboolean result = FALSE;
 
 	manager = g_object_new(PURPLE_TYPE_HISTORY_MANAGER, NULL);
-	result = purple_history_manager_remove(manager, "", &error);
+	result = purple_history_manager_remove_query(manager, "", &error);
 
 	g_assert_error(error, PURPLE_HISTORY_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
@@ -360,7 +360,7 @@
 	adapter = test_purple_history_adapter_new();
 	ta = TEST_PURPLE_HISTORY_ADAPTER(adapter);
 
-	result = purple_history_manager_register(manager, adapter, &error);
+	result = purple_history_manager_add(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -378,7 +378,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_history_manager_unregister(manager, adapter, &error);
+	result = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -387,7 +387,7 @@
 }
 
 static void
-test_purple_history_manager_adapter_remove(void) {
+test_purple_history_manager_adapter_remove_query(void) {
 	PurpleHistoryManager *manager = NULL;
 	PurpleHistoryAdapter *adapter = NULL;
 	TestPurpleHistoryAdapter *ta = NULL;
@@ -398,7 +398,7 @@
 	adapter = test_purple_history_adapter_new();
 	ta = TEST_PURPLE_HISTORY_ADAPTER(adapter);
 
-	result = purple_history_manager_register(manager, adapter, &error);
+	result = purple_history_manager_add(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -407,7 +407,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_history_manager_remove(manager, "query", &error);
+	result = purple_history_manager_remove_query(manager, "query", &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 	g_assert_true(ta->remove_called);
@@ -416,7 +416,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_history_manager_unregister(manager, adapter, &error);
+	result = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -439,7 +439,7 @@
 	adapter = test_purple_history_adapter_new();
 	ta = TEST_PURPLE_HISTORY_ADAPTER(adapter);
 
-	result = purple_history_manager_register(manager, adapter, &error);
+	result = purple_history_manager_add(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -464,7 +464,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_history_manager_unregister(manager, adapter, &error);
+	result = purple_history_manager_remove(manager, adapter, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -500,16 +500,16 @@
 	/* Tests for manager with an adapter */
 	g_test_add_func("/history-manager/adapter/query",
 	                test_purple_history_manager_adapter_query);
-	g_test_add_func("/history-manager/adapter/remove",
-	                test_purple_history_manager_adapter_remove);
+	g_test_add_func("/history-manager/adapter/remove-query",
+	                test_purple_history_manager_adapter_remove_query);
 	g_test_add_func("/history-manager/adapter/write",
 	                test_purple_history_manager_adapter_write);
 
 	/* Tests for manager with no adapter */
 	g_test_add_func("/history-manager/no-adapter/query",
 	                test_purple_history_manager_no_adapter_query);
-	g_test_add_func("/history-manager/no-adapter/remove",
-	                test_purple_history_manager_no_adapter_remove);
+	g_test_add_func("/history-manager/no-adapter/remove-query",
+	                test_purple_history_manager_no_adapter_remove_query);
 	g_test_add_func("/history-manager/no-adapter/write",
 	                test_purple_history_manager_no_adapter_write);
 
diff --git a/purple-history/purplehistorycore.c b/purple-history/purplehistorycore.c
--- a/purple-history/purplehistorycore.c
+++ b/purple-history/purplehistorycore.c
@@ -62,7 +62,7 @@
 	PurpleHistoryManager *manager = purple_history_manager_get_default();
 	gboolean success = FALSE;
 
-	success = purple_history_manager_remove(manager, query, error);
+	success = purple_history_manager_remove_query(manager, query, error);
 
 	if(!success) {
 		return FALSE;
