telepathy-glib: Set the ChannelRequests immutable properties when handling channels

Sjoerd Simons sjoerd at kemper.freedesktop.org
Thu Aug 30 02:31:35 PDT 2012


Module: telepathy-glib
Branch: master
Commit: b6342b5b39d5f0cd02e2580ddc569d0eeb9e8c72
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=b6342b5b39d5f0cd02e2580ddc569d0eeb9e8c72

Author: Sjoerd Simons <sjoerd.simons at collabora.co.uk>
Date:   Thu Aug 30 10:08:15 2012 +0200

Set the ChannelRequests immutable properties when handling channels

When HandleChannels comes in we are given all the immutable properties
for the statisfied requests straight away, so lets use them as well.
This prevents poor application authors from being confused about their
hints not coming through in their handler.

---

 telepathy-glib/base-client.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c
index dfdda15..5ac5081 100644
--- a/telepathy-glib/base-client.c
+++ b/telepathy-glib/base-client.c
@@ -191,6 +191,7 @@
 #include <telepathy-glib/channel-request.h>
 #include <telepathy-glib/channel.h>
 #include <telepathy-glib/dbus-internal.h>
+#include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/handle-channels-context-internal.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/observe-channels-context-internal.h>
@@ -2283,6 +2284,7 @@ _tp_base_client_handle_channels (TpSvcClientHandler *iface,
   GArray *account_features;
   GArray *connection_features;
   GArray *channel_features;
+  GHashTable *request_props;
 
   if (!(self->priv->flags & CLIENT_IS_HANDLER))
     {
@@ -2313,20 +2315,27 @@ _tp_base_client_handle_channels (TpSvcClientHandler *iface,
   channel = g_ptr_array_index (channels, 0);
 
   requests = g_ptr_array_new_full (requests_arr->len, g_object_unref);
+  request_props = tp_asv_get_boxed (handler_info, "request-properties",
+    TP_HASH_TYPE_OBJECT_IMMUTABLE_PROPERTIES_MAP);
   for (i = 0; i < requests_arr->len; i++)
     {
       const gchar *req_path = g_ptr_array_index (requests_arr, i);
       TpChannelRequest *request;
+      GHashTable *props = NULL;
+
+      if (request_props != NULL)
+        props = g_hash_table_lookup (request_props, req_path);
 
       request = find_request_by_path (self, req_path);
       if (request != NULL)
         {
           g_object_ref (request);
+          _tp_channel_request_ensure_immutable_properties (request, props);
         }
       else
         {
           request = _tp_simple_client_factory_ensure_channel_request (
-              self->priv->factory, req_path, NULL, &error);
+              self->priv->factory, req_path, props, &error);
           if (request == NULL)
             {
               DEBUG ("Failed to create TpChannelRequest: %s", error->message);



More information about the telepathy-commits mailing list