After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 566441 - The Google backend doesn't use the tags/categories/groups
The Google backend doesn't use the tags/categories/groups
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Contacts
unspecified
Other All
: Normal normal
: ---
Assigned To: evolution-addressbook-maintainers
Evolution QA team
evolution[google]
: 566464 585684 604020 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-01-03 20:07 UTC by Petr Tomasek
Modified: 2012-03-24 19:48 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Merge utility functions into the Google Contacts backend (80.89 KB, patch)
2010-11-20 16:05 UTC, Philip Withnall
committed Details | Review
gcc warning fixes (19.24 KB, patch)
2010-11-20 16:06 UTC, Philip Withnall
committed Details | Review
Add category support to the Google Contacts backend (20.57 KB, patch)
2010-11-20 16:10 UTC, Philip Withnall
reviewed Details | Review
Add category support to the Google Contacts backend (updated) (20.53 KB, patch)
2011-01-02 19:53 UTC, Philip Withnall
committed Details | Review

Description Petr Tomasek 2009-01-03 20:07:44 UTC
Please describe the problem:
Google organizes the contacts into "user groups" which work as "tags" or "categories". Thus the Google backend should translate those "user groups" into the "categories".

See documentation:
 a) how to fetch contact groups feed (needed to translate the group ID to it's name): http://code.google.com/apis/contacts/docs/2.0/reference.html#ContactGroupsFeed
 b) gContact:groupMembershipInfo property of a contact: http://code.google.com/apis/contacts/docs/2.0/reference.html#groupMembershipInfo


