diff options
Diffstat (limited to 'appservice')
-rw-r--r-- | appservice/account.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/appservice/account.go b/appservice/account.go index 3791ee3..e2f2ee9 100644 --- a/appservice/account.go +++ b/appservice/account.go @@ -230,7 +230,7 @@ func (a *Account) eventInternal(event *Event) error { err = mx.RoomInvite(mx_room_id, mx_user_id) if err != nil { if strings.Contains(err.Error(), "already in the room") { - err = nil + return nil } return err } @@ -260,6 +260,16 @@ func (a *Account) eventInternal(event *Event) error { } } + if event.Id != "" { + cache_key := fmt.Sprintf("%s/event_seen/%s/%s", + a.Protocol, mx_room_id, event.Id) + if !dbCacheTestAndSet(cache_key, "yes") { + // false: cache key was not modified, meaning we + // already saw the event + return nil + } + } + typ := "m.text" if event.Type == EVENT_ACTION { typ = "m.emote" |