aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-26 16:51:15 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-26 16:51:15 +0100
commitd97a76fcc338e7a532d0796ce5b12bdefb0a6f17 (patch)
treef8237e03007293bf4215348cd8452d65c69d5b0d /server.go
parentfacc375e8cf41f87f6b90fe5117754e2b639ce83 (diff)
downloadeasybridge-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.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/server.go b/server.go
index 84a1e85..c61ad7f 100644
--- a/server.go
+++ b/server.go
@@ -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 {