|
|
|
@ -56,30 +56,28 @@ func (c *Client) cleanTempFile(path string) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
resource := c.getFromOutbox(xmppId)
|
|
|
|
|
|
|
|
|
|
var stringType string
|
|
|
|
|
if typ == gateway.MarkerTypeReceived {
|
|
|
|
|
stringType = "received"
|
|
|
|
|
} else if typ == gateway.MarkerTypeDisplayed {
|
|
|
|
|
stringType = "displayed"
|
|
|
|
|
}
|
|
|
|
|
log.WithFields(log.Fields{
|
|
|
|
|
"xmppId": xmppId,
|
|
|
|
|
"resource": resource,
|
|
|
|
|
}).Debugf("marker: %s", stringType)
|
|
|
|
|
|
|
|
|
|
if resource != "" {
|
|
|
|
|
gateway.SendMessageMarker(
|
|
|
|
|
c.jid+"/"+resource,
|
|
|
|
|
strconv.FormatInt(chatId, 10),
|
|
|
|
|
c.xmpp,
|
|
|
|
|
typ,
|
|
|
|
|
xmppId,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
xmppId, err := gateway.IdsDB.GetByTgIds(c.Session.Login, c.jid, chatId, messageId)
|
|
|
|
|
if err != nil {
|
|
|
|
|
xmppId = strconv.FormatInt(messageId, 10)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var stringType string
|
|
|
|
|
if typ == gateway.MarkerTypeReceived {
|
|
|
|
|
stringType = "received"
|
|
|
|
|
} else if typ == gateway.MarkerTypeDisplayed {
|
|
|
|
|
stringType = "displayed"
|
|
|
|
|
}
|
|
|
|
|
log.WithFields(log.Fields{
|
|
|
|
|
"xmppId": xmppId,
|
|
|
|
|
}).Debugf("marker: %s", stringType)
|
|
|
|
|
|
|
|
|
|
gateway.SendMessageMarker(
|
|
|
|
|
c.jid,
|
|
|
|
|
strconv.FormatInt(chatId, 10),
|
|
|
|
|
c.xmpp,
|
|
|
|
|
typ,
|
|
|
|
|
xmppId,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *Client) updateHandler() {
|
|
|
|
|