[telepathy-glib/master] Use tp_account_parse_object_path in tp_account_new

Will Thompson will.thompson at collabora.co.uk
Mon Sep 28 07:39:32 PDT 2009


This exposed a bug in the test suite, which was passing an invalid
account path to tp_account_new and expecting it to succeed.

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
 telepathy-glib/account.c |   10 +---------
 tests/dbus/account.c     |    2 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 9c02b15..2472e64 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -1185,17 +1185,9 @@ tp_account_new (TpDBusDaemon *bus_daemon,
   g_return_val_if_fail (object_path != NULL, NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-  if (!tp_dbus_check_valid_object_path (object_path, error))
+  if (!tp_account_parse_object_path (object_path, NULL, NULL, NULL, error))
     return NULL;
 
-  if (!g_str_has_prefix (object_path, TP_ACCOUNT_OBJECT_PATH_BASE))
-    {
-      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "Account path does not start with the right prefix: %s",
-          object_path);
-      return NULL;
-    }
-
   self = TP_ACCOUNT (g_object_new (TP_TYPE_ACCOUNT,
           "dbus-daemon", bus_daemon,
           "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index 335a614..70c0b6d 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -115,7 +115,7 @@ test_new (Test *test,
   g_assert (test->account == NULL);
 
   test->account = tp_account_new (test->dbus,
-      "/org/freedesktop/Telepathy/Account/whatever", NULL);
+      "/org/freedesktop/Telepathy/Account/what/ev/er", NULL);
   g_assert (test->account != NULL);
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list