add config item for sync contact

This commit is contained in:
zhaoYangguang 2022-06-02 18:46:48 +08:00
parent bb9f424d44
commit 0e52308a25
3 changed files with 10 additions and 3 deletions

View File

@ -40,6 +40,7 @@ type BridgeConfig struct {
RecoverChatSync int `yaml:"recovery_chat_sync_count"`
RecoverHistory bool `yaml:"recovery_history_backfill"`
SyncChatMaxAge uint64 `yaml:"sync_max_chat_age"`
SyncContact bool `yaml:"sync_contact"`
SyncWithCustomPuppets bool `yaml:"sync_with_custom_puppets"`
@ -101,6 +102,7 @@ func (bc *BridgeConfig) setDefaults() {
bc.RecoverChatSync = -1
bc.RecoverHistory = true
bc.SyncChatMaxAge = 259200
bc.SyncContact = false
bc.SyncWithCustomPuppets = true

View File

@ -126,6 +126,9 @@ bridge:
# Default is 3 days = 259200 seconds
sync_max_chat_age: 259200
# sync contact, Non-martix-standard parameter, defaults to false
sync_contact: false
# Whether or not to sync with custom puppets to receive EDUs that
# are not normally sent to appservices.
sync_with_custom_puppets: true

View File

@ -630,9 +630,11 @@ func (user *User) syncPuppets(contacts map[string]skype.Contact, toHomeserver bo
matrixContacts = append(matrixContacts, string(puppet.MXID))
}
}
customPuppet := user.bridge.GetPuppetByCustomMXID(user.MXID)
if customPuppet != nil && customPuppet.CustomIntent() != nil {
customPuppet.SetMatrixContacts(matrixContacts)
if user.bridge.Config.Bridge.SyncContact {
customPuppet := user.bridge.GetPuppetByCustomMXID(user.MXID)
if customPuppet != nil && customPuppet.CustomIntent() != nil {
customPuppet.SetMatrixContacts(matrixContacts)
}
}
user.log.Infoln("Finished syncing puppet info from contacts")
}