diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-03-04 05:41:45 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-03-04 05:41:45 +0300 |
commit | 6e32c62f8dac5ccc97dd0a6067965ba2689f3c86 (patch) | |
tree | 8991478d056f538ed1782bfb66e6071486b8c9bf /telegram/utils.go | |
parent | b3d66993e5962d2b961631e3afa578967a7b3d8a (diff) |
Assign IDs from Telegram to XMPP messages
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index dabb8a2..e58f6bf 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -806,9 +806,11 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) { ForceRead: true, }) // forward message to XMPP - gateway.SendMessageWithOOB(c.jid, strconv.FormatInt(chatId, 10), text, c.xmpp, oob) + sId := strconv.FormatInt(message.Id, 10) + sChatId := strconv.FormatInt(chatId, 10) + gateway.SendMessageWithOOB(c.jid, sChatId, text, sId, c.xmpp, oob) if auxText != "" { - gateway.SendMessage(c.jid, strconv.FormatInt(chatId, 10), auxText, c.xmpp) + gateway.SendMessage(c.jid, sChatId, auxText, sId, c.xmpp) } } @@ -823,7 +825,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str // try to execute commands response, isCommand := c.ProcessChatCommand(chatID, text) if response != "" { - gateway.SendMessage(returnJid, strconv.FormatInt(chatID, 10), response, c.xmpp) + gateway.SendMessage(returnJid, strconv.FormatInt(chatID, 10), response, "", c.xmpp) } // do not send on success if isCommand { @@ -849,6 +851,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Failed to fetch the uploaded file: %s", err.Error()), + "", c.xmpp, ) return nil @@ -861,6 +864,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Received status code %v", response.StatusCode), + "", c.xmpp, ) return nil @@ -872,6 +876,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Failed to create a temporary directory: %s", err.Error()), + "", c.xmpp, ) return nil @@ -882,6 +887,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Failed to create a temporary file: %s", err.Error()), + "", c.xmpp, ) return nil @@ -893,6 +899,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Failed to write a temporary file: %s", err.Error()), + "", c.xmpp, ) return nil @@ -943,6 +950,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str returnJid, strconv.FormatInt(chatID, 10), fmt.Sprintf("Not sent: %s", err.Error()), + "", c.xmpp, ) } |