diff options
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 2578671..4d77fc4 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -855,12 +855,15 @@ func (c *Client) messageToPrefix(message *client.Message, previewString string, if err != nil { log.Errorf("Could not determine if chat is PM: %v", err) } + isCarbonsEnabled := gateway.MessageOutgoingPermissionVersion > 0 && c.Session.Carbons + // with carbons, hide for all messages in PM and only for outgoing in group chats + hideSender := isCarbonsEnabled && (message.IsOutgoing || isPM) var replyStart, replyEnd int prefix := []string{} // message direction var directionChar string - if !isPM || gateway.MessageOutgoingPermissionVersion == 0 || !c.Session.Carbons { + if !hideSender { if c.Session.AsciiArrows { if message.IsOutgoing { directionChar = "> " @@ -879,7 +882,7 @@ func (c *Client) messageToPrefix(message *client.Message, previewString string, prefix = append(prefix, directionChar+strconv.FormatInt(message.Id, 10)) } // show sender in group chats - if !isPM { + if !hideSender { sender := c.formatSender(message) if sender != "" { prefix = append(prefix, sender) @@ -930,16 +933,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 isPM bool - var err error - if gateway.MessageOutgoingPermissionVersion > 0 && c.Session.Carbons { - isPM, err = c.IsPM(chatId) - if err != nil { - log.Errorf("Could not determine if chat is PM: %v", err) - } - } - - isCarbon := isPM && message.IsOutgoing + isCarbon := gateway.MessageOutgoingPermissionVersion > 0 && c.Session.Carbons && message.IsOutgoing jids := c.getCarbonFullJids(isCarbon, "") var text, oob, auxText string |