From 7655ff1a648e6312203623ff4bcc3ab85653cc18 Mon Sep 17 00:00:00 2001 From: vurpo Date: Mon, 8 May 2023 16:58:30 +0300 Subject: [PATCH] Set contact info for puppets on startup (#85) --- main.go | 1 + puppet.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/main.go b/main.go index fda2bee..d4ed0eb 100644 --- a/main.go +++ b/main.go @@ -102,6 +102,7 @@ func (br *DiscordBridge) Start() { if br.Config.Bridge.Provisioning.SharedSecret != "disable" { br.provisioning = newProvisioningAPI(br) } + go br.updatePuppetsContactInfo() go br.startUsers() } diff --git a/puppet.go b/puppet.go index 5d3404e..674313c 100644 --- a/puppet.go +++ b/puppet.go @@ -158,6 +158,18 @@ func (br *DiscordBridge) FormatPuppetMXID(did string) id.UserID { ) } +func (br *DiscordBridge) updatePuppetsContactInfo() { + if br.Config.Homeserver.Software != bridgeconfig.SoftwareHungry { + return + } + for _, puppet := range br.GetAllPuppets() { + if !puppet.ContactInfoSet && puppet.NameSet { + puppet.ResendContactInfo() + puppet.Update() + } + } +} + func (puppet *Puppet) GetDisplayname() string { return puppet.Name }