mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
client: update MSC2666 implementation
This commit is contained in:
parent
531822f6dc
commit
df24fb96e2
3 changed files with 10 additions and 3 deletions
|
|
@ -1158,7 +1158,9 @@ func (cli *Client) SearchUserDirectory(ctx context.Context, query string, limit
|
|||
}
|
||||
|
||||
func (cli *Client) GetMutualRooms(ctx context.Context, otherUserID id.UserID, extras ...ReqMutualRooms) (resp *RespMutualRooms, err error) {
|
||||
if cli.SpecVersions != nil && !cli.SpecVersions.Supports(FeatureMutualRooms) {
|
||||
supportsStable := cli.SpecVersions.Supports(FeatureStableMutualRooms)
|
||||
supportsUnstable := cli.SpecVersions.Supports(FeatureUnstableMutualRooms)
|
||||
if cli.SpecVersions != nil && !supportsUnstable && !supportsStable {
|
||||
err = fmt.Errorf("server does not support fetching mutual rooms")
|
||||
return
|
||||
}
|
||||
|
|
@ -1168,7 +1170,10 @@ func (cli *Client) GetMutualRooms(ctx context.Context, otherUserID id.UserID, ex
|
|||
if len(extras) > 0 {
|
||||
query["from"] = extras[0].From
|
||||
}
|
||||
urlPath := cli.BuildURLWithQuery(ClientURLPath{"unstable", "uk.half-shot.msc2666", "user", "mutual_rooms"}, query)
|
||||
urlPath := cli.BuildURLWithQuery(ClientURLPath{"v1", "user", "mutual_rooms"}, query)
|
||||
if !supportsStable && supportsUnstable {
|
||||
urlPath = cli.BuildURLWithQuery(ClientURLPath{"unstable", "uk.half-shot.msc2666", "user", "mutual_rooms"}, query)
|
||||
}
|
||||
_, err = cli.MakeRequest(ctx, http.MethodGet, urlPath, nil, &resp)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ func (r *UserDirectoryEntry) MarshalJSON() ([]byte, error) {
|
|||
type RespMutualRooms struct {
|
||||
Joined []id.RoomID `json:"joined"`
|
||||
NextBatch string `json:"next_batch,omitempty"`
|
||||
Count int `json:"count,omitempty"`
|
||||
}
|
||||
|
||||
type RespRoomSummary struct {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ var (
|
|||
FeatureAsyncUploads = UnstableFeature{UnstableFlag: "fi.mau.msc2246.stable", SpecVersion: SpecV17}
|
||||
FeatureAppservicePing = UnstableFeature{UnstableFlag: "fi.mau.msc2659.stable", SpecVersion: SpecV17}
|
||||
FeatureAuthenticatedMedia = UnstableFeature{UnstableFlag: "org.matrix.msc3916.stable", SpecVersion: SpecV111}
|
||||
FeatureMutualRooms = UnstableFeature{UnstableFlag: "uk.half-shot.msc2666.query_mutual_rooms"}
|
||||
FeatureUnstableMutualRooms = UnstableFeature{UnstableFlag: "uk.half-shot.msc2666.query_mutual_rooms"}
|
||||
FeatureStableMutualRooms = UnstableFeature{UnstableFlag: "uk.half-shot.msc2666.query_mutual_rooms.stable" /*, SpecVersion: SpecV118*/}
|
||||
FeatureUserRedaction = UnstableFeature{UnstableFlag: "org.matrix.msc4194"}
|
||||
FeatureViewRedactedContent = UnstableFeature{UnstableFlag: "fi.mau.msc2815"}
|
||||
FeatureUnstableAccountModeration = UnstableFeature{UnstableFlag: "uk.timedout.msc4323"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue