[evolution-data-server] Bug 728653 - Fix Google Talk support



commit 8c88349bf5c6df0159c2683c956fe6d300e49893
Author: Christian Schaarschmidt <schaarsc gmx de>
Date:   Thu Jun 26 16:27:58 2014 +0200

    Bug 728653 - Fix Google Talk support

 .../backends/google/e-book-backend-google.c        |   34 ++++++++++++++------
 addressbook/backends/google/e-book-google-utils.c  |   12 +++++--
 2 files changed, 33 insertions(+), 13 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c 
b/addressbook/backends/google/e-book-backend-google.c
index c5f81b4..19d1ac7 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -1517,19 +1517,17 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                return g_strjoin (
                        ",",
                        e_contact_field_name (E_CONTACT_FULL_NAME),
+
                        e_contact_field_name (E_CONTACT_EMAIL_1),
                        e_contact_field_name (E_CONTACT_EMAIL_2),
                        e_contact_field_name (E_CONTACT_EMAIL_3),
                        e_contact_field_name (E_CONTACT_EMAIL_4),
+                       e_contact_field_name (E_CONTACT_EMAIL),
+
                        e_contact_field_name (E_CONTACT_ADDRESS_LABEL_HOME),
                        e_contact_field_name (E_CONTACT_ADDRESS_LABEL_WORK),
                        e_contact_field_name (E_CONTACT_ADDRESS_LABEL_OTHER),
-                       e_contact_field_name (E_CONTACT_PHONE_HOME),
-                       e_contact_field_name (E_CONTACT_PHONE_HOME_FAX),
-                       e_contact_field_name (E_CONTACT_PHONE_BUSINESS),
-                       e_contact_field_name (E_CONTACT_PHONE_BUSINESS_FAX),
-                       e_contact_field_name (E_CONTACT_PHONE_MOBILE),
-                       e_contact_field_name (E_CONTACT_PHONE_PAGER),
+
                        e_contact_field_name (E_CONTACT_IM_AIM),
                        e_contact_field_name (E_CONTACT_IM_JABBER),
                        e_contact_field_name (E_CONTACT_IM_YAHOO),
@@ -1537,8 +1535,17 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                        e_contact_field_name (E_CONTACT_IM_ICQ),
                        e_contact_field_name (E_CONTACT_IM_SKYPE),
                        e_contact_field_name (E_CONTACT_IM_GOOGLE_TALK),
-                       e_contact_field_name (E_CONTACT_IM_GADUGADU),
-                       e_contact_field_name (E_CONTACT_IM_GROUPWISE),
+                       /* current implementation uses http://schemas.google.com/g/2005# namespace
+                        * see google-utils:gdata_gd_im_address_from_attribute
+                        *
+                        * google namespace does not support:
+                        * e_contact_field_name (E_CONTACT_IM_TWITTER),
+                        * e_contact_field_name (E_CONTACT_IM_GADUGADU),
+                        * e_contact_field_name (E_CONTACT_IM_GROUPWISE),
+                        * see https://developers.google.com/gdata/docs/2.0/elements#gdIm
+                        * see google-utils:is_known_google_im_protocol
+                       */
+
                        e_contact_field_name (E_CONTACT_ADDRESS),
                        e_contact_field_name (E_CONTACT_ADDRESS_HOME),
                        e_contact_field_name (E_CONTACT_ADDRESS_WORK),
@@ -1546,6 +1553,12 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                        e_contact_field_name (E_CONTACT_NAME),
                        e_contact_field_name (E_CONTACT_GIVEN_NAME),
                        e_contact_field_name (E_CONTACT_FAMILY_NAME),
+                       e_contact_field_name (E_CONTACT_PHONE_HOME),
+                       e_contact_field_name (E_CONTACT_PHONE_HOME_FAX),
+                       e_contact_field_name (E_CONTACT_PHONE_BUSINESS),
+                       e_contact_field_name (E_CONTACT_PHONE_BUSINESS_FAX),
+                       e_contact_field_name (E_CONTACT_PHONE_MOBILE),
+                       e_contact_field_name (E_CONTACT_PHONE_PAGER),
                        e_contact_field_name (E_CONTACT_PHONE_ASSISTANT),
                        e_contact_field_name (E_CONTACT_PHONE_BUSINESS_2),
                        e_contact_field_name (E_CONTACT_PHONE_CALLBACK),
@@ -1559,6 +1572,8 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                        e_contact_field_name (E_CONTACT_PHONE_RADIO),
                        e_contact_field_name (E_CONTACT_PHONE_TELEX),
                        e_contact_field_name (E_CONTACT_PHONE_TTYTDD),
+                       e_contact_field_name (E_CONTACT_TEL),
+
                        e_contact_field_name (E_CONTACT_IM_AIM_HOME_1),
                        e_contact_field_name (E_CONTACT_IM_AIM_HOME_2),
                        e_contact_field_name (E_CONTACT_IM_AIM_HOME_3),
@@ -1595,14 +1610,12 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                        e_contact_field_name (E_CONTACT_IM_ICQ_WORK_1),
                        e_contact_field_name (E_CONTACT_IM_ICQ_WORK_2),
                        e_contact_field_name (E_CONTACT_IM_ICQ_WORK_3),
-                       e_contact_field_name (E_CONTACT_EMAIL),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_HOME_1),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_HOME_2),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_HOME_3),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_WORK_1),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_WORK_2),
                        e_contact_field_name (E_CONTACT_IM_GADUGADU_WORK_3),
