diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-26 16:51:15 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-26 16:51:15 +0100 |
commit | d97a76fcc338e7a532d0796ce5b12bdefb0a6f17 (patch) | |
tree | f8237e03007293bf4215348cd8452d65c69d5b0d /server.go | |
parent | facc375e8cf41f87f6b90fe5117754e2b639ce83 (diff) | |
download | easybridge-d97a76fcc338e7a532d0796ce5b12bdefb0a6f17.tar.gz easybridge-d97a76fcc338e7a532d0796ce5b12bdefb0a6f17.zip |
Handle event IDs on xmpp; do not echo back messages
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -105,6 +105,7 @@ func handleTxnEvent(e *mxlib.Event) error { ev := &connector.Event{ Type: connector.EVENT_MESSAGE, Text: e.Content["body"].(string), + Id: e.EventId, } typ := e.Content["msgtype"].(string) if typ == "m.emote" { @@ -129,6 +130,9 @@ func handleTxnEvent(e *mxlib.Event) error { return acct.Conn.Send(ev) } } else if room := dbIsPublicRoom(e.RoomId); room != nil { + cache_key := fmt.Sprintf("%s/event_seen/%s/%s", + room.Protocol, e.RoomId, ev.Id) + dbCachePut(cache_key, "yes") // If this is a regular room acct := FindJoinedAccount(e.Sender, room.Protocol, room.RoomID) if acct != nil { |