[folks] telepathy: Fix use of deprecated Telepathy API



commit cc091166c138310f06297803fd3991f119624fb6
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Jan 23 15:00:40 2015 +0000

    telepathy: Fix use of deprecated Telepathy API
    
    This bumps our telepathy-glib dependency from 0.19.0 to 0.19.9, which
    should be fine — it’s a micro version bump, and all distributions which
    ship telepathy-glib have shipped something newer than 0.20.0 for ages.

 NEWS                                          |    1 +
 backends/telepathy/lib/tpf-persona-store.vala |    6 +++---
 backends/telepathy/lib/tpf-persona.vala       |   16 +++++++++++-----
 configure.ac                                  |    2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index b1064b0..b1fc94d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Overview of changes from libfolks 0.10.1 to libfolks 0.11.0
 ===========================================================
 
 Dependencies:
+ • telepathy-glib ≥ 0.19.9
 
 Major changes:
  • The --enable-tests configure option has been renamed to
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 049c68a..e47bf61 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -395,8 +395,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
       /* We do not trust local-xmpp or IRC at all, since Persona UIDs can be
        * faked by just changing hostname/username or nickname. */
-      if (account.get_protocol () == "local-xmpp" ||
-          account.get_protocol () == "irc")
+      if (account.protocol_name == "local-xmpp" ||
+          account.protocol_name == "irc")
         this.trust_level = PersonaStoreTrust.NONE;
       else
         this.trust_level = PersonaStoreTrust.PARTIAL;
@@ -851,7 +851,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
           if ((ci_flags & ContactInfoFlags.CAN_SET) != 0)
             {
               var field_specs =
-                connection.get_contact_info_supported_fields ();
+                connection.dup_contact_info_supported_fields ();
               foreach (var field_spec in field_specs)
                 {
                   /* XXX: we ignore the maximum count for each type of
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index fee2f2b..aa7b66b 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -762,6 +762,12 @@ public class Tpf.Persona : Folks.Persona,
       var connection = contact.connection;
       var account = connection.get_account ();
       var uid = Folks.Persona.build_uid (store.type_id, store.id, id);
+      var is_user = false;
+
+      if (connection.self_contact != null)
+        {
+          is_user = (contact.handle == connection.self_contact.handle);
+        }
 
       Object (contact: contact,
               display_id: id,
@@ -769,10 +775,10 @@ public class Tpf.Persona : Folks.Persona,
                * interface along with the code in
                * Kf.Persona.linkable_property_to_links(), but that depends on
                * bgo#624842 being fixed. */
-              iid: account.get_protocol () + ":" + id,
+              iid: account.protocol_name + ":" + id,
               uid: uid,
               store: store,
-              is_user: contact.handle == connection.self_handle);
+              is_user: is_user);
 
       debug ("Created new Tpf.Persona '%s' for service-specific UID '%s': %p",
           uid, id, this);
@@ -819,9 +825,9 @@ public class Tpf.Persona : Folks.Persona,
       try
         {
           var im_addr = ImDetails.normalise_im_address (this.display_id,
-              account.get_protocol ());
+              account.protocol_name);
           var im_fd = new ImFieldDetails (im_addr);
-          this._im_addresses.set (account.get_protocol (), im_fd);
+          this._im_addresses.set (account.protocol_name, im_fd);
         }
       catch (ImDetailsError e)
         {
@@ -978,7 +984,7 @@ public class Tpf.Persona : Folks.Persona,
            AbstractFieldDetails<string>.hash_static,
            AbstractFieldDetails<string>.equal_static);
 
-      var contact_info = contact.get_contact_info ();
+      var contact_info = contact.dup_contact_info ();
       foreach (var info in contact_info)
         {
           if (info.field_name == "") {}
diff --git a/configure.ac b/configure.ac
index cc44861..84d3d19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,7 +278,7 @@ PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1 dbus-1])
 
 PKG_CHECK_MODULES([GEE], [gee-0.8 >= $GEE_REQUIRED])
 
-TP_GLIB_REQUIRED=0.19.0
+TP_GLIB_REQUIRED=0.19.9
 
 AS_IF([test x$enable_telepathy_backend = xyes], [
         PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])])


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