aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 8b8da57..eb7b905 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -98,7 +98,7 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli
return chat, user, nil
}
-func userStatusToText(status client.UserStatus) (string, string) {
+func (c *Client) userStatusToText(status client.UserStatus) (string, string) {
var show, textStatus string
switch status.UserStatusType() {
@@ -121,8 +121,9 @@ func userStatusToText(status client.UserStatus) (string, string) {
} else {
show = "xa"
}
- // TODO: timezone
- textStatus = time.Unix(int64(offlineStatus.WasOnline), 0).Format("Last seen at 15:04 02/01/2006")
+ textStatus = time.Unix(int64(offlineStatus.WasOnline), 0).
+ In(c.Session.TimezoneToLocation()).
+ Format("Last seen at 15:04 02/01/2006")
}
return show, textStatus
@@ -163,7 +164,7 @@ func (c *Client) processStatusUpdate(chatID int64, status string, show string, a
if status == "" {
if user != nil {
- show, status = userStatusToText(user.Status)
+ show, status = c.userStatusToText(user.Status)
} else {
show, status = "chat", chat.Title
}
@@ -229,9 +230,12 @@ func (c *Client) formatMessage(chatID int64, messageID int64, preview bool, mess
var str strings.Builder
str.WriteString(fmt.Sprintf("%v | %s | ", message.Id, c.formatContact(int64(message.SenderUserId))))
- // TODO: timezone
if !preview {
- str.WriteString(time.Unix(int64(message.Date), 0).UTC().Format("02 Jan 2006 15:04:05 | "))
+ str.WriteString(
+ time.Unix(int64(message.Date), 0).
+ In(c.Session.TimezoneToLocation()).
+ Format("02 Jan 2006 15:04:05 | "),
+ )
}
var text string