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 657142 - Automatically link e-d-s contacts with their contacts from telepathy
Automatically link e-d-s contacts with their contacts from telepathy
Product: folks
Classification: Platform
Component: e-d-s backend
git master
Other Linux
: Normal normal
: folks-0.6.4
Assigned To: folks-maint
Depends on:
Blocks: 659040
Reported: 2011-08-23 09:18 UTC by Alexander Larsson
Modified: 2011-09-14 12:32 UTC
See Also:
GNOME target: ---
GNOME version: ---

Handle IM addreses from Google contacts (2.48 KB, patch)
2011-08-23 14:44 UTC, Raul Gutierrez Segales
rejected Details | Review
treat certain e-mail addresses as IM addresses (2.94 KB, patch)
2011-09-13 13:52 UTC, Raul Gutierrez Segales
none Details | Review
Test case. (6.80 KB, patch)
2011-09-13 13:53 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
treat certain e-mail addresses as IM addresses (2.94 KB, patch)
2011-09-13 14:26 UTC, Raul Gutierrez Segales
none Details | Review
patch (2.94 KB, patch)
2011-09-13 15:18 UTC, Raul Gutierrez Segales
none Details | Review
treat certain e-mail addresses as IM addresses (3.51 KB, patch)
2011-09-13 15:19 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review

Description Alexander Larsson 2011-08-23 09:18:36 UTC
It would be nice if we could automatically link up google contact personas in the eds backend with their corresponding gtalk telepathy personas. This seems perfectly safe and right to me.
Comment 1 Alexander Larsson 2011-08-23 09:20:59 UTC
I guess the  eds backend need to automatically generates a read-only gtalk IM fields for google talks users. Is such data availible via the gdata protocol?
Comment 2 Raul Gutierrez Segales 2011-08-23 12:13:02 UTC
As discussed on IRC, e-d-s' google backend should be populating the IM address field:

Though alexl mentioned he couldn't see such fields when dumping a VCard from a contact coming from the Google backend (e-d-s/libgdata bug?). We should fix this and also make sure folks checks such field for IM addresses. That should make the linking happen.
Comment 3 Raul Gutierrez Segales 2011-08-23 13:32:08 UTC
Looking a little bit closer into this, this is how the e-book-backend-google transforms what it gets from libgdata into an EVCardAttribute:

$10 = (const gchar *) 0x7fffe0020c10 ""
(gdb) n
3369		field_name = field_name_from_google_im_protocol (gdata_gd_im_address_get_protocol (im));
(gdb) n
3370		if (!field_name)
(gdb) n
3373		attr = e_vcard_attribute_new (NULL, field_name);
(gdb) print field_name
$11 = (gchar *) 0x653dd0 "X-GOOGLE_TALK"

So or we either handle that field (and all the other possibilities for IM addresses that Google has) from Folks or we get proper support for them in e-d-s (as with the other IM addresses).
Comment 4 Raul Gutierrez Segales 2011-08-23 14:44:53 UTC
Created attachment 194487 [details] [review]
Handle IM addreses from Google contacts

First go at this, if the approach is right it needs to be extended for all the possible IM fields GMail generates.
Comment 5 Raul Gutierrez Segales 2011-08-23 15:01:51 UTC
Btw, all the other IM protos get picked up :

im-addresses          { 'msn' : { '' }, 'icq' : { 'XXXX-icq' }, 'skype' : { 'XXXX' }, 'jabber' : { 'XXXX', '' }, 'aim' : { 'XXXX.aim' } }

So it is was only GTalk which gets thrown to a special field not recognized by e-d-s.
Comment 6 Philip Withnall 2011-08-23 19:46:20 UTC
Review of attachment 194487 [details] [review]:

As discussed on IRC, this is probably better fixed by adding GTalk as a new synthetic field in EContact.
Comment 7 Raul Gutierrez Segales 2011-08-24 14:49:01 UTC
Following up on e-d-s:
Comment 8 Alexander Larsson 2011-08-24 21:21:14 UTC
I tried this with the latest e-d-s and i still got no im-addresses for gtalk users. For instance:

Persona '\://':
  avatar                0x7f2a74003a00
  email-addresses       {, }
  groups                {  }
  im-addresses          {  }

