[next] telepathy-glib: protocol name can contain '_' but not '-'

Xavier Claessens xclaesse at kemper.freedesktop.org
Thu Sep 19 08:12:20 PDT 2013


Module: telepathy-glib
Branch: next
Commit: 12e02552109de39efc2a4722373ec91bb66fe6d7
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=12e02552109de39efc2a4722373ec91bb66fe6d7

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed Sep 18 14:22:56 2013 -0400

protocol name can contain '_' but not '-'

---

 telepathy-glib/connection-manager.c                |    4 ++--
 telepathy-glib/connection.c                        |   15 ---------------
 tests/dbus/cm.c                                    |    4 ++--
 tests/dbus/connection-aliasing.c                   |    2 +-
 tests/dbus/connection-balance.c                    |    2 +-
 tests/dbus/connection-interests.c                  |    4 ++--
 tests/dbus/connection.c                            |    8 ++++----
 tests/dbus/contact-lists.c                         |    2 +-
 .../telepathy/managers/test_manager_file.manager   |    2 +-
 tests/dbus/unsupported-interface.c                 |    2 +-
 10 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 290ec7c..08b1226 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -1582,11 +1582,11 @@ tp_connection_manager_check_valid_protocol_name (const gchar *name,
 
   for (name_char = name; *name_char != '\0'; name_char++)
     {
-      if (!g_ascii_isalnum (*name_char) && *name_char != '-')
+      if (!g_ascii_isalnum (*name_char) && *name_char != '_')
         {
           g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
               "Not a valid protocol name because character '%c' "
-              "is not an ASCII letter, digit or hyphen/minus: %s",
+              "is not an ASCII letter, digit or underscore: %s",
               *name_char, name);
           return FALSE;
         }
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 74427dc..62dd787 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -2243,21 +2243,6 @@ _tp_connection_parse (const gchar *path_or_bus_name,
     }
 
   dup_protocol = g_strndup (protocol_start, account_start - protocol_start - 1);
-  if (!tp_strdiff (dup_protocol, "local_2dxmpp"))
-    {
-      /* the CM's telepathy-glib is older than 0.7.x, work around it.
-       * FIXME: Remove this workaround in 0.9.x */
-      g_free (dup_protocol);
-      dup_protocol = g_strdup ("local-xmpp");
-    }
-  else
-    {
-      /* the real protocol name may have "-" in; bus names may not, but
-       * they may have "_", so the Telepathy spec specifies replacement.
-       * Here we need to undo that replacement */
-      g_strdelimit (dup_protocol, "_", '-');
-    }
-
   if (!tp_connection_manager_check_valid_protocol_name (dup_protocol, NULL))
     {
       g_free (dup_protocol);
diff --git a/tests/dbus/cm.c b/tests/dbus/cm.c
index 994b61a..bd841fa 100644
--- a/tests/dbus/cm.c
+++ b/tests/dbus/cm.c
@@ -525,9 +525,9 @@ test_complex_file_got_info (Test *test,
   g_assert_cmpuint (tp_protocol_get_params (protocol)->len, ==, 6);
 
   protocol = tp_connection_manager_get_protocol (test->cm,
-      "somewhat-pathological");
+      "somewhat_pathological");
   g_assert_cmpstr (tp_protocol_get_name (protocol), ==,
-      "somewhat-pathological");
+      "somewhat_pathological");
 
   param = g_ptr_array_index (tp_protocol_get_params (protocol), 0);
   g_assert_cmpstr (tp_connection_manager_param_get_name (param), ==, "foo");
diff --git a/tests/dbus/connection-aliasing.c b/tests/dbus/connection-aliasing.c
index 4aa27b5..c0dcd92 100644
--- a/tests/dbus/connection-aliasing.c
+++ b/tests/dbus/connection-aliasing.c
@@ -69,7 +69,7 @@ setup (Test *test,
   test->service_conn = tp_tests_object_new_static_class (
         EXAMPLE_TYPE_CONTACT_LIST_CONNECTION,
         "account", "me at example.com",
-        "protocol", "simple-protocol",
+        "protocol", "simple_protocol",
         NULL);
   test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
   g_assert (test->service_conn != NULL);
diff --git a/tests/dbus/connection-balance.c b/tests/dbus/connection-balance.c
index ad73947..5d5683e 100644
--- a/tests/dbus/connection-balance.c
+++ b/tests/dbus/connection-balance.c
@@ -227,7 +227,7 @@ setup (Test *test,
   test->service_conn = tp_tests_object_new_static_class (
         conn_type,
         "account", "me at example.com",
-        "protocol", "simple-protocol",
+        "protocol", "simple_protocol",
         NULL);
   test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
   g_assert (test->service_conn != NULL);
diff --git a/tests/dbus/connection-interests.c b/tests/dbus/connection-interests.c
index ca7f79b..252e611 100644
--- a/tests/dbus/connection-interests.c
+++ b/tests/dbus/connection-interests.c
@@ -168,7 +168,7 @@ setup (Test *test,
   test->service_conn = tp_tests_object_new_static_class (
         interested_connection_get_type (),
         "account", "me at example.com",
-        "protocol", "simple-protocol",
+        "protocol", "simple_protocol",
         NULL);
   test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
   g_assert (test->service_conn != NULL);
@@ -183,8 +183,8 @@ setup (Test *test,
 
   test->conn = tp_tests_connection_new (test->client_bus, test->conn_name,
       test->conn_path, &error);
-  g_assert (test->conn != NULL);
   g_assert_no_error (error);
+  g_assert (test->conn != NULL);
 
   tp_cli_connection_call_connect (test->conn, -1, NULL, NULL, NULL, NULL);
 
diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c
index 4cafbfb..849b1b9 100644
--- a/tests/dbus/connection.c
+++ b/tests/dbus/connection.c
@@ -63,7 +63,7 @@ setup (Test *test,
     tp_tests_object_new_static_class (
         TP_TESTS_TYPE_CONTACTS_CONNECTION,
         "account", "me at example.com",
-        "protocol", "simple-protocol",
+        "protocol", "simple_protocol",
         NULL));
   test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
   g_assert (test->service_conn != NULL);
@@ -152,14 +152,14 @@ test_prepare (Test *test,
   g_assert_cmpstr (tp_connection_get_cm_name (test->conn), ==,
           "simple");
   g_assert_cmpstr (tp_connection_get_protocol_name (test->conn), ==,
-          "simple-protocol");
+          "simple_protocol");
 
   g_object_get (test->conn,
       "cm-name", &cm_name,
       "protocol-name", &protocol_name,
       NULL);
   g_assert_cmpstr (cm_name, ==, "simple");
-  g_assert_cmpstr (protocol_name, ==, "simple-protocol");
+  g_assert_cmpstr (protocol_name, ==, "simple_protocol");
   g_free (cm_name);
   g_free (protocol_name);
 
@@ -274,7 +274,7 @@ test_object_path (Test *test,
   g_assert_cmpstr (tp_connection_get_cm_name (test->conn), ==,
       "simple");
   g_assert_cmpstr (tp_connection_get_protocol_name (test->conn), ==,
-      "simple-protocol");
+      "simple_protocol");
 
   /* Register the same connection with an invalid object path */
   tp_dbus_daemon_register_object (test->dbus, invalid_path, test->service_conn);
diff --git a/tests/dbus/contact-lists.c b/tests/dbus/contact-lists.c
index 7467937..e82bfe2 100644
--- a/tests/dbus/contact-lists.c
+++ b/tests/dbus/contact-lists.c
@@ -283,7 +283,7 @@ setup_pre_connect (
         EXAMPLE_TYPE_CONTACT_LIST_CONNECTION,
         "account", account,
         "simulation-delay", 0,
-        "protocol", "example-contact-list",
+        "protocol", "example_contact_list",
         NULL);
   test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
   g_assert (test->service_conn != NULL);
diff --git a/tests/dbus/telepathy/managers/test_manager_file.manager b/tests/dbus/telepathy/managers/test_manager_file.manager
index 9ffc0e5..bff055a 100644
--- a/tests/dbus/telepathy/managers/test_manager_file.manager
+++ b/tests/dbus/telepathy/managers/test_manager_file.manager
@@ -42,7 +42,7 @@ default-account = bar at default
 default-port = 4321
 default-server-list = bar;foo;
 
-[Protocol somewhat-pathological]
+[Protocol somewhat_pathological]
 # the value is "hello world"
 param-foo = s required
 default-foo =    hello world
diff --git a/tests/dbus/unsupported-interface.c b/tests/dbus/unsupported-interface.c
index 76c6cba..b701c56 100644
--- a/tests/dbus/unsupported-interface.c
+++ b/tests/dbus/unsupported-interface.c
@@ -48,7 +48,7 @@ setup (Fixture *f,
     tp_tests_object_new_static_class (
         TP_TESTS_TYPE_CONTACTS_CONNECTION,
         "account", "me at example.com",
-        "protocol", "simple-protocol",
+        "protocol", "simple_protocol",
         NULL));
   f->service_conn_as_base = TP_BASE_CONNECTION (f->service_conn);
   g_assert (f->service_conn != NULL);



More information about the telepathy-commits mailing list