Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canonical_email should be part of the matrix usernames #43

Closed
amstan opened this issue Jan 22, 2021 · 4 comments
Closed

canonical_email should be part of the matrix usernames #43

amstan opened this issue Jan 22, 2021 · 4 comments

Comments

@amstan
Copy link

amstan commented Jan 22, 2021

I really think the google account usernames should be part of the matrix usernames, instead of the long (opaque) number.

What I have now: @hangouts_100121435454675246423:example.com, this might be hangups.user.UserID but i'm not sure.

What I want to have: @hangouts_somegaia_at_gmail.com:example.com. hangups.user.User.emails is probably what we should be using.

Perhaps this is related to issue #42.

Though, I'm not sure how migration would work though for chats I'm already in.

@tulir
Copy link
Member

tulir commented Jan 22, 2021

Matrix user IDs are immutable, so the bridge needs to use an immutable identifier for bridged users.

@amstan
Copy link
Author

amstan commented Jan 22, 2021

I'm pretty sure GAIAs are immutable (eg: i can't change my gmail address while i'm chatting with someone).

Ignoring the migration diffculties, this shouldn't be a problem.

@amstan
Copy link
Author

amstan commented Jan 23, 2021

I'm pretty sure GAIAs are immutable

Hmm, maybe. But I don't think hangups.user.User.emails[0] is immutable. It seems to be generated fully from the details at contacts.google.com. Hangups seems to grab the set of emails associated with any match from there (even if nonsensical).

@amstan amstan changed the title GAIAs/emails should be part of the matrix usernames canonical_email should be part of the matrix usernames Jan 23, 2021
@amstan
Copy link
Author

amstan commented Jan 23, 2021

Ok! what do we think now? Immutable enough? Maybe a config option if we're not sure? I'm willing to take the risk on my bridge.

diff --git a/mautrix_hangouts/portal.py b/mautrix_hangouts/portal.py
index 0bb9821..9eaa785 100644
--- a/mautrix_hangouts/portal.py
+++ b/mautrix_hangouts/portal.py
@@ -218,6 +218,7 @@ class Portal(BasePortal):
             self.other_user_id = users[0].id_.gaia_id
         if not self.mxid:
             return
+        self.log.debug([(user.canonical_email, user.emails) for user in users])
         puppets: Dict[HangoutsUser, p.Puppet] = {user: p.Puppet.get_by_gid(user.id_.gaia_id)
                                                  for user in users}
         await asyncio.gather(*[puppet.update_info(source=source, info=user)

@tulir tulir closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants