forked from jshiffer/matterbridge
Do not add messages without ID to cache
This commit is contained in:
parent
ad3a753718
commit
2f7df2df43
@ -105,8 +105,8 @@ func (b *Bgitter) Send(msg config.Message) (string, error) {
|
|||||||
flog.Errorf("Could not find roomID for %v", msg.Channel)
|
flog.Errorf("Could not find roomID for %v", msg.Channel)
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
// add ZWSP because gitter echoes our own messages
|
|
||||||
if msg.ID != "" {
|
if msg.ID != "" {
|
||||||
|
flog.Debugf("updating message with id %s", msg.ID)
|
||||||
_, err := b.c.UpdateMessage(roomID, msg.ID, msg.Username+msg.Text)
|
_, err := b.c.UpdateMessage(roomID, msg.ID, msg.Username+msg.Text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -186,8 +186,10 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
// append the message ID (mID) from this bridge (dest) to our brMsgIDs slice
|
// append the message ID (mID) from this bridge (dest) to our brMsgIDs slice
|
||||||
|
if mID != "" {
|
||||||
brMsgIDs = append(brMsgIDs, &BrMsgID{dest, mID})
|
brMsgIDs = append(brMsgIDs, &BrMsgID{dest, mID})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return brMsgIDs
|
return brMsgIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func (r *Router) handleReceive() {
|
|||||||
msgIDs = append(msgIDs, gw.handleMessage(msg, br)...)
|
msgIDs = append(msgIDs, gw.handleMessage(msg, br)...)
|
||||||
}
|
}
|
||||||
// only add the message ID if it doesn't already exists
|
// only add the message ID if it doesn't already exists
|
||||||
if _, ok := gw.Messages.Get(msg.ID); !ok {
|
if _, ok := gw.Messages.Get(msg.ID); !ok && msg.ID != "" {
|
||||||
gw.Messages.Add(msg.ID, msgIDs)
|
gw.Messages.Add(msg.ID, msgIDs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user