5c894efd0e
* Add PerformJoin template * Try roomserver perform join * Send correct server name to FS API * Pass through content, try to handle multiple server names * Fix local server checks * Don't refer to non-existent error * Add directory lookups of aliases * Remove unneeded parameters * Don't repeat join events into the roomserver * Unmarshal the content, that would help * Check if the user is already in the room in the fedeationapi too * Return incompatible room version error * Use Membership, don't try more servers than needed * Review comments, make FS API take list of servernames, dedupe them, break out of loop properly on success * Tweaks
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
// Copyright 2017 Vector Creations Ltd
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package types
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/matrix-org/gomatrixserverlib"
|
|
)
|
|
|
|
// A JoinedHost is a server that is joined to a matrix room.
|
|
type JoinedHost struct {
|
|
// The MemberEventID of a m.room.member join event.
|
|
MemberEventID string
|
|
// The domain part of the state key of the m.room.member join event
|
|
ServerName gomatrixserverlib.ServerName
|
|
}
|
|
|
|
type ServerNames []gomatrixserverlib.ServerName
|
|
|
|
func (s ServerNames) Len() int { return len(s) }
|
|
func (s ServerNames) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
func (s ServerNames) Less(i, j int) bool { return s[i] < s[j] }
|
|
|
|
// A EventIDMismatchError indicates that we have got out of sync with the
|
|
// room server.
|
|
type EventIDMismatchError struct {
|
|
// The event ID we have stored in our local database.
|
|
DatabaseID string
|
|
// The event ID received from the room server.
|
|
RoomServerID string
|
|
}
|
|
|
|
func (e EventIDMismatchError) Error() string {
|
|
return fmt.Sprintf(
|
|
"mismatched last sent event ID: had %q in database got %q from room server",
|
|
e.DatabaseID, e.RoomServerID,
|
|
)
|
|
}
|