[telepathy-gabble/master] _emit_capabilities_changed: list the capability if we had, or have, any caps

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Aug 21 08:42:46 PDT 2009


OR'ing together the Gabble presence caps (namespace sets) and seeing
whether the result would have any Telepathy caps (flags) isn't quite
the same thing: it would wrongly consider the transition from
{ Jingle audio but no transport } to { gtalk-p2p but no content } to have
the potential to be non-trivial. (Admittedly, that's pathological.)

This lets us eliminate a pair of duplicate function calls, so, do.
---
 src/connection.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 2c06718..7034672 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2290,14 +2290,15 @@ _emit_capabilities_changed (GabbleConnection *conn,
 
   for (ccd = capabilities_conversions; NULL != ccd->iface; ccd++)
     {
-      if (ccd->c2tf_fn (old_caps | new_caps))
+      guint old_specific = ccd->c2tf_fn (old_caps);
+      guint new_specific = ccd->c2tf_fn (new_caps);
+
+      if (old_specific != 0 || new_specific != 0)
         {
           GValue caps_monster_struct = {0, };
-          guint old_specific = ccd->c2tf_fn (old_caps);
           guint old_generic = old_specific ?
             TP_CONNECTION_CAPABILITY_FLAG_CREATE |
             TP_CONNECTION_CAPABILITY_FLAG_INVITE : 0;
-          guint new_specific = ccd->c2tf_fn (new_caps);
           guint new_generic = new_specific ?
             TP_CONNECTION_CAPABILITY_FLAG_CREATE |
             TP_CONNECTION_CAPABILITY_FLAG_INVITE : 0;
-- 
1.5.6.5




More information about the telepathy-commits mailing list