diff mod_easy_invite/mod_easy_invite.lua @ 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 e7eb46d976ae
children fe75cc43dfbf
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);