-                       e_contact_field_name (E_CONTACT_TEL),
                        e_contact_field_name (E_CONTACT_IM_SKYPE_HOME_1),
                        e_contact_field_name (E_CONTACT_IM_SKYPE_HOME_2),
                        e_contact_field_name (E_CONTACT_IM_SKYPE_HOME_3),
@@ -1615,6 +1628,7 @@ book_backend_google_get_backend_property (EBookBackend *backend,
                        e_contact_field_name (E_CONTACT_IM_GOOGLE_TALK_WORK_1),
                        e_contact_field_name (E_CONTACT_IM_GOOGLE_TALK_WORK_2),
                        e_contact_field_name (E_CONTACT_IM_GOOGLE_TALK_WORK_3),
+
                        e_contact_field_name (E_CONTACT_SIP),
                        e_contact_field_name (E_CONTACT_ORG),
                        e_contact_field_name (E_CONTACT_ORG_UNIT),
diff --git a/addressbook/backends/google/e-book-google-utils.c 
b/addressbook/backends/google/e-book-google-utils.c
index ceaff3f..c8e5b4d 100644
--- a/addressbook/backends/google/e-book-google-utils.c
+++ b/addressbook/backends/google/e-book-google-utils.c
@@ -1087,7 +1087,7 @@ is_known_google_im_protocol (const gchar *protocol)
 {
        const gchar *known_protocols[] = {
                "AIM", "MSN", "YAHOO", "SKYPE", "QQ",
-               "GOOGLE_TALK", "ICQ", "JABBER"
+               "GOOGLE-TALK", "ICQ", "JABBER"
        };
        guint i;
 
@@ -1113,7 +1113,10 @@ field_name_from_google_im_protocol (const gchar *google_protocol)
        if (!protocol)
                return NULL;
 
-       return g_strdup_printf ("X-%s", protocol + 1);
+       if (strcmp ("#GOOGLE_TALK", protocol) == 0)
+               return g_strdup (EVC_X_GOOGLE_TALK);
+       else
+               return g_strdup_printf ("X-%s", protocol + 1);
 }
 
 static gchar *
@@ -1124,7 +1127,10 @@ google_im_protocol_from_field_name (const gchar *field_name)
        if (!field_name || strlen (field_name) < 3)
                return NULL;
 
-       return g_strdup_printf (format, field_name + 2);
+       if (strcmp (field_name, EVC_X_GOOGLE_TALK) == 0)
+               return g_strdup_printf (format, "GOOGLE_TALK");
+       else
+               return g_strdup_printf (format, field_name + 2);
 }
 
 static void


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