aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-07-03 15:38:53 +0200
committerKim Alvefur <zash@zash.se>2014-07-03 15:38:53 +0200
commitf5517dad054cf489f74a8aaecb00dfa4054d1f24 (patch)
tree442e552f62e9a15c5e8d05683d90f4e60ce65494 /plugins
parent1b9e46bd01b196fe7b1a2ed99d367da24b9f6bf5 (diff)
downloadprosody-f5517dad054cf489f74a8aaecb00dfa4054d1f24.tar.gz
prosody-f5517dad054cf489f74a8aaecb00dfa4054d1f24.zip
mod_dialback: Keep the same dialback secret across module reloads
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_dialback.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index b32160c4..2959358b 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -19,7 +19,15 @@ local xmlns_stream = "http://etherx.jabber.org/streams";
local dialback_requests = setmetatable({}, { __mode = 'v' });
-local dialback_secret = module.host .. (module:get_option_string("dialback_secret") or uuid_gen());
+local dialback_secret = module.host .. module:get_option_string("dialback_secret", uuid_gen());
+
+function module.save()
+ return { dialback_secret = dialback_secret };
+end
+
+function module.restore(state)
+ dialback_secret = state.dialback_secret;
+end
function generate_dialback(id, to, from)
return sha256_hash(id..to..dialback_secret, true);