Move Invite logic to GMSL (#3086)
This is both the federation receiving & sending side logic (which were previously entangeld in a single function)
This commit is contained in:
parent
cbdc601f1b
commit
ea6b368ad4
15 changed files with 359 additions and 442 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
|
@ -457,3 +458,22 @@ type QueryLeftUsersRequest struct {
|
|||
type QueryLeftUsersResponse struct {
|
||||
LeftUsers []string `json:"user_ids"`
|
||||
}
|
||||
|
||||
type MembershipQuerier struct {
|
||||
Roomserver FederationRoomserverAPI
|
||||
}
|
||||
|
||||
func (mq *MembershipQuerier) CurrentMembership(ctx context.Context, roomID spec.RoomID, userID spec.UserID) (string, error) {
|
||||
req := QueryMembershipForUserRequest{
|
||||
RoomID: roomID.String(),
|
||||
UserID: userID.String(),
|
||||
}
|
||||
res := QueryMembershipForUserResponse{}
|
||||
err := mq.Roomserver.QueryMembershipForUser(ctx, &req, &res)
|
||||
|
||||
membership := ""
|
||||
if err == nil {
|
||||
membership = res.Membership
|
||||
}
|
||||
return membership, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue