[folks] eds: Add a extra parameter on IM fields created based on e-mail address



commit 8d17efeb1f750dc9e6ae21993c50ed254c8972b5
Author: Renato Araujo Oliveira Filho <renato filho canonical com>
Date:   Tue Jan 28 17:23:53 2014 -0300

    eds: Add a extra parameter on IM fields created based on e-mail address
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723187

 backends/eds/lib/edsf-persona.vala |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona.vala b/backends/eds/lib/edsf-persona.vala
index 26cd2e0..7a076f1 100644
--- a/backends/eds/lib/edsf-persona.vala
+++ b/backends/eds/lib/edsf-persona.vala
@@ -112,6 +112,18 @@ public class Edsf.Persona : Folks.Persona,
     };
 
   /**
+   * Name of folks’ custom parameter indicating automatic fields
+   *
+   * Folks can create extra fields to improve linking between personas.
+   * These fields have a boolean-typed parameter added with this name,
+   * and the value ‘TRUE’. This allows clients to detect such fields
+   * and (for example) ignore them in the UI.
+   *
+   * Since: UNRELEASED
+   */
+  public static const string folks_field_attribute_name = "X-FOLKS-FIELD";
+
+  /**
    * The vCard attribute used to specify a Contact's gender
    *
    * Based on:
@@ -1683,13 +1695,16 @@ public class Edsf.Persona : Folks.Persona,
         }
 
       /* We consider some e-mail addresses to be IM IDs too. This
-       * is pretty much a hack to make sure e-d-s contacts are
+       * is pretty much a hack to make sure EDS contacts are
        * automatically linked with their corresponding Telepathy
        * Persona. As an undesired side effect we might end up having
        * IM addresses that aren't actually used as such (i.e.: people
-       * who don't actually use GMail or MSN addresses for IM).
+       * who don't actually use GMail or MSN addresses for IM): this can be
+       * detected by clients by looking for the
+       * { link Edsf.Persona.folks_field_attribute_name} parameter existing and
+       * being set to `TRUE` on the { link ImFieldDetails}.
        *
-       * See bgo#657142
+       * See: bgo#657142, bgo#723187
        */
       foreach (var email in this._email_addresses)
         {
@@ -1722,6 +1737,9 @@ public class Edsf.Persona : Folks.Persona,
                   string normalised_addr =
                     ImDetails.normalise_im_address (email.value, proto);
                   var im_fd = new ImFieldDetails (normalised_addr);
+
+                  im_fd.add_parameter (
+                      Edsf.Persona.folks_field_attribute_name, "TRUE");
                   new_im_addresses.set (proto, im_fd);
                 }
               catch (Folks.ImDetailsError e)


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