empathy r2203 - trunk/libempathy



Author: xclaesse
Date: Fri Jan  9 16:16:14 2009
New Revision: 2203
URL: http://svn.gnome.org/viewvc/empathy?rev=2203&view=rev

Log:
Ignore requested channels we didn't request except for text channels, also ignore deprecated channels types and channels for which it doesn't make sense to handle them unless they were requested

Signed-off-by: Sjoerd Simons <sjoerd simons collabora co uk>

Modified:
   trunk/libempathy/empathy-dispatcher.c

Modified: trunk/libempathy/empathy-dispatcher.c
==============================================================================
--- trunk/libempathy/empathy-dispatcher.c	(original)
+++ trunk/libempathy/empathy-dispatcher.c	Fri Jan  9 16:16:14 2009
@@ -478,6 +478,16 @@
   ConnectionData *cd;
   EmpathyDispatchOperation *operation;
   EmpathyContact *contact = NULL;
+  int i;
+  /* Channel types we never want to dispatch because they're either deprecated
+   * or can't sensibly be dispatch (e.g. channels that should always be
+   * requested) */
+  const char *blacklist[] = {
+    TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
+    TP_IFACE_CHANNEL_TYPE_TUBES,
+    TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
+    NULL
+  };
 
   cd = g_hash_table_lookup (priv->connections, connection);
 
@@ -495,8 +505,27 @@
   if (g_hash_table_lookup (cd->outstanding_channels, object_path) != NULL)
     return;
 
-  DEBUG ("New channel of type %s on %s",
-    channel_type, object_path);
+  /* Only pick up non-requested text channels. For all other it doesn't make
+   * sense to handle it if we didn't request it. The same goes for channels we
+   * discovered by the Channels property or ListChannels */
+  if (!incoming && tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT))
+    {
+      DEBUG ("Ignoring incoming channel of type %s on %s",
+        channel_type, object_path);
+      return;
+    }
+
+  for (i = 0 ; blacklist[i] != NULL; i++)
+    {
+      if (!tp_strdiff (channel_type, blacklist[i]))
+        {
+          DEBUG ("Ignoring blacklisted channel type %s on %s",
+            channel_type, object_path);
+          return;
+        }
+    }
+
+  DEBUG ("New channel of type %s on %s", channel_type, object_path);
 
   if (properties == NULL)
     channel = tp_channel_new (connection, object_path, channel_type,



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