aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--telegabber.go2
-rw-r--r--telegram/utils.go18
3 files changed, 8 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index ef6aef4..d6323d0 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
COMMIT := $(shell git rev-parse --short HEAD)
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
-VERSION := "v1.7.6"
+VERSION := "v1.8.0-dev"
MAKEOPTS := "-j4"
all:
diff --git a/telegabber.go b/telegabber.go
index 3802764..671e13b 100644
--- a/telegabber.go
+++ b/telegabber.go
@@ -15,7 +15,7 @@ import (
goxmpp "gosrc.io/xmpp"
)
-var version string = "1.7.6"
+var version string = "1.8.0-dev"
var commit string
var sm *goxmpp.StreamManager
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