diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-03-20 23:38:48 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-03-20 23:38:48 +0200 |
commit | 911107313224bce1ec33a1cae1a7218c21eb0dfb (patch) | |
tree | b23bb724b925731736e7070bd5cca7fe214a7c97 | |
parent | bb58954f755ac0ee5a7ad7e11159f00810d23aa3 (diff) |
Improve notification data format
-rw-r--r-- | matrix/matrix.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go index 9689827..556d567 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -189,7 +189,12 @@ func (c *Container) Start() { } func (c *Container) NotifyMessage(room *rooms.Room, message *types.Message) { - notification.Send(room.GetTitle(), message.Text, false) + sender := fmt.Sprintf("%s (%s)", message.Sender, room.GetTitle()) + if room.GetTitle() == message.Sender { + // 1:1 room, title is same as display name of other user. + sender = message.Sender + } + notification.Send(sender, message.Text, false) } func (c *Container) HandleMessage(evt *gomatrix.Event) { |