aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2017-04-26 01:30:12 +0200
committerBadlop <badlop@process-one.net>2017-04-26 01:30:12 +0200
commitc0eb85ce539a43ec7bf7114490bd68be780d4132 (patch)
tree991ff63ff2d0f9ffa6b8927430c76a9ba3797b26
parentmod_stream_mgmt: Fix typo in variable name (diff)
Allow a room admin also to subscribe another JID
-rw-r--r--rebar.config2
-rw-r--r--src/mod_muc_room.erl17
2 files changed, 17 insertions, 2 deletions
diff --git a/rebar.config b/rebar.config
index 71eebf6a9..8b1454de9 100644
--- a/rebar.config
+++ b/rebar.config
@@ -24,7 +24,7 @@
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.11"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.8"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
- {xmpp, ".*", {git, "https://github.com/processone/xmpp", "806ac5e4ebfbcf1f8f5ebe5a8458ebb7e250d501"}},
+ {xmpp, ".*", {git, "https://github.com/processone/xmpp", "e8dbfec277e7eb27b8130b13873b969cc346fafc"}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.10"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.11"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.9"}}},
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index f93828962..ca5b12925 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -3713,6 +3713,21 @@ process_iq_mucsub(_From, #iq{type = set, lang = Lang,
{error, xmpp:err_not_allowed(<<"Subscriptions are not allowed">>, Lang)};
process_iq_mucsub(From,
#iq{type = set, lang = Lang,
+ sub_els = [#muc_subscribe{jid = #jid{} = SubJid} = Mucsub]},
+ StateData) ->
+ FAffiliation = get_affiliation(From, StateData),
+ FRole = get_role(From, StateData),
+ if FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
+ process_iq_mucsub(SubJid,
+ #iq{type = set, lang = Lang,
+ sub_els = [Mucsub#muc_subscribe{jid = undefined}]},
+ StateData);
+ true ->
+ Txt = <<"Moderator privileges required">>,
+ {error, xmpp:err_forbidden(Txt, Lang)}
+ end;
+process_iq_mucsub(From,
+ #iq{type = set, lang = Lang,
sub_els = [#muc_subscribe{nick = Nick}]} = Packet,
StateData) ->
LBareJID = jid:tolower(jid:remove_resource(From)),
@@ -3748,7 +3763,7 @@ process_iq_mucsub(From, #iq{type = set, lang = Lang,
FRole = get_role(From, StateData),
if FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
process_iq_mucsub(UnsubJid,
- #iq{type = set,
+ #iq{type = set, lang = Lang,
sub_els = [#muc_unsubscribe{jid = undefined}]},
StateData);
true ->