Separate labels for OOB messages

This commit is contained in:
Bohdan Horbeshko 2023-01-17 21:57:38 -05:00
parent 559d6443e5
commit d3c6360e3c

View file

@ -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 // ProcessIncomingMessage transfers a message to XMPP side and marks it as read on Telegram side
func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) { func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
var text, oob string var text, oob, auxText string
content := message.Content content := message.Content
if content != nil && content.MessageContentType() == client.TypeMessageChatChangePhoto { if content != nil && content.MessageContentType() == client.TypeMessageChatChangePhoto {
chat, err := c.client.GetChat(&client.GetChatRequest{ chat, err := c.client.GetChat(&client.GetChatRequest{
@ -776,6 +776,10 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
oob = link oob = link
if c.Session.OOBMode && oob != "" { if c.Session.OOBMode && oob != "" {
typ := message.Content.MessageContentType()
if typ != client.TypeMessageSticker {
auxText = text
}
text = oob text = oob
} else if !c.Session.RawMessages { } else if !c.Session.RawMessages {
var prefix strings.Builder var prefix strings.Builder
@ -803,6 +807,9 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
}) })
// forward message to XMPP // forward message to XMPP
gateway.SendMessageWithOOB(c.jid, strconv.FormatInt(chatId, 10), text, c.xmpp, oob) 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 // ProcessOutgoingMessage executes commands or sends messages to mapped chats