mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
event: use full event type for stripped state for MSC4311
This commit is contained in:
parent
0b62253d3b
commit
96b07ad724
3 changed files with 12 additions and 29 deletions
|
|
@ -130,23 +130,16 @@ func (evt *Event) GetStateKey() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type StrippedState struct {
|
||||
Content Content `json:"content"`
|
||||
Type Type `json:"type"`
|
||||
StateKey string `json:"state_key"`
|
||||
Sender id.UserID `json:"sender"`
|
||||
}
|
||||
|
||||
type Unsigned struct {
|
||||
PrevContent *Content `json:"prev_content,omitempty"`
|
||||
PrevSender id.UserID `json:"prev_sender,omitempty"`
|
||||
Membership Membership `json:"membership,omitempty"`
|
||||
ReplacesState id.EventID `json:"replaces_state,omitempty"`
|
||||
Age int64 `json:"age,omitempty"`
|
||||
TransactionID string `json:"transaction_id,omitempty"`
|
||||
Relations *Relations `json:"m.relations,omitempty"`
|
||||
RedactedBecause *Event `json:"redacted_because,omitempty"`
|
||||
InviteRoomState []StrippedState `json:"invite_room_state,omitempty"`
|
||||
PrevContent *Content `json:"prev_content,omitempty"`
|
||||
PrevSender id.UserID `json:"prev_sender,omitempty"`
|
||||
Membership Membership `json:"membership,omitempty"`
|
||||
ReplacesState id.EventID `json:"replaces_state,omitempty"`
|
||||
Age int64 `json:"age,omitempty"`
|
||||
TransactionID string `json:"transaction_id,omitempty"`
|
||||
Relations *Relations `json:"m.relations,omitempty"`
|
||||
RedactedBecause *Event `json:"redacted_because,omitempty"`
|
||||
InviteRoomState []*Event `json:"invite_room_state,omitempty"`
|
||||
|
||||
BeeperHSOrder int64 `json:"com.beeper.hs.order,omitempty"`
|
||||
BeeperHSSuborder int16 `json:"com.beeper.hs.suborder,omitempty"`
|
||||
|
|
|
|||
|
|
@ -648,12 +648,7 @@ type RespHierarchy struct {
|
|||
|
||||
type ChildRoomsChunk struct {
|
||||
PublicRoomInfo
|
||||
ChildrenState []StrippedStateWithTime `json:"children_state"`
|
||||
}
|
||||
|
||||
type StrippedStateWithTime struct {
|
||||
event.StrippedState
|
||||
Timestamp jsontime.UnixMilli `json:"origin_server_ts"`
|
||||
ChildrenState []*event.Event `json:"children_state"`
|
||||
}
|
||||
|
||||
type RespAppservicePing struct {
|
||||
|
|
|
|||
9
sync.go
9
sync.go
|
|
@ -263,7 +263,7 @@ func dontProcessOldEvents(userID id.UserID, resp *RespSync, since string) bool {
|
|||
// cli.Syncer.(mautrix.ExtensibleSyncer).OnSync(cli.MoveInviteState)
|
||||
func (cli *Client) MoveInviteState(ctx context.Context, resp *RespSync, _ string) bool {
|
||||
for _, meta := range resp.Rooms.Invite {
|
||||
var inviteState []event.StrippedState
|
||||
var inviteState []*event.Event
|
||||
var inviteEvt *event.Event
|
||||
for _, evt := range meta.State.Events {
|
||||
if evt.Type == event.StateMember && evt.GetStateKey() == cli.UserID.String() {
|
||||
|
|
@ -271,12 +271,7 @@ func (cli *Client) MoveInviteState(ctx context.Context, resp *RespSync, _ string
|
|||
} else {
|
||||
evt.Type.Class = event.StateEventType
|
||||
_ = evt.Content.ParseRaw(evt.Type)
|
||||
inviteState = append(inviteState, event.StrippedState{
|
||||
Content: evt.Content,
|
||||
Type: evt.Type,
|
||||
StateKey: evt.GetStateKey(),
|
||||
Sender: evt.Sender,
|
||||
})
|
||||
inviteState = append(inviteState, evt)
|
||||
}
|
||||
}
|
||||
if inviteEvt != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue