colorize forwarded text differently
This commit is contained in:
@@ -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",
|
||||
|
||||
4
main.go
4
main.go
@@ -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 += "[\""
|
||||
|
||||
@@ -53,6 +53,7 @@ type Message struct {
|
||||
ContactShort string
|
||||
Timestamp uint64
|
||||
FromMe bool
|
||||
Forwarded bool
|
||||
Text string
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user