]> granicus.if.org Git - ejabberd/commitdiff
Allow a room admin also to subscribe another JID
authorBadlop <badlop@process-one.net>
Tue, 25 Apr 2017 23:30:12 +0000 (01:30 +0200)
committerBadlop <badlop@process-one.net>
Tue, 25 Apr 2017 23:30:12 +0000 (01:30 +0200)
rebar.config
src/mod_muc_room.erl

index 71eebf6a97612abc8af17b3557c79e49f81f0f48..8b1454de998109106c45ad5d9e7d6b0bbbf68773 100644 (file)
@@ -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"}}},
index f93828962a064ffa40b3f57d2a661f4a58f8363c..ca5b12925c5c5776fd574215a7e9de18e637f54f 100644 (file)
@@ -3711,6 +3711,21 @@ process_iq_mucsub(_From, #iq{type = set, lang = Lang,
                             sub_els = [#muc_subscribe{}]},
                  #state{just_created = false, config = #config{allow_subscription = false}}) ->
     {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,
@@ -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 ->