Steps to reproduce:



Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Philip Withnall 2010-04-21 16:22:54 UTC
*** Bug 566464 has been marked as a duplicate of this bug. ***
Comment 2 Philip Withnall 2010-04-21 16:27:08 UTC
*** Bug 604020 has been marked as a duplicate of this bug. ***
Comment 3 Philip Withnall 2010-04-21 16:38:05 UTC
*** Bug 585684 has been marked as a duplicate of this bug. ***
Comment 4 Brian Z 2010-05-29 20:53:21 UTC
Agreed, it's unfortunate that Evolution's feature of syncing with Google contacts does not include the group tags used by Google :(
Comment 5 Klaas 2010-09-30 13:31:20 UTC
This is a irritating 'bug'. I've just organized my contacts in gmail and I'm not able to do this  in evolution.

Do you have plans to solve tis issue?
Comment 6 Philip Withnall 2010-11-20 16:05:54 UTC
Created attachment 174907 [details] [review]
Merge utility functions into the Google Contacts backend

The first patch in a set of three, this merges the util.[ch] code into the main C file for the Google Contacts backend, which is necessary for some of the refactoring in the third patch.
Comment 7 Philip Withnall 2010-11-20 16:06:53 UTC
Created attachment 174908 [details] [review]
gcc warning fixes

The second patch of three, this just fixes some gcc warnings in the Google Contacts backend. It's not strictly necessary to fix this bug, but the warnings were annoying me.
Comment 8 Philip Withnall 2010-11-20 16:10:31 UTC
Created attachment 174909 [details] [review]
Add category support to the Google Contacts backend

The third patch of three, this adds category support to the Google Contacts backend. The patch should work for libgdata < 0.7 as well as libgdata >= 0.7. Since the group list needs to be downloaded separately from the list of contacts, the cache expiry logic needed some work. Note that the list of groups currently isn't cached, so has to be downloaded from the server (one request) every time the address book factory is started.
Comment 9 Philip Withnall 2010-11-20 22:47:19 UTC
After some further testing, it appears that the "#ifndef HAVE_GDATA_07" shouldn't be added to sanitise_group_id() in the third patch. Everything else should be fine though. I'll produce an updated patch after it's been reviewed.
Comment 10 Philip Withnall 2010-12-17 22:44:16 UTC
Milan, Matthew, ping?
Comment 11 Milan Crha 2010-12-21 12:49:27 UTC
Patches looks good, there is nothing much to review on them, apart of testing. It happened to me that e-addressbook-factory crashed for me, with these patches and
libgdata-0.6.4-4.fc14, so there might be done some improvements, probably in libgdata itself:

  • #0 g_list_reverse
    at glist.c line 658
  • #1 gdata_contacts_contact_get_groups
    from /usr/lib64/libgdata.so.7
  • #2 _e_contact_new_from_gdata_entry
    at e-book-backend-google.c line 2203
  • #3 cache_add_contact
    at e-book-backend-google.c line 135
  • #4 process_subsequent_entry
    at e-book-backend-google.c line 482
  • #5 g_list_foreach
    at glist.c line 938
  • #6 get_new_contacts_in_chunks
    at e-book-backend-google.c line 546
  • #7 cache_refresh_if_needed
    at e-book-backend-google.c line 798

Comment 12 Milan Crha 2010-12-21 13:40:09 UTC
With libgdata git master (commit 3dfd4de) it produces this compiler warning:

e-book-backend-google.c: In function 'sanitise_group_id':
e-book-backend-google.c:561:14: warning: unused variable 'base'

and in runtime it doesn't seem to work, because I have only few contacts which have set a group, and from the debugging output:
> libebookbackendgoogle-DEBUG: Group feed has 4 entries
> libebookbackendgoogle-DEBUG: process_group
> libebookbackendgoogle-DEBUG: Processing group http://www.google.com/m8/feeds/groups/xxx%40gmail.com/full/6, Personal
> libebookbackendgoogle-DEBUG: process_group
> libebookbackendgoogle-DEBUG: Processing group http://www.google.com/m8/feeds/groups/xxx%40gmail.com/full/d, Friends
> libebookbackendgoogle-DEBUG: process_group
> libebookbackendgoogle-DEBUG: Processing group http://www.google.com/m8/feeds/groups/xxx%40gmail.com/full/e, Family
> libebookbackendgoogle-DEBUG: process_group
> libebookbackendgoogle-DEBUG: Processing group http://www.google.com/m8/feeds/groups/xxx%40gmail.com/full/f, Coworkers
> libebookbackendgoogle-DEBUG: get_new_contacts_in_chunks
> libebookbackendgoogle-DEBUG: Feed has 17 entries
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-WARNING **: Couldn't find name for category with ID ''.
> libebookbackendgoogle-WARNING **: Couldn't find name for category with ID ''.
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-WARNING **: Couldn't find name for category with ID ''.
> libebookbackendgoogle-DEBUG: process_initial_entry
> libebookbackendgoogle-WARNING **: Couldn't find name for category with ID ''.
> libebookbackendgoogle-WARNING **: Couldn't find name for category with ID ''.

I also expect that the contacts will be updated automatically, when run evolution with these patches included, because I invoked refetch only by removing local google's backend contacts cache.
Comment 13 Philip Withnall 2010-12-21 17:58:07 UTC
(In reply to comment #11)
> Patches looks good, there is nothing much to review on them, apart of testing.
> It happened to me that e-addressbook-factory crashed for me, with these patches
> and
> libgdata-0.6.4-4.fc14, so there might be done some improvements, probably in
> libgdata itself:

I can't reproduce that. Would you be able to get a more complete stack trace and open a bug against libgdata with it please?

(In reply to comment #12)
> With libgdata git master (commit 3dfd4de) it produces this compiler warning:
> 
> e-book-backend-google.c: In function 'sanitise_group_id':
> e-book-backend-google.c:561:14: warning: unused variable 'base'

See comment #9. Try removing the “#ifndef HAVE_GDATA_07” from sanitise_group_id() and see if it works then.
Comment 14 Philip Withnall 2010-12-21 18:00:26 UTC
Pushed the first two patches to master:

commit 585eb01ed13e923eeff39132f266f3d86a1a1218
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Tue Jul 20 20:32:30 2010 +0100

    gcc warning fixes
    
    Variables shadowing various libc functions and a potentially-uninitialised
    variable.

 .../backends/google/e-book-backend-google.c        |  170 ++++++++++----------
 1 files changed, 84 insertions(+), 86 deletions(-)

commit 83acb8b4833ea364fd053f730404900b3b4e0820
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Tue Jul 20 20:19:15 2010 +0100

    Merge utility functions into Google Contacts backend

 addressbook/backends/google/Makefile.am            |    2 -
 .../backends/google/e-book-backend-google.c        | 1171 +++++++++++++++++++-
 addressbook/backends/google/util.c                 | 1183 --------------------
 addressbook/backends/google/util.h                 |   42 -
 4 files changed, 1166 insertions(+), 1232 deletions(-)
Comment 15 Matthew Barnes 2010-12-27 14:49:31 UTC
Can this be closed or is there more to do?
Comment 16 Philip Withnall 2010-12-27 15:54:46 UTC
Patch #174909 still needs to be committed. It should be fine, apart from the following change which needs making before it's committed:

"#ifndef HAVE_GDATA_07" shouldn't be added to sanitise_group_id()
Comment 17 Philip Withnall 2011-01-02 19:53:48 UTC
Created attachment 177373 [details] [review]
Add category support to the Google Contacts backend (updated)

Updated version of the third patch, rebased against master and containing the change mentioned in comment #16. To clear up any confusion, this is the only patch which still needs committing. I guess it's already been partially reviewed by Milan.
Comment 18 Jim McMahon 2011-01-03 17:31:20 UTC
I tried the patch up through comment 16 and am experiencing a different issue.  I'm able to create a new contact, select categories and save.  When I check google through the web, the contact is there and includes the correct categories.  However, back on evolution, the contact does not show any categories.  I can open this same contact, select new categories into the blank categories field, and save.  Checking google web, the contact was updated with the new categories.
Comment 19 Jim McMahon 2011-01-04 07:14:15 UTC
I rebased against master tonight and applied the patch from comment 17.  This resolved my problem from comment 18.
Comment 20 Milan Crha 2011-01-06 17:39:33 UTC
OK, the patch above seems to read the values properly and storing them in categories. There is some issue with other changes, and an update on start (I moved a contact to Friend label in google web interface and then run evolution and e-addressbook-factory and this change wasn't recognized, but clearing the cache local addressbook and re-running these two processes led to a fetch with correct values. Thus I guess it can be committed, with one exception:

What is the actual libgdata gnome requirement? The libgdata-0.6.4 is crashing with this patch, so if the crash (see comment #11) is fixed in any later version of libgdata which is also officially available in an unstable release of gnome, then we can depend on it and everything is fine. If not, then the patch should wait for the proper libgdata version availability in gnome itself.
Comment 21 Philip Withnall 2011-01-06 18:08:23 UTC
(In reply to comment #20)
> OK, the patch above seems to read the values properly and storing them in
> categories. There is some issue with other changes, and an update on start (I
> moved a contact to Friend label in google web interface and then run evolution
> and e-addressbook-factory and this change wasn't recognized, but clearing the
> cache local addressbook and re-running these two processes led to a fetch with
> correct values. Thus I guess it can be committed, with one exception:

I think it's unavoidable for the cache to have to be cleared after a user upgrades to an e-d-s with these changes, as the old cache won't contain any of the groups data in the vCard representations of all the contacts.

I took a look at the code in libgdata, but I couldn't reproduce your crash (or see what could be causing it). Could you get a more detailed stacktrace and open a bug against libgdata with it please?

> What is the actual libgdata gnome requirement? The libgdata-0.6.4 is crashing
> with this patch, so if the crash (see comment #11) is fixed in any later
> version of libgdata which is also officially available in an unstable release
> of gnome, then we can depend on it and everything is fine. If not, then the
> patch should wait for the proper libgdata version availability in gnome itself.

I think the minimum requirement is 0.6.4. GNOME's recommended dependency on libgdata is 0.6.6 at the moment, and its minimum is 0.6.4; but I've requested for the minimum to be bumped to 0.8.0. The whole backend will need updating due to API breaks between 0.7.x and 0.8.0, but I'll do that separately.

If my request to bump GNOME's dependency to 0.8.0 isn't accepted, I could probably make a 0.6.7 release with a fix for your crash, but it's getting quite hard to maintain the 0.6.x branch in the face of all the changes between it and 0.8.0.
Comment 22 Philip Withnall 2011-01-11 20:39:17 UTC
Since nobody objected, I've bumped GNOME 3.0's minimum dependency on libgdata to 0.8.0. Once this patch is committed, I'll ensure that the backend compiles and works against 0.8.0.
Comment 23 Milan Crha 2011-01-12 11:47:37 UTC
(In reply to comment #22)
> Since nobody objected, I've bumped GNOME 3.0's minimum dependency on libgdata
> to 0.8.0. Once this patch is committed, I'll ensure that the backend compiles
> and works against 0.8.0.

Good, in that case feel free to commit to sources and bump libgdata version requirement in evolution and evolution-data-server too. Thanks.
Comment 24 Philip Withnall 2011-01-15 14:39:30 UTC
It turns out that the API breaks between 0.7.x and 0.8.0 didn't affect this e-d-s work or the libgdata code in Evolution. I've bumped e-d-s' dependency to 0.7.0 and dropped the various #ifdefs, though.

commit f5230b89b1b928b5d145a7b1bb3c8f6f06c12c82
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Tue Jul 20 09:28:49 2010 +0100

    Bug 566441 — The Google backend doesn't use the tags/categories/groups
    
    Support categorising contacts using Google Contacts' groups. This includes a
    mapping of Google's system groups onto some of the default Evolution groups,
    plus support for arbitrary groups.
    
    The patch can optionally use libgdata 0.7's improved support for Google
    Contacts groups.
    
    Closes: bgo#566441

 .../backends/google/e-book-backend-google.c        |  346 +++++++++++++++++---
 1 files changed, 304 insertions(+), 42 deletions(-)

commit 69b8607f2dd6d399306905e011a6565319190066
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Sat Jan 15 14:35:08 2011 +0000

    Bump libgdata dependency to 0.7.0
    
    The minimum dependency in GNOME is now 0.8.0, so we can bump the e-d-s
    dependency to 0.7.0 and remove the various #ifdefs. See: bgo#566441

 .../backends/google/e-book-backend-google.c        |   77 --------------------
 configure.ac                                       |   10 +---
 2 files changed, 1 insertions(+), 86 deletions(-)