aboutsummaryrefslogtreecommitdiff
path: root/telegram
diff options
context:
space:
mode:
Diffstat (limited to 'telegram')
-rw-r--r--telegram/utils.go14
-rw-r--r--telegram/utils_test.go12
2 files changed, 17 insertions, 9 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 086b7ae..7e93e57 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -617,10 +617,18 @@ func (c *Client) messageToPrefix(message *client.Message, fileString string) str
prefix := []string{}
// message direction
var directionChar string
- if message.IsOutgoing {
- directionChar = "➡ "
+ if c.Session.AsciiArrows {
+ if message.IsOutgoing {
+ directionChar = "> "
+ } else {
+ directionChar = "< "
+ }
} else {
- directionChar = "⬅ "
+ if message.IsOutgoing {
+ directionChar = "➡ "
+ } else {
+ directionChar = "⬅ "
+ }
}
prefix = append(prefix, directionChar+strconv.FormatInt(message.Id, 10))
// show sender in group chats
diff --git a/telegram/utils_test.go b/telegram/utils_test.go
index c168757..a435ea9 100644
--- a/telegram/utils_test.go
+++ b/telegram/utils_test.go
@@ -497,7 +497,7 @@ func TestMessageToPrefix1(t *testing.T) {
},
},
}
- prefix := (&Client{}).messageToPrefix(&message, "")
+ prefix := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "")
if prefix != "➡ 42 | fwd: ziz" {
t.Errorf("Wrong prefix: %v", prefix)
}
@@ -512,7 +512,7 @@ func TestMessageToPrefix2(t *testing.T) {
},
},
}
- prefix := (&Client{}).messageToPrefix(&message, "")
+ prefix := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "")
if prefix != "⬅ 56 | fwd: (zaz)" {
t.Errorf("Wrong prefix: %v", prefix)
}
@@ -525,8 +525,8 @@ func TestMessageToPrefix3(t *testing.T) {
Origin: &client.MessageForwardOriginChannel{},
},
}
- prefix := (&Client{}).messageToPrefix(&message, "a.jpg")
- if prefix != "⬅ 56 | fwd: | file: a.jpg" {
+ prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "a.jpg")
+ if prefix != "< 56 | fwd: | file: a.jpg" {
t.Errorf("Wrong prefix: %v", prefix)
}
}
@@ -536,8 +536,8 @@ func TestMessageToPrefix4(t *testing.T) {
Id: 23,
IsOutgoing: true,
}
- prefix := (&Client{}).messageToPrefix(&message, "")
- if prefix != "➡ 23" {
+ prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "")
+ if prefix != "> 23" {
t.Errorf("Wrong prefix: %v", prefix)
}
}