mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Fix id clash for OOB caption messages
This commit is contained in:
parent
f2867a7fc3
commit
7c9ea42f99
2 changed files with 6 additions and 1 deletions
|
|
@ -1984,13 +1984,16 @@ func (c *Client) SendMessageToGateway(chatId int64, message *client.Message, id
|
|||
// forward message to XMPP
|
||||
var sId string
|
||||
var stanzaId string
|
||||
var auxId string
|
||||
strId := strconv.FormatInt(message.Id, 10)
|
||||
if id == "" {
|
||||
sId = strId
|
||||
stanzaId = strId
|
||||
auxId = "c"+strId
|
||||
} else {
|
||||
sId = id
|
||||
stanzaId = strId
|
||||
auxId = ""
|
||||
}
|
||||
|
||||
var from string
|
||||
|
|
@ -2031,7 +2034,7 @@ func (c *Client) SendMessageToGateway(chatId int64, message *client.Message, id
|
|||
for _, jid := range jids {
|
||||
gateway.SendMessageWithOOB(jid, from, text, sId, c.xmpp, reply, timestamp, oob, "", isCarbon, isGroupchat, c.Session.Receipts, originalFrom, stanzaId, mamQueryId, mucJID, mucUserItem)
|
||||
if auxText != "" {
|
||||
gateway.SendMessage(jid, from, auxText, sId, c.xmpp, reply, timestamp, "", isCarbon, isGroupchat, c.Session.Receipts, originalFrom, stanzaId, mamQueryId, mucJID, mucUserItem)
|
||||
gateway.SendMessage(jid, from, auxText, auxId, c.xmpp, reply, timestamp, "", isCarbon, isGroupchat, c.Session.Receipts, originalFrom, auxId, mamQueryId, mucJID, mucUserItem)
|
||||
}
|
||||
}
|
||||
c.UpdateLastChatMessageId(chatId, sId)
|
||||
|
|
|
|||
|
|
@ -2908,6 +2908,8 @@ func parseMessageId(sId string) (int64, bool) {
|
|||
if len(idParts) >= 1 {
|
||||
sId = idParts[0]
|
||||
}
|
||||
} else if sId[0] == 'c' {
|
||||
sId = sId[1:]
|
||||
}
|
||||
id, err := strconv.ParseInt(sId, 10, 64)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue