From e4bc254a65f57587dc0ee991fdf1e3033ac37ca1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 21 May 2020 20:14:43 +0300 Subject: [PATCH] Change incoming call notices back to m.text --- portal.go | 9 ++++++++- user.go | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/portal.go b/portal.go index f453973..c6239c3 100644 --- a/portal.go +++ b/portal.go @@ -919,7 +919,14 @@ func (portal *Portal) HandleFakeMessage(source *User, message FakeMessage) { return } - _, err := portal.MainIntent().SendNotice(portal.MXID, message.Text) + content := event.MessageEventContent{ + MsgType: event.MsgNotice, + Body: message.Text, + } + if message.Alert { + content.MsgType = event.MsgText + } + _, err := portal.sendMainIntentMessage(content) if err != nil { portal.log.Errorfln("Failed to handle fake message %s: %v", message.ID, err) return diff --git a/user.go b/user.go index d948374..c808ded 100644 --- a/user.go +++ b/user.go @@ -675,8 +675,9 @@ func (user *User) HandleMessageRevoke(message whatsappExt.MessageRevocation) { } type FakeMessage struct { - Text string - ID string + Text string + ID string + Alert bool } func (user *User) HandleCallInfo(info whatsappExt.CallInfo) { @@ -692,11 +693,13 @@ func (user *User) HandleCallInfo(info whatsappExt.CallInfo) { return } data.Text = "Incoming call" + data.Alert = true case whatsappExt.CallOfferVideo: if !user.bridge.Config.Bridge.CallNotices.Start { return } data.Text = "Incoming video call" + data.Alert = true case whatsappExt.CallTerminate: if !user.bridge.Config.Bridge.CallNotices.End { return