diff --git a/config/bridge.go b/config/bridge.go index c5f8b5c..e965bda 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -41,6 +41,11 @@ type BridgeConfig struct { ReportConnectionRetry bool `yaml:"report_connection_retry"` ContactWaitDelay int `yaml:"contact_wait_delay"` + CallNotices struct { + Start bool `yaml:"start"` + End bool `yaml:"end"` + } `yaml:"call_notices"` + InitialChatSync int `yaml:"initial_chat_sync_count"` InitialHistoryFill int `yaml:"initial_history_fill_count"` RecoverChatSync int `yaml:"recovery_chat_sync_count"` @@ -71,6 +76,9 @@ func (bc *BridgeConfig) setDefaults() { bc.ReportConnectionRetry = true bc.ContactWaitDelay = 1 + bc.CallNotices.Start = true + bc.CallNotices.End = true + bc.InitialChatSync = 10 bc.InitialHistoryFill = 20 bc.RecoverChatSync = -1 diff --git a/example-config.yaml b/example-config.yaml index 1fdf443..b6ef72c 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -79,6 +79,11 @@ bridge: # If you have lots of chats, it might take more than a second. contact_wait_delay: 1 + # Whether or not to send call start/end notices to Matrix. + call_notices: + start: true + end: true + # Number of chats to sync for new users. initial_chat_sync_count: 10 # Number of old messages to fill when creating new portal rooms. diff --git a/user.go b/user.go index 80a77c4..42f4f62 100644 --- a/user.go +++ b/user.go @@ -578,10 +578,19 @@ func (user *User) HandleCallInfo(info whatsappExt.CallInfo) { } switch info.Type { case whatsappExt.CallOffer: + if !user.bridge.Config.Bridge.CallNotices.Start { + return + } data.Text = "Incoming call" case whatsappExt.CallOfferVideo: + if !user.bridge.Config.Bridge.CallNotices.Start { + return + } data.Text = "Incoming video call" case whatsappExt.CallTerminate: + if !user.bridge.Config.Bridge.CallNotices.End { + return + } data.Text = "Call ended" data.ID += "E" default: