From e8bde731642f50c8d272c33343ec78ca70405377 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Tue, 19 Sep 2023 07:31:24 -0400 Subject: Original sender JID in MUCs (why?) --- telegram/handlers.go | 2 +- telegram/utils.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'telegram') diff --git a/telegram/handlers.go b/telegram/handlers.go index b7277e8..8facc10 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -265,7 +265,7 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) { markupFunction, )) for _, jid := range jids { - gateway.SendMessage(jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, 0, false, false) + gateway.SendMessage(jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, 0, false, false, "") } } } diff --git a/telegram/utils.go b/telegram/utils.go index 036956b..fd7a433 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -1046,12 +1046,18 @@ func (c *Client) sendMessageToGateway(chatId int64, message *client.Message, del var isCarbon bool var jids []string var isGroupchat bool + var originalFrom string if len(groupChatTos) == 0 { isCarbon = gateway.MessageOutgoingPermissionVersion > 0 && c.Session.Carbons && message.IsOutgoing jids = c.getCarbonFullJids(isCarbon, "") } else { isGroupchat = true jids = groupChatTos + + senderId := c.getSenderId(message) + if senderId != 0 { + originalFrom = strconv.FormatInt(senderId, 10) + "@" + gateway.Jid.Full() + } } var text, oob, auxText string @@ -1138,9 +1144,9 @@ func (c *Client) sendMessageToGateway(chatId int64, message *client.Message, del } for _, jid := range jids { - gateway.SendMessageWithOOB(jid, from, text, sId, c.xmpp, reply, timestamp, oob, isCarbon, isGroupchat) + gateway.SendMessageWithOOB(jid, from, text, sId, c.xmpp, reply, timestamp, oob, isCarbon, isGroupchat, originalFrom) if auxText != "" { - gateway.SendMessage(jid, from, auxText, sId, c.xmpp, reply, timestamp, isCarbon, isGroupchat) + gateway.SendMessage(jid, from, auxText, sId, c.xmpp, reply, timestamp, isCarbon, isGroupchat, originalFrom) } } } @@ -1768,6 +1774,7 @@ func (c *Client) sendMessagesReverse(chatID int64, messages []*client.Message, p 0, false, false, + "", ) } else { c.sendMessageToGateway( -- cgit v1.2.3