Changeset

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 4398:a16b689525d7
children 4400:869df5a6b0c5
files mod_groups_internal/mod_groups_internal.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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