summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telepathy-logger/dbus-service.c15
-rw-r--r--tests/dbus/test-log-manager.c10
-rw-r--r--tests/dbus/test-tpl-log-store-pidgin.c10
-rw-r--r--tests/dbus/test-tpl-log-store-sqlite.c9
-rw-r--r--tests/dbus/test-tpl-log-store-xml.c41
5 files changed, 60 insertions, 25 deletions
diff --git a/telepathy-logger/dbus-service.c b/telepathy-logger/dbus-service.c
index 9300c0e..ee3c353 100644
--- a/telepathy-logger/dbus-service.c
+++ b/telepathy-logger/dbus-service.c
@@ -32,6 +32,7 @@
#include <telepathy-logger/text-event.h>
#include <telepathy-logger/log-manager.h>
#include <telepathy-logger/log-manager-internal.h>
+#include <telepathy-logger/client-factory-internal.h>
#include <extensions/extensions.h>
@@ -756,6 +757,7 @@ tpl_dbus_service_clear_account (TplSvcLogger *logger,
TpDBusDaemon *bus;
TpAccount *account;
GError *error = NULL;
+ TpSimpleClientFactory *factory = NULL;
g_return_if_fail (TPL_IS_DBUS_SERVICE (self));
g_return_if_fail (context != NULL);
@@ -768,7 +770,10 @@ tpl_dbus_service_clear_account (TplSvcLogger *logger,
goto out;
}
- account = tp_account_new (bus, account_path, &error);
+ factory = _tpl_client_factory_dup (bus);
+
+ account = tp_simple_client_factory_ensure_account (factory, account_path,
+ NULL, &error);
if (account == NULL)
{
DEBUG ("Unable to acquire the account for %s: %s", account_path,
@@ -788,6 +793,7 @@ out:
g_object_unref (bus);
g_clear_error (&error);
+ g_clear_object (&factory);
}
@@ -803,6 +809,7 @@ tpl_dbus_service_clear_entity (TplSvcLogger *logger,
TpAccount *account;
TplEntity *entity;
GError *error = NULL;
+ TpSimpleClientFactory *factory = NULL;
g_return_if_fail (TPL_IS_DBUS_SERVICE (self));
g_return_if_fail (context != NULL);
@@ -816,7 +823,10 @@ tpl_dbus_service_clear_entity (TplSvcLogger *logger,
goto out;
}
- account = tp_account_new (bus, account_path, &error);
+ factory = _tpl_client_factory_dup (bus);
+
+ account = tp_simple_client_factory_ensure_account (factory, account_path,
+ NULL, &error);
if (account == NULL)
{
DEBUG ("Unable to acquire the account for %s: %s", account_path,
@@ -832,6 +842,7 @@ tpl_dbus_service_clear_entity (TplSvcLogger *logger,
g_object_unref (account);
g_object_unref (entity);
+ g_clear_object (&factory);
tpl_svc_logger_return_from_clear_account (context);
diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c
index 945a06c..22b79f6 100644
--- a/tests/dbus/test-log-manager.c
+++ b/tests/dbus/test-log-manager.c
@@ -10,6 +10,7 @@
#include "telepathy-logger/log-manager-internal.h"
#include "telepathy-logger/log-store-internal.h"
#include <telepathy-logger/text-event.h>
+#include <telepathy-logger/client-factory-internal.h>
#include <telepathy-glib/debug-sender.h>
@@ -28,6 +29,7 @@ typedef struct
TpDBusDaemon *dbus;
TpAccount *account;
TpTestsSimpleAccount *account_service;
+ TpSimpleClientFactory *factory;
GList *ret;
@@ -119,6 +121,8 @@ teardown_service (TestCaseFixture* fixture,
g_object_unref (fixture->dbus);
fixture->dbus = NULL;
+
+ g_clear_object (&fixture->factory);
}
static void
@@ -199,8 +203,12 @@ setup_service (TestCaseFixture* fixture,
tp_dbus_daemon_register_object (fixture->dbus, account_path,
fixture->account_service);
- fixture->account = tp_account_new (fixture->dbus, account_path, NULL);
+ fixture->factory = _tpl_client_factory_dup (fixture->dbus);
+
+ fixture->account = tp_simple_client_factory_ensure_account (fixture->factory,
+ account_path, NULL, NULL);
g_assert (fixture->account != NULL);
+
tp_proxy_prepare_async (fixture->account, account_features,
account_prepare_cb, fixture);
g_main_loop_run (fixture->main_loop);
diff --git a/tests/dbus/test-tpl-log-store-pidgin.c b/tests/dbus/test-tpl-log-store-pidgin.c
index a15a87d..38b3809 100644
--- a/tests/dbus/test-tpl-log-store-pidgin.c
+++ b/tests/dbus/test-tpl-log-store-pidgin.c
@@ -11,6 +11,7 @@
#include <telepathy-logger/log-store-pidgin-internal.h>
#include <telepathy-logger/text-event-internal.h>
+#include <telepathy-logger/client-factory-internal.h>
#include <telepathy-glib/debug-sender.h>
@@ -34,6 +35,7 @@ typedef struct
TpDBusDaemon *dbus;
TpAccount *account;
TpTestsSimpleAccount *account_service;
+ TpSimpleClientFactory *factory;
TplLogStorePidgin *store;
TplEntity *room;
@@ -147,8 +149,12 @@ setup_service (PidginTestCaseFixture* fixture,
tp_dbus_daemon_register_object (fixture->dbus, account_path,
fixture->account_service);
- fixture->account = tp_account_new (fixture->dbus, account_path, NULL);
+ fixture->factory = _tpl_client_factory_dup (fixture->dbus);
+
+ fixture->account = tp_simple_client_factory_ensure_account (fixture->factory,
+ account_path, NULL, NULL);
g_assert (fixture->account != NULL);
+
tp_proxy_prepare_async (fixture->account, account_features,
account_prepare_cb, fixture);
g_main_loop_run (fixture->main_loop);
@@ -217,6 +223,8 @@ teardown_service (PidginTestCaseFixture* fixture,
g_object_unref (fixture->dbus);
fixture->dbus = NULL;
+
+ g_clear_object (&fixture->factory);
}
static void
diff --git a/tests/dbus/test-tpl-log-store-sqlite.c b/tests/dbus/test-tpl-log-store-sqlite.c
index 3d887d9..f9a25e1 100644
--- a/tests/dbus/test-tpl-log-store-sqlite.c
+++ b/tests/dbus/test-tpl-log-store-sqlite.c
@@ -2,6 +2,7 @@
#include <telepathy-logger/log-store-sqlite-internal.h>
#include <telepathy-logger/debug-internal.h>
+#include <telepathy-logger/client-factory-internal.h>
int
main (int argc, char **argv)
@@ -10,6 +11,7 @@ main (int argc, char **argv)
TpDBusDaemon *bus;
TpAccount *account;
GError *error = NULL;
+ TpSimpleClientFactory* factory;
g_type_init ();
@@ -18,9 +20,11 @@ main (int argc, char **argv)
bus = tp_dbus_daemon_dup (&error);
g_assert_no_error (error);
- account = tp_account_new (bus,
+ factory = _tpl_client_factory_dup (bus);
+
+ account = tp_simple_client_factory_ensure_account (factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/danielle_2emadeley_40collabora_2eco_2euk0",
- &error);
+ NULL, &error);
g_assert_no_error (error);
store = _tpl_log_store_sqlite_dup ();
@@ -32,4 +36,5 @@ main (int argc, char **argv)
g_object_unref (store);
g_object_unref (account);
g_object_unref (bus);
+ g_object_unref (factory);
}
diff --git a/tests/dbus/test-tpl-log-store-xml.c b/tests/dbus/test-tpl-log-store-xml.c
index 4351f73..132d302 100644
--- a/tests/dbus/test-tpl-log-store-xml.c
+++ b/tests/dbus/test-tpl-log-store-xml.c
@@ -7,6 +7,7 @@
#include "telepathy-logger/debug-internal.h"
#include "telepathy-logger/log-manager-internal.h"
#include "telepathy-logger/log-store-internal.h"
+#include <telepathy-logger/client-factory-internal.h>
#include <telepathy-glib/debug-sender.h>
#include <glib.h>
@@ -21,6 +22,7 @@ typedef struct
gchar *tmp_basedir;
TplLogStore *store;
TpDBusDaemon *bus;
+ TpSimpleClientFactory *factory;
} XmlTestCaseFixture;
@@ -39,6 +41,8 @@ setup (XmlTestCaseFixture* fixture,
fixture->bus = tp_tests_dbus_daemon_dup_or_die ();
g_assert (fixture->bus != NULL);
+ fixture->factory = _tpl_client_factory_dup (fixture->bus);
+
tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
#ifdef ENABLE_DEBUG
@@ -85,6 +89,8 @@ teardown (XmlTestCaseFixture *fixture,
if (fixture->store == NULL)
g_object_unref (fixture->store);
+
+ g_clear_object (&fixture->factory);
}
@@ -136,9 +142,9 @@ test_clear_account (XmlTestCaseFixture *fixture,
tpl_log_manager_search_free (hits);
- account = tp_account_new (fixture->bus,
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/test2_40collabora_2eco_2euk0",
- &error);
+ NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);
@@ -203,9 +209,9 @@ test_clear_entity (XmlTestCaseFixture *fixture,
tpl_log_manager_search_free (hits);
- account = tp_account_new (fixture->bus,
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/test2_40collabora_2eco_2euk0",
- &error);
+ NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);
@@ -291,9 +297,8 @@ test_add_text_event (XmlTestCaseFixture *fixture,
GList *events;
gint64 timestamp = time (NULL);
- account = tp_account_new (fixture->bus,
- TP_ACCOUNT_OBJECT_PATH_BASE "idle/irc/me",
- &error);
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
+ TP_ACCOUNT_OBJECT_PATH_BASE "idle/irc/me", NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);
@@ -462,9 +467,8 @@ test_add_superseding_event (XmlTestCaseFixture *fixture,
GList *superseded;
gint64 timestamp = time (NULL);
- account = tp_account_new (fixture->bus,
- TP_ACCOUNT_OBJECT_PATH_BASE "idle/irc/me",
- &error);
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
+ TP_ACCOUNT_OBJECT_PATH_BASE "idle/irc/me", NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);
@@ -714,9 +718,8 @@ test_add_call_event (XmlTestCaseFixture *fixture,
GList *events;
gint64 timestamp = time (NULL);
- account = tp_account_new (fixture->bus,
- TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/me",
- &error);
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
+ TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/me", NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);
@@ -850,15 +853,15 @@ test_exists (XmlTestCaseFixture *fixture,
TplEntity *user2, *user3;
GError *error = NULL;
- account1 = tp_account_new (fixture->bus,
+ account1 = tp_simple_client_factory_ensure_account (fixture->factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/test2_40collabora_2eco_2euk0",
- &error);
+ NULL, &error);
g_assert_no_error (error);
g_assert (account1 != NULL);
- account2 = tp_account_new (fixture->bus,
+ account2 = tp_simple_client_factory_ensure_account (fixture->factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk",
- &error);
+ NULL, &error);
g_assert_no_error (error);
g_assert (account1 != NULL);
@@ -907,9 +910,9 @@ test_get_events_for_date (XmlTestCaseFixture *fixture,
GError *error = NULL;
gint idx;
- account = tp_account_new (fixture->bus,
+ account = tp_simple_client_factory_ensure_account (fixture->factory,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk",
- &error);
+ NULL, &error);
g_assert_no_error (error);
g_assert (account != NULL);