Fix missing read markers in other XMPP clients than the message sender
This commit is contained in:
parent
144c5724ea
commit
b499992148
|
@ -56,8 +56,10 @@ func (c *Client) cleanTempFile(path string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) sendMarker(chatId, messageId int64, typ gateway.MarkerType) {
|
func (c *Client) sendMarker(chatId, messageId int64, typ gateway.MarkerType) {
|
||||||
if xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, chatId, messageId); err == nil {
|
xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, chatId, messageId)
|
||||||
resource := c.getFromOutbox(xmppId)
|
if err != nil {
|
||||||
|
xmppId = strconv.FormatInt(messageId, 10)
|
||||||
|
}
|
||||||
|
|
||||||
var stringType string
|
var stringType string
|
||||||
if typ == gateway.MarkerTypeReceived {
|
if typ == gateway.MarkerTypeReceived {
|
||||||
|
@ -67,20 +69,16 @@ func (c *Client) sendMarker(chatId, messageId int64, typ gateway.MarkerType) {
|
||||||
}
|
}
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"xmppId": xmppId,
|
"xmppId": xmppId,
|
||||||
"resource": resource,
|
|
||||||
}).Debugf("marker: %s", stringType)
|
}).Debugf("marker: %s", stringType)
|
||||||
|
|
||||||
if resource != "" {
|
|
||||||
gateway.SendMessageMarker(
|
gateway.SendMessageMarker(
|
||||||
c.jid+"/"+resource,
|
c.jid,
|
||||||
strconv.FormatInt(chatId, 10),
|
strconv.FormatInt(chatId, 10),
|
||||||
c.xmpp,
|
c.xmpp,
|
||||||
typ,
|
typ,
|
||||||
xmppId,
|
xmppId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) updateHandler() {
|
func (c *Client) updateHandler() {
|
||||||
listener := c.client.GetListener()
|
listener := c.client.GetListener()
|
||||||
|
|
|
@ -203,7 +203,7 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
|
||||||
} else {
|
} else {
|
||||||
err = gateway.IdsDB.Set(session.Session.Login, bare, toID, tgMessageId, msg.Id)
|
err = gateway.IdsDB.Set(session.Session.Login, bare, toID, tgMessageId, msg.Id)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
session.AddToOutbox(msg.Id, resource)
|
// session.AddToOutbox(msg.Id, resource)
|
||||||
session.UpdateLastChatMessageId(toID, msg.Id)
|
session.UpdateLastChatMessageId(toID, msg.Id)
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("Failed to save ids %v/%v %v", toID, tgMessageId, msg.Id)
|
log.Errorf("Failed to save ids %v/%v %v", toID, tgMessageId, msg.Id)
|
||||||
|
|
Loading…
Reference in a new issue