aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-01-18 05:57:38 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-01-18 05:57:38 +0300
commitd3c6360e3ccb7924dd582269d33dcb27932a054e (patch)
tree8f5f48f1449b25f62c3b852115b89699dafa085e /telegram/utils.go
parent559d6443e5a1d3654b5542ccaadf6b33537f752d (diff)
Separate labels for OOB messages
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 6878fc6..dabb8a2 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -749,7 +749,7 @@ func (c *Client) ensureDownloadFile(file *client.File) *client.File {
// ProcessIncomingMessage transfers a message to XMPP side and marks it as read on Telegram side
func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
- var text, oob string
+ var text, oob, auxText string
content := message.Content
if content != nil && content.MessageContentType() == client.TypeMessageChatChangePhoto {
chat, err := c.client.GetChat(&client.GetChatRequest{
@@ -776,6 +776,10 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
oob = link
if c.Session.OOBMode && oob != "" {
+ typ := message.Content.MessageContentType()
+ if typ != client.TypeMessageSticker {
+ auxText = text
+ }
text = oob
} else if !c.Session.RawMessages {
var prefix strings.Builder
@@ -803,6 +807,9 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
})
// forward message to XMPP
gateway.SendMessageWithOOB(c.jid, strconv.FormatInt(chatId, 10), text, c.xmpp, oob)
+ if auxText != "" {
+ gateway.SendMessage(c.jid, strconv.FormatInt(chatId, 10), auxText, c.xmpp)
+ }
}
// ProcessOutgoingMessage executes commands or sends messages to mapped chats