Mercurial > prosody-modules
changeset 6339:972ec5f0acc0
mod_voipms_carddav: Fix sync internal not working; default to 5 minutes
| author | Chaz Kettleson <chaz@pyr3x.com> |
|---|---|
| date | Sun, 12 Oct 2025 15:51:03 -0400 |
| parents | 1691e2054766 |
| children | a1d883aa64f6 |
| files | mod_voipms_carddav/mod_voipms_carddav.lua |
| diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_voipms_carddav/mod_voipms_carddav.lua Sat Oct 11 09:52:31 2025 -0400 +++ b/mod_voipms_carddav/mod_voipms_carddav.lua Sun Oct 12 15:51:03 2025 -0400 @@ -4,7 +4,7 @@ local carddav_domain = module:get_option("voipms_carddav_domain") or module.host local carddav_contact_format = module:get_option("voipms_carddav_contact_format") or "[%alias] %name (%type)" local carddav_jid_map = module:get_option("voipms_carddav_jid_map") or {} -local carddav_sync_interval = module:get_option_number("voipms_carddav_sync_interval") or 86400 +local carddav_sync_interval = module:get_option_number("voipms_carddav_sync_interval") or 300 local contact_cache = {} for jid, config in pairs(carddav_jid_map) do @@ -90,6 +90,8 @@ end local function sync_carddav_contacts() + module:add_timer(carddav_sync_interval, sync_carddav_contacts) + for jid, config in pairs(carddav_jid_map) do local carddav = config.carddav local auth = "Basic " .. mime.b64(carddav.username .. ":" .. carddav.password) @@ -122,9 +124,8 @@ end end -sync_carddav_contacts() module:log("debug", "Scheduling contact sync every %d seconds", carddav_sync_interval) -module:add_timer(carddav_sync_interval, sync_carddav_contacts) +module:add_timer(0, sync_carddav_contacts) module:hook("roster-load", function(event) local jid = event.username .. "@" .. event.host
