Move CreateRoom logic to Roomserver (#3093)

Move create room logic over to roomserver.
This commit is contained in:
devonh 2023-05-31 15:27:08 +00:00 committed by GitHub
parent 61341aca50
commit cbdc601f1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 684 additions and 550 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
asAPI "github.com/matrix-org/dendrite/appservice/api"
fsAPI "github.com/matrix-org/dendrite/federationapi/api"
@ -169,6 +170,7 @@ type ClientRoomserverAPI interface {
GetRoomIDForAlias(ctx context.Context, req *GetRoomIDForAliasRequest, res *GetRoomIDForAliasResponse) error
GetAliasesForRoomID(ctx context.Context, req *GetAliasesForRoomIDRequest, res *GetAliasesForRoomIDResponse) error
PerformCreateRoom(ctx context.Context, userID spec.UserID, roomID spec.RoomID, createRequest *PerformCreateRoomRequest) (string, *util.JSONResponse)
// PerformRoomUpgrade upgrades a room to a newer version
PerformRoomUpgrade(ctx context.Context, roomID, userID string, roomVersion gomatrixserverlib.RoomVersion) (newRoomID string, err error)
PerformAdminEvacuateRoom(ctx context.Context, roomID string) (affected []string, err error)

View file

@ -1,6 +1,10 @@
package api
import (
"crypto/ed25519"
"encoding/json"
"time"
"github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/fclient"
@ -8,6 +12,26 @@ import (
"github.com/matrix-org/util"
)
type PerformCreateRoomRequest struct {
InvitedUsers []string
RoomName string
Visibility string
Topic string
StatePreset string
CreationContent json.RawMessage
InitialState []gomatrixserverlib.FledglingEvent
RoomAliasName string
RoomVersion gomatrixserverlib.RoomVersion
PowerLevelContentOverride json.RawMessage
IsDirect bool
UserDisplayName string
UserAvatarURL string
KeyID gomatrixserverlib.KeyID
PrivateKey ed25519.PrivateKey
EventTime time.Time
}
type PerformJoinRequest struct {
RoomIDOrAlias string `json:"room_id_or_alias"`
UserID string `json:"user_id"`