diff mod_groups_internal/mod_groups_internal.lua @ 4399:846b7af5588c

mod_groups_internal: send invite to new members of groups
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Jan 2021 17:28:26 +0100
parents e5792ca1d704
children 31470a256851
line wrap: on
line diff
--- a/mod_groups_internal/mod_groups_internal.lua	Tue Jan 26 17:18:44 2021 +0100
+++ b/mod_groups_internal/mod_groups_internal.lua	Tue Jan 26 17:28:26 2021 +0100
@@ -2,6 +2,7 @@
 local modulemanager = require"core.modulemanager";
 local id = require "util.id";
 local jid = require "util.jid";
+local st = require "util.stanza";
 local jid_join = jid.join;
 local host = module.host;
 
@@ -205,6 +206,13 @@
 		if room then
 			local user_jid = username .. "@" .. host;
 			room:set_affiliation(true, user_jid, "member")
+			module:send(st.message(
+				{ from = group_info.muc_jid, to = user_jid }
+			):tag("x", {
+				xmlns = "jabber:x:conference",
+				jid = group_info.muc_jid
+			}):up());
+			module:log("debug", "set user %s to be member in %s and sent invite", username, group_info.muc_jid)
 		else
 			module:log("warning", "failed to update affiliation for %s in %s", username, group_info.muc_jid)
 		end