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
commit59ef50532cbedbf9ddd883f5817c09463eef5d12 (patch)
tree442e552f62e9a15c5e8d05683d90f4e60ce65494 /plugins
parent105ceb9cffa82a84a2f1df4cb0659772f6930526 (diff)
downloadprosody-59ef50532cbedbf9ddd883f5817c09463eef5d12.tar.gz
prosody-59ef50532cbedbf9ddd883f5817c09463eef5d12.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);