[Telepathy-commits] [telepathy-mission-control/master] Store only the handler name.

Alberto Mardegan alberto.mardegan at nokia.com
Mon Nov 3 06:26:24 PST 2008


We don't need the full well-known D-Bus name.
---
 src/mcd-dispatch-operation.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index a7891c5..1af1350 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -40,6 +40,9 @@
 #include "_gen/interfaces.h"
 #include "_gen/gtypes.h"
 
+#define MCD_CLIENT_BASE_NAME "org.freedesktop.Telepathy.Client."
+#define MCD_CLIENT_BASE_NAME_LEN (sizeof (MCD_CLIENT_BASE_NAME) - 1)
+
 #define MCD_DISPATCH_OPERATION_PRIV(operation) (MCD_DISPATCH_OPERATION (operation)->priv)
 
 static void
@@ -213,7 +216,17 @@ dispatch_operation_handle_with (McSvcChannelDispatchOperation *self,
         return;
     }
 
-    priv->handler = g_strdup (handler_path);
+    if (strncmp (handler_path, MCD_CLIENT_BASE_NAME,
+                 MCD_CLIENT_BASE_NAME_LEN) != 0)
+    {
+        GError *error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+                                     "Invalid handler name");
+        dbus_g_method_return_error (context, error);
+        g_error_free (error);
+        return;
+    }
+
+    priv->handler = g_strdup (handler_path + MCD_CLIENT_BASE_NAME_LEN);
     mc_svc_channel_dispatch_operation_return_from_handle_with (context);
 
     mcd_dispatch_operation_finish (MCD_DISPATCH_OPERATION (self));
-- 
1.5.6.5




More information about the Telepathy-commits mailing list