[empathy/next: 59/79] use new TpChannelFilter API



commit ebf9b7fe1423551d1bd04e8351fc9ccc035e9ce9
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Mar 25 18:11:11 2014 +0000

    use new TpChannelFilter API
    
    [We decided tp_channel_filter_new_for_file_transfers() should only
    match FTs to/from contacts, so don't redundantly call
    tp_channel_filter_require_target_is_contact() -smcv]

 libempathy/empathy-chatroom-manager.c |    6 ++----
 libempathy/empathy-ft-factory.c       |   14 +++++++-------
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 5df9600..9add7fd 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -588,10 +588,8 @@ empathy_chatroom_manager_constructor (GType type,
   priv->observer = tp_simple_observer_new_with_am (priv->account_manager, TRUE,
       "Empathy.ChatroomManager", TRUE, observe_channel_cb, self, NULL);
 
-  tp_base_client_add_observer_filter (priv->observer, g_variant_new_parsed (
-        "{ %s: <%s>, %s: <%u> }",
-        TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_TEXT,
-        TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, (guint32) TP_ENTITY_TYPE_ROOM));
+  tp_base_client_take_observer_filter (priv->observer,
+      tp_channel_filter_new_for_text_chatrooms ());
 
   if (!tp_base_client_register (priv->observer, &error))
     {
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index ed5bfd5..b661d00 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -186,6 +186,7 @@ empathy_ft_factory_init (EmpathyFTFactory *self)
   EmpathyFTFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
     EMPATHY_TYPE_FT_FACTORY, EmpathyFTFactoryPriv);
   TpAccountManager *am;
+  TpChannelFilter *filter;
 
   self->priv = priv;
 
@@ -194,13 +195,12 @@ empathy_ft_factory_init (EmpathyFTFactory *self)
   priv->handler = tp_simple_handler_new_with_am (am, FALSE, FALSE,
       EMPATHY_FT_TP_BUS_NAME_SUFFIX, FALSE, handle_channel_cb, self, NULL);
 
-  tp_base_client_add_handler_filter (priv->handler, g_variant_new_parsed (
-        "{ %s: <%s>, %s: <%u>, %s: <%b> }",
-        TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1,
-        TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, (guint32) TP_ENTITY_TYPE_CONTACT,
-        /* Only handle *incoming* channels as outgoing FT channels has to be
-         * handled by the requester. */
-        TP_PROP_CHANNEL_REQUESTED, FALSE));
+  filter = tp_channel_filter_new_for_file_transfers (NULL);
+  /* Only handle *incoming* channels as outgoing FT channels has to be
+   * handled by the requester. */
+  tp_channel_filter_require_locally_requested (filter, FALSE);
+
+  tp_base_client_take_handler_filter (priv->handler, filter);
 
   g_object_unref (am);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]