Changeset

4084:9d11c18d4d7e

mod_easy_invite: Allow setting account roles from associated invite (from Snikket)
author Matthew Wild <mwild1@gmail.com>
date Mon, 07 Sep 2020 12:52:16 +0100
parents 4083:e7eb46d976ae
children 4085:fe75cc43dfbf
files mod_easy_invite/mod_easy_invite.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_easy_invite/mod_easy_invite.lua	Mon Sep 07 12:51:20 2020 +0100
+++ b/mod_easy_invite/mod_easy_invite.lua	Mon Sep 07 12:52:16 2020 +0100
@@ -182,6 +182,14 @@
 		subscribe_both(module.host, inviter_username, contact_username);
 	end
 
+	if validated_invite.additional_data then
+		module:log("debug", "Importing roles from invite");
+		local roles = validated_invite.additional_data.roles;
+		if roles then
+			module:open_store("roles"):set(contact_username, roles);
+		end
+	end
+end);
 
 end);