Add option to disable call start/end notifications. Fixes #68
This commit is contained in:
parent
07d43c4825
commit
80a0edd855
3 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
9
user.go
9
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:
|
||||
|
|
Loading…
Reference in a new issue