This should have a jabber im-address for it to match:
Persona 'telepathy:/org/freedesktop/Telepathy/Account/gabble/jabber/':
  alias                 Jeff Waugh
  avatar                0x7f2a74973e00 (file: file:///home/alex/.cache/telepathy/avatars/gabble/jabber/_33b0ec6f86bf76ee4f370c5ffa93600c53a11c394)
  groups                { 'Gnome' }
  im-addresses          { 'jabber' : { '' } }
Comment 9 Philip Withnall 2011-08-24 22:20:35 UTC
Discussion about this on IRC:

pwithnall: alex_away: Re. bgo#657142, does that EContact actually have a Google Talk IM address set in Evolution? We don't claim to automatically copy e-mail addresses to the IM addresses field (and we shouldn't, since that contact might not ever use Google Talk)
alex_away: pwithnall: I have no idea really
alex_away: pwithnall: but, the contact is from google contacts, and google knows that i added that contact to my buddy list, so it *should* be able to tell me the jabber address for it
alex_away: pwithnall: I don't want to have to go through all the google contacts that have a gtalk address and manually type in a jabber address...
pwithnall: alex_away: I agree, Google should do that…but they don't. That information isn't exposed in the Google Contacts API at all
alex_away: pwithnall: ick
pwithnall: Yup :-(
alex_away: pwithnall: that makes the whole thing quite useless
 * pwithnall checks just to be sure
alex_away: pwithnall: i guess we could match all email addresses
pwithnall: yeuch
alex_away: pwithnall: its that or force every user to manually link all their google contacts together...
alex_away: pwithnall: utter loss
pwithnall: I would be uncomfortable with adding GMail addresses to the im-addresses property of EDS personas in folks, but I guess you could do it in gnome-contacts
alex_away: pwithnall: eh? how?
 - Maiku has joined the room
alex_away: iterate over the whole address book on startup and write the im-addresses?
pwithnall: oh, sorry, yes, that's a rubbish idea since it won't affect linking
alex_away: ideally they *should* give out some im info
 - maximi89 has disconnected (Ping timeout: 600 seconds)
alex_away: i mean, maybe someone is running gmail on their own domain thing
alex_away: and we'd want to also pick that up
pwithnall: alex_away: The Google Contacts API is basically just an XML serialisation of vCard. Nothing more.
pwithnall: There is zero integration with Google Talk
pwithnall: or GMail
alex_away: sure
pwithnall: Hopefully that will change in future, since they seem to be heading in that direction, and the Google Contacts API is reasonably well maintained
alex_away: but in the google contacts web app it lists the gmail address and then has chat and email links on that line
alex_away: so, it would make sense to encode that info in the serialized vcard version of the contact
pwithnall: It would
pwithnall: I'll submit a bug report against the Google Contacts API about it if one doesn't already exist, but don't get too hopeful
Robot101: we could e-mail the secret google XMPP team and say, how do we resolve this?
alex_away: or we could just do that badhack and make our users happy...
alex_away: well, if we can get a real fix in before 3.2 that would be great
pwithnall: Robot101: ++
Robot101: what's the bad hack?
alex_away: but if we're forcing all gnome 3.2 google users to manually link together all their contacts thats pretty bad
Robot101: have a whitelist of gmail / googlemail / ...? known domains and replicate the IM field to the email field in telepathy contacts in the relevant cases?
alex_away: Robot101: if (g_str_has_suffix (email, "")) { im-addresses += email}
Robot101: the same applies for MSN and
alex_away: Robot101: not in telepathy contacts
alex_away: Robot101: in eds contacts
 - om26er__ has joined the room
alex_away: we don't link on email
alex_away: its gotta be the eds contact that has to have the right im-address
alex_away: based on an email
Robot101: oh, ick
alex_away: yeah, its icky all right
Robot101: you need a bunch of domains though, and if you're doing it you should totally do the MSN ones too
alex_away: anyway, i'm gonna be hiding im-addresses that are used for linking in the eds edit UI anyway
Robot101: right, as the IM persona will be there
alex_away: so, the ick is purely internal
alex_away: Robot101: yeah, no need to show it twice, or risk the user editing it breaking the link
 - alex_away - alsuren - albanc - 
Robot101: right
Robot101: pwithnall: how did we do it for our facebook demo?
alex_away: Of course, its not purely internal
Robot101: we had libsocialweb facebook contacts linking with telepathy xmpp contacts
alex_away: It may be at some point we edit the im-addresses field and write back the email address there
alex_away: then other apps will see it
alex_away: another approach would be to make the individualaggregator match emails to im-addresses as well
pwithnall: Robot101: I didn't have anything to do with that; that was treitter, I think
alex_away: then you pick up any jabber address that is the same as the email address
alex_away: which is kinda nice
 - alex_away - alsuren - albanc - 
alex_away: although it does put some magic in the core folks code
pwithnall: alex_away: That sounds like a nicer solution, but also means the pain of touching the aggregation code
alex_away: pwithnall: it does. but fortunately i leave that pain to you guys :-)
alex_away: anyway, time to Zzz
alex_away: later
Robot101: pwithnall: or barisione 
 - om26er_ has disconnected (Ping timeout: 600 seconds)
barisione: alex_away: mathing emails and jabber addresses is possibly wrong
barisione: pwithnall: ^
pwithnall: alex_away, Robot101: if you want to star it, for all the good that'll do
barisione: as the same string could be for different people
Robot101: barisione: only if your domain's syadmin is an asshat, seriously
Robot101: *sys
barisione: I actually found servers like that at some point :-P
Robot101: we could maintain a blacklist
Robot101: of public XMPP servers which don't provide corresponding e-mail
barisione: for the facebook demo I think I could have just modified the libsocialweb facebook thing to add the JID to every contact
pwithnall: That's sounding like the safest and easiest solution at the moment; to just copy e-mail addresses into the im-addresses field inside the eds backend (and the same for, etc.)
pwithnall: The only downside is that we could end up advertising IM addresses which people don't use…but then my address book's full of those anyway, so meh.
Comment 10 Raul Gutierrez Segales 2011-08-29 12:46:48 UTC
Didn't make this release; punting to 0.6.2.
Comment 11 Travis Reitter 2011-09-05 16:49:30 UTC
(Punting bugs to 0.6.4)
Comment 12 Raul Gutierrez Segales 2011-09-09 14:29:44 UTC
So, do we have consensus on whether we'd like to assume certain e-mail addresses represent IM ids too?
Comment 13 Philip Withnall 2011-09-12 20:24:18 UTC
(In reply to comment #12)
> So, do we have consensus on whether we'd like to assume certain e-mail
> addresses represent IM ids too?

I think so, yes. If you'd like to do the necessary changes, that would be great.
Comment 14 Raul Gutierrez Segales 2011-09-13 13:52:58 UTC
Created attachment 196374 [details] [review]
treat certain e-mail addresses as IM addresses

Here it goes.
Comment 15 Raul Gutierrez Segales 2011-09-13 13:53:31 UTC
Created attachment 196375 [details] [review]
Test case.

And a small test case so we can sleep easily at nights.
Comment 16 Raul Gutierrez Segales 2011-09-13 14:26:20 UTC
Created attachment 196382 [details] [review]
treat certain e-mail addresses as IM addresses

Updated according to feedback from Alex, we make sure that we don't overwrite existing IM addresses.

One open issue is unlinking...
Comment 17 Raul Gutierrez Segales 2011-09-13 15:18:09 UTC
Created attachment 196389 [details] [review]
Comment 18 Raul Gutierrez Segales 2011-09-13 15:19:36 UTC
Created attachment 196390 [details] [review]
treat certain e-mail addresses as IM addresses

This patch is *actually* new.
Comment 19 Philip Withnall 2011-09-13 17:38:57 UTC
Review of attachment 196390 [details] [review]:

Looks good to me, apart from the two comments below which can be fixed (or ignored, in the case of, if I'm wrong about it having e-mail addresses) before committing.

::: backends/eds/lib/edsf-persona.vala
@@ +1233,3 @@
+      /* We consider some e-mail addresses to be IM IDs too */

Probably worth pointing out that this is hacky, and referring to the bug report for rationale.

@@ +1533,3 @@
+      if (domain == "msn" ||
+          domain == "hotmail")

Should we also check for “live[.com]” here too?
Comment 20 Philip Withnall 2011-09-13 17:40:53 UTC
Review of attachment 196375 [details] [review]:

Looks good to me.
Comment 21 Alexander Larsson 2011-09-13 18:41:46 UTC
I think we should check some x-foo vcard attribute for im_addresses to not add, before adding them. Then we make setting the im_addresses property set these x-foo attributes when some auto-added im address is not in the set. This way we can support unlinking.
Comment 22 Philip Withnall 2011-09-13 19:18:35 UTC
(In reply to comment #21)
> I think we should check some x-foo vcard attribute for im_addresses to not add,
> before adding them. Then we make setting the im_addresses property set these
> x-foo attributes when some auto-added im address is not in the set. This way we
> can support unlinking.

I'd much rather fix bug #629537 than implement anti-linking in ad-hoc and hacky ways like this, but since that bug's not going to get fixed for GNOME 3.2, if you think anti-linking for IM addresses vs. e-mail addresses is sufficiently importantly, I think an x-foo attribute would be reasonable.
Comment 23 Alexander Larsson 2011-09-13 19:38:52 UTC
anti-linking for IM addresses isn't super important, it just means that we'll be unable to unlink these and it will look weird when it happens in the UI.

Its far more important that we automatically link these together as that affects every google user.

Still, It might be nice to do.
Comment 24 Raul Gutierrez Segales 2011-09-14 10:37:06 UTC

commit f25a44b93018dd64042a1c318b35d9b4a696124f
Author: Raul Gutierrez Segales <>
Date:   Tue Sep 13 14:51:48 2011 +0100

    e-d-s: add test for auto linking via emails and IM addresses

commit c8c7cbf2b006eafb3cccbe2bec601ac83d4cc505
Author: Raul Gutierrez Segales <>
Date:   Tue Sep 13 12:44:08 2011 +0100

    e-d-s: assume certain e-mail addresseses are IM IDs too