Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

3PID invite exchange over federation #222

Merged
merged 16 commits into from
Sep 11, 2017

Conversation

babolivier
Copy link
Contributor

Follows matrix-org/gomatrixserverlib#61

This PR address the case where the server receives a 3PID invite from an identity server for a room it's not in. It will then send to the room's server all the necessary data for building a m.room.member event so the room's server can authenticate it.

return nil, nil
// Use federation to auth the event
var remoteServer gomatrixserverlib.ServerName
_, remoteServer, err = gomatrixserverlib.SplitID('!', inv.RoomID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think synapse also falls back to the server who sent the "m.room.third_party_invite" by using the user ID of the sender of the invite, or am I imagining things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it first checks on the sender's server and then the room's server. Fixed in 0e356e2

return nil, nil
// Use federation to auth the event
var remoteServers []gomatrixserverlib.ServerName
_, remoteServers[0], err = gomatrixserverlib.SplitID('@', inv.Sender)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have problems because the remoteServers slice will have length 0.

remoteServers := make([]gomatrixserverlib.ServerName, 2)

might be better here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Fixed in ebe91ac

continue
}

err = federation.ExchangeThirdPartyInvite(server, *builder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is an error you may want to continue and try the next server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e1c8861

Copy link
Contributor

@NegativeMjark NegativeMjark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants