tdryer / hangups

the first third-party instant messaging client for Google Hangouts
https://hangups.readthedocs.io/
MIT License
1.71k stars 189 forks source link

Add canonical_email to user.User #510

Closed amstan closed 3 years ago

amstan commented 3 years ago

I was looking for something immutable for each user (for https://github.com/tulir/mautrix-hangouts/issues/43). I was hoping i could get the user's proper email address.

Looks like user.User.emails is not really very reliable, it's simply a collection of email addresses it found in Google Contacts. I tried this experimentally: changing google contacts to something bogus yielded weird results to this array. I changed this

By doing a print(repr(entity)) in User.from_entity I noticed the entity had another cool property: canonical_email So I added is as another attribute of the User class.

Terrance commented 3 years ago

I was looking for something immutable

For what it's worth, that email field won't be immutable if you have a Google account without Gmail activated, as you can change your account's primary email address and that field would update to match. It's also not guaranteed to be filled in.

tdryer commented 3 years ago

Thanks!