colorize forwarded text differently

This commit is contained in:
normen
2020-11-28 02:24:32 +01:00
parent 3521a3b6f5
commit f91ffbef0f
4 changed files with 8 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ type Ui struct {
type Colors struct {
Background string
Text string
ForwardedText string
ListHeader string
ListContact string
ListGroup string
@@ -102,6 +103,7 @@ var Config = IniFile{
&Colors{
Background: "black",
Text: "white",
ForwardedText: "purple",
ListHeader: "yellow",
ListContact: "green",
ListGroup: "blue",

View File

@@ -592,11 +592,15 @@ func getMessagesString(msgs []messages.Message) string {
}
// create a formatted string with regions based on message ID from a text message
//TODO: optimize, use Sprintf etc
func getTextMessageString(msg *messages.Message) string {
colorMe := config.Config.Colors.ChatMe
colorContact := config.Config.Colors.ChatContact
out := ""
text := tview.Escape(msg.Text)
if msg.Forwarded {
text = "[" + config.Config.Colors.ForwardedText + "]" + text + "[-]"
}
tim := time.Unix(int64(msg.Timestamp), 0)
time := tim.Format("02-01-06 15:04:05")
out += "[\""

View File

@@ -53,6 +53,7 @@ type Message struct {
ContactShort string
Timestamp uint64
FromMe bool
Forwarded bool
Text string
}

View File

@@ -724,6 +724,7 @@ func (sm *SessionManager) createMessage(msg *whatsapp.TextMessage) Message {
newMsg.FromMe = msg.Info.FromMe
newMsg.Timestamp = msg.Info.Timestamp
newMsg.Text = msg.Text
newMsg.Forwarded = msg.ContextInfo.IsForwarded
if strings.Contains(msg.Info.RemoteJid, STATUSSUFFIX) {
newMsg.ContactId = msg.Info.SenderJid
newMsg.ContactName = sm.db.GetIdName(msg.Info.SenderJid)