prosody: Add module to expose stable client id across sessions
This commit is contained in:
parent
deddef38f2
commit
83c757c786
|
@ -75,6 +75,7 @@ modules_enabled = {
|
||||||
"update_notify";
|
"update_notify";
|
||||||
"turncredentials";
|
"turncredentials";
|
||||||
"admin_shell";
|
"admin_shell";
|
||||||
|
"snikket_client_id";
|
||||||
|
|
||||||
-- Spam/abuse management
|
-- Spam/abuse management
|
||||||
"spam_reporting"; -- Allow users to report spam/abuse
|
"spam_reporting"; -- Allow users to report spam/abuse
|
||||||
|
|
|
@ -131,6 +131,7 @@
|
||||||
- mod_update_notify
|
- mod_update_notify
|
||||||
- mod_invites_default_group
|
- mod_invites_default_group
|
||||||
- mod_invites_bootstrap
|
- mod_invites_bootstrap
|
||||||
|
- mod_snikket_client_id
|
||||||
|
|
||||||
- name: "Install lua-ossl for encrypted push notifications"
|
- name: "Install lua-ossl for encrypted push notifications"
|
||||||
apt:
|
apt:
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- This module assigns a client_id to sessions if they are using a "Snikket.*"
|
||||||
|
-- resource identifier. We assume that a resource string in this format is
|
||||||
|
-- static for the same client instance across every session.
|
||||||
|
--
|
||||||
|
-- In the future it is anticipated that this "hack" will be replaced by SASL 2
|
||||||
|
-- (XEP-0388) and/or Bind 2 (XEP-0386), however this is not yet implemented in
|
||||||
|
-- Prosody or any clients.
|
||||||
|
|
||||||
|
module:hook("resource-bind", function (event)
|
||||||
|
local id = event.session.resource:match("^Snikket%..+$");
|
||||||
|
if not id then return; end
|
||||||
|
event.session.client_id = id;
|
||||||
|
end, 1000);
|
Loading…
Reference in New Issue