Annotate

mod_groups_internal/mod_groups_internal.lua @ 4389:6cfa313cd524

mod_groups_internal: manage associated MUC Manage deletion and affiliations accordingly.
author Jonas Schäfer <jonas@wielicki.name>
date Mon, 25 Jan 2021 21:51:26 +0100
parent 4388:7de3c955cfe2
child 4392:e5792ca1d704
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local rostermanager = require"core.rostermanager";
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
2 local modulemanager = require"core.modulemanager";
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local id = require "util.id";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 local jid = require "util.jid";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local jid_join = jid.join;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 local host = module.host;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local group_info_store = module:open_store("group_info");
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 local group_members_store = module:open_store("groups");
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 local group_memberships = module:open_store("groups", "map");
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
12 local muc_host_name = module:get_option("groups_muc_host", "chats."..host);
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
13 local muc_host = nil;
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
14
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 local is_contact_subscribed = rostermanager.is_contact_subscribed;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 -- Make a *one-way* subscription. User will see when contact is online,
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 -- contact will not see when user is online.
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 local function subscribe(user, user_jid, contact, contact_jid)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 -- Update user's roster to say subscription request is pending...
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 rostermanager.set_contact_pending_out(user, host, contact_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 -- Update contact's roster to say subscription request is pending...
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 rostermanager.set_contact_pending_in(contact, host, user_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 -- Update contact's roster to say subscription request approved...
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 rostermanager.subscribed(contact, host, user_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 -- Update user's roster to say subscription request approved...
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 rostermanager.process_inbound_subscription_approval(user, host, contact_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29 -- Push updates to both rosters
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 rostermanager.roster_push(user, host, contact_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 rostermanager.roster_push(contact, host, user_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 local function user_groups(username)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 return pairs(group_memberships:get_all(username) or {});
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 local function do_single_group_subscriptions(username, group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 local members = group_members_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 if not members then return; end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 local user_jid = jid_join(username, host);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 for membername in pairs(members) do
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43 if membername ~= username then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 local member_jid = jid_join(membername, host);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
45 if not is_contact_subscribed(username, host, member_jid) then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46 module:log("debug", "[group %s] Subscribing %s to %s", member_jid, user_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 subscribe(membername, member_jid, username, user_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
48 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
49 if not is_contact_subscribed(membername, host, user_jid) then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 module:log("debug", "[group %s] Subscribing %s to %s", user_jid, member_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
51 subscribe(username, user_jid, membername, member_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
53 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
54 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
55 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
56
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
57 local function do_all_group_subscriptions_by_user(username)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
58 for group_id in user_groups(username) do
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59 do_single_group_subscriptions(username, group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
61 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
62
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 local function do_all_group_subscriptions_by_group(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64 for membername in pairs(get_members(group_id)) do
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
65 do_single_group_subscriptions(membername, group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
66 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 module:hook("resource-bind", function(event)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
70 module:log("debug", "Updating group subscriptions...");
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
71 do_all_group_subscriptions_by_user(event.session.username);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
72 end);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
73
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
74 local function get_group_muc(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
75 -- Group MUC
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
76 local group_info = group_info_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
77 if group_info and group_info.muc_jid then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
78 local muc_jid = group_info.muc_jid;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
79 local mod_muc = hosts[jid.host(muc_jid)].modules.muc;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
80 if mod_muc then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
81 local room = mod_muc.get_room_from_jid(muc_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
82 if not room then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
83 room = mod_muc.create_room(muc_jid);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
84 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
85 return room;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
86 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
87 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
88 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
89
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
90 --luacheck: ignore 131
4385
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
91 function create(group_info, create_muc, group_id)
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
92 if not group_info.name then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
93 return nil, "group-name-required";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
94 end
4385
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
95 if group_id then
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
96 if exists(group_id) then
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
97 return nil, "conflict"
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
98 end
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
99 else
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
100 group_id = id.short();
dfb34cc97028 mod_groups_internal: allow specifying a group_id on create
Jonas Schäfer <jonas@wielicki.name>
parents: 4383
diff changeset
101 end
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
102
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
103 local muc_jid = nil
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
104 local room = nil
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
105 if create_muc then
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
106 if not muc_host_name then
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
107 module:log("error", "cannot create group with MUC: no MUC host configured")
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
108 return nil, "service-unavailable"
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
109 end
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
110 if not muc_host then
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
111 module:log("error", "cannot create group with MUC: MUC host %s not configured properly", muc_host_name)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
112 return nil, "internal-server-error"
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
113 end
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
114
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
115 muc_jid = id.short() .. "@" .. muc_host_name
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
116 room = muc_host.create_room(muc_jid)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
117 if not room then
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
118 delete_group(group_id)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
119 return nil, "internal-server-error"
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
120 end
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
121 room:set_public(false)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
122 room:set_persistent(true)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
123 room:set_members_only(true)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
124 room:set_allow_member_invites(false)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
125 room:set_moderated(false)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
126 room:set_whois("anyone")
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
127 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
128
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
129 local ok = group_info_store:set(group_id, {
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
130 name = group_info.name;
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
131 muc_jid = muc_jid;
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
132 });
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
133 if not ok then
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
134 if room then
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
135 muc_host:delete_room(room)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
136 end
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
137 return nil, "internal-server-error";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
138 end
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
139
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
140 return group_id;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
141 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
142
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
143 function get_info(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
144 return group_info_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
145 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
146
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
147 function set_info(group_id, info)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
148 if not info then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
149 return nil, "bad-request"
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
150 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
151
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
152 if not info.name or #info.name == 0 then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
153 return nil, "bad-request"
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
154 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
155
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
156 local ok = group_info_store:set(group_id, info);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
157 if not ok then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
158 return nil, "internal-server-error";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
159 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
160 return true
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
161 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
162
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
163 function get_members(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
164 return group_members_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
165 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
166
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
167 function exists(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
168 return not not get_info(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
169 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
170
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
171 function get_user_groups(username)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
172 local groups = {};
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
173 do
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
174 local group_set = group_memberships:get_all(username);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
175 if group_set then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
176 for group_id in pairs(group_set) do
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
177 table.insert(groups, group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
178 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
179 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
180 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
181 return groups;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
182 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
183
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
184 function delete(group_id)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
185 if group_members_store:set(group_id, nil) then
4389
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
186 info = get_info(group_id)
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
187 if info and info.muc_jid then
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
188 muc_host.delete_room(muc_host.get_room_from_jid(info.muc_jid))
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
189 end
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
190 return group_info_store:set(group_id, nil);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
191 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
192 return nil, "internal-server-error";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
193 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
194
4386
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
195 function add_member(group_id, username, delay_update)
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
196 local group_info = group_info_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
197 if not group_info then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
198 return nil, "group-not-found";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
199 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
200 if not group_memberships:set(group_id, username, {}) then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
201 return nil, "internal-server-error";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
202 end
4389
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
203 if group_info.muc_jid then
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
204 local room = muc_host.get_room_from_jid(group_info.muc_jid);
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
205 if room then
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
206 local user_jid = username .. "@" .. host;
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
207 room:set_affiliation(true, user_jid, "member")
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
208 else
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
209 module:log("warning", "failed to update affiliation for %s in %s", username, group_info.muc_jid)
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
210 end
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
211 end
4386
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
212 if not delay_update then
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
213 do_all_group_subscriptions_by_group(group_id);
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
214 end
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
215 return true;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
216 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
217
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
218 function remove_member(group_id, username)
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
219 local group_info = group_info_store:get(group_id);
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
220 if not group_info then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
221 return nil, "group-not-found";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
222 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
223 if not group_memberships:set(group_id, username, nil) then
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
224 return nil, "internal-server-error";
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
225 end
4389
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
226 if group_info.muc_jid then
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
227 local room = muc_host.get_room_from_jid(group_info.muc_jid);
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
228 if room then
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
229 local user_jid = username .. "@" .. host;
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
230 room:set_affiliation(true, user_jid, nil)
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
231 else
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
232 module:log("warning", "failed to update affiliation for %s in %s", username, group_info.muc_jid)
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
233 end
6cfa313cd524 mod_groups_internal: manage associated MUC
Jonas Schäfer <jonas@wielicki.name>
parents: 4388
diff changeset
234 end
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
235 return true;
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
236 end
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
237
4386
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
238 function sync(group_id)
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
239 do_all_group_subscriptions_by_group(group_id)
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
240 end
6357ac65b4eb mod_groups_internal: allow delay of roster sync on group change
Jonas Schäfer <jonas@wielicki.name>
parents: 4385
diff changeset
241
4383
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
242 -- Returns iterator over group ids
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
243 function groups()
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
244 return group_info_store:users();
1e7406b85add mod_groups_internal: new module for grouping beyond mod_adhoc_groups
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
245 end
4388
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
246
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
247 local function handle_server_started()
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
248 local target_module = modulemanager.get_module(muc_host_name, "muc")
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
249 if not target_module then
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
250 module:log("error", "host %s is not a MUC host -- group management will not work correctly", muc_host_name)
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
251 else
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
252 module:log("debug", "found MUC host")
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
253 muc_host = target_module;
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
254 end
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
255 end
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
256
7de3c955cfe2 mod_groups_internal: allow creating MUCs if a MUC host is linked
Jonas Schäfer <jonas@wielicki.name>
parents: 4386
diff changeset
257 module:hook_global("server-started", handle_server_started)