|
|
|
@ -214,7 +214,6 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
|
|
|
|
|
} else {
|
|
|
|
|
log.Infof("Couldn't retrieve XMPP message ids for %v, an echo may happen", update.Message.Id)
|
|
|
|
|
}
|
|
|
|
|
log.Warnf("xmppId: %v, ignoredResource: %v", xmppId, ignoredResource)
|
|
|
|
|
|
|
|
|
|
// guarantee sequential message delivering per chat
|
|
|
|
|
lock := c.getChatMessageLock(chatId)
|
|
|
|
@ -233,6 +232,24 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
|
|
|
|
|
// message content updated
|
|
|
|
|
func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
|
|
|
|
|
markupFunction := formatter.EntityToXEP0393
|
|
|
|
|
|
|
|
|
|
c.SendMessageLock.Lock()
|
|
|
|
|
c.SendMessageLock.Unlock()
|
|
|
|
|
xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, update.ChatId, update.MessageId)
|
|
|
|
|
var ignoredResource string
|
|
|
|
|
if err == nil {
|
|
|
|
|
ignoredResource = c.popFromOutbox(xmppId)
|
|
|
|
|
} else {
|
|
|
|
|
log.Infof("Couldn't retrieve XMPP message ids for %v, an echo may happen", update.MessageId)
|
|
|
|
|
}
|
|
|
|
|
log.Infof("ignoredResource: %v", ignoredResource)
|
|
|
|
|
|
|
|
|
|
jids := c.getCarbonFullJids(true, ignoredResource)
|
|
|
|
|
if len(jids) == 0 {
|
|
|
|
|
log.Info("The only resource is ignored, aborting")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if update.NewContent.MessageContentType() == client.TypeMessageText {
|
|
|
|
|
textContent := update.NewContent.(*client.MessageText)
|
|
|
|
|
var editChar string
|
|
|
|
@ -246,7 +263,9 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
|
|
|
|
|
textContent.Text.Entities,
|
|
|
|
|
markupFunction,
|
|
|
|
|
))
|
|
|
|
|
gateway.SendMessage(c.jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, false)
|
|
|
|
|
for _, jid := range jids {
|
|
|
|
|
gateway.SendMessage(jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|