mirror of
https://github.com/maubot/maubot
synced 2025-08-30 06:30:39 +00:00
Update dependencies
This commit is contained in:
parent
22ef8195dd
commit
2a0106da26
17 changed files with 1229 additions and 347 deletions
15
vendor/maunium.net/go/gomatrix/sync.go
generated
vendored
15
vendor/maunium.net/go/gomatrix/sync.go
generated
vendored
|
@ -25,7 +25,7 @@ type Syncer interface {
|
|||
type DefaultSyncer struct {
|
||||
UserID string
|
||||
Store Storer
|
||||
listeners map[string][]OnEventListener // event type to listeners array
|
||||
listeners map[EventType][]OnEventListener // event type to listeners array
|
||||
}
|
||||
|
||||
// OnEventListener can be used with DefaultSyncer.OnEventType to be informed of incoming events.
|
||||
|
@ -36,7 +36,7 @@ func NewDefaultSyncer(userID string, store Storer) *DefaultSyncer {
|
|||
return &DefaultSyncer{
|
||||
UserID: userID,
|
||||
Store: store,
|
||||
listeners: make(map[string][]OnEventListener),
|
||||
listeners: make(map[EventType][]OnEventListener),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (s *DefaultSyncer) ProcessResponse(res *RespSync, since string) (err error)
|
|||
|
||||
// OnEventType allows callers to be notified when there are new events for the given event type.
|
||||
// There are no duplicate checks.
|
||||
func (s *DefaultSyncer) OnEventType(eventType string, callback OnEventListener) {
|
||||
func (s *DefaultSyncer) OnEventType(eventType EventType, callback OnEventListener) {
|
||||
_, exists := s.listeners[eventType]
|
||||
if !exists {
|
||||
s.listeners[eventType] = []OnEventListener{}
|
||||
|
@ -112,13 +112,8 @@ func (s *DefaultSyncer) shouldProcessResponse(resp *RespSync, since string) bool
|
|||
for roomID, roomData := range resp.Rooms.Join {
|
||||
for i := len(roomData.Timeline.Events) - 1; i >= 0; i-- {
|
||||
e := roomData.Timeline.Events[i]
|
||||
if e.Type == "m.room.member" && e.StateKey != nil && *e.StateKey == s.UserID {
|
||||
m := e.Content["membership"]
|
||||
mship, ok := m.(string)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if mship == "join" {
|
||||
if e.Type == StateMember && e.GetStateKey() == s.UserID {
|
||||
if e.Content.Membership == "join" {
|
||||
_, ok := resp.Rooms.Join[roomID]
|
||||
if !ok {
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue