]> granicus.if.org Git - ejabberd/commitdiff
Use #jid{} type for #muc_unsubscribe.jid
authorHolger Weiss <holger@zedat.fu-berlin.de>
Wed, 19 Apr 2017 20:18:23 +0000 (22:18 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Wed, 19 Apr 2017 20:18:23 +0000 (22:18 +0200)
rebar.config
src/mod_muc_room.erl

index 05d5d29a21e5349b1c576ed0d4f27676e712527d..181ce3ba4c14a552fe26b7d6f1a6d784a6692843 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", "ad15e74e073a9cd230f31f657b395b1873227875"}},
+        {xmpp, ".*", {git, "https://github.com/processone/xmpp", "806ac5e4ebfbcf1f8f5ebe5a8458ebb7e250d501"}},
         {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 6869de6dace341c17b60e81ab948123b8dbbdb93..f93828962a064ffa40b3f57d2a661f4a58f8363c 100644 (file)
@@ -3742,20 +3742,18 @@ process_iq_mucsub(From,
            add_new_user(From, Nick, Packet, SD2)
     end;
 process_iq_mucsub(From, #iq{type = set, lang = Lang,
-                           sub_els = [#muc_unsubscribe{jid = UnsubJid}]},
-                 StateData) when UnsubJid /= <<>> ->
+                           sub_els = [#muc_unsubscribe{jid = #jid{} = UnsubJid}]},
+                 StateData) ->
     FAffiliation = get_affiliation(From, StateData),
     FRole = get_role(From, StateData),
-    try jid:decode(UnsubJid) of
-       FromUnsub when FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
-           process_iq_mucsub(FromUnsub, #iq{type = set, sub_els = [#muc_unsubscribe{jid = <<>>}]},
-                         StateData);
-       _ ->
+    if FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
+           process_iq_mucsub(UnsubJid,
+                             #iq{type = set,
+                                 sub_els = [#muc_unsubscribe{jid = undefined}]},
+                             StateData);
+       true ->
            Txt = <<"Moderator privileges required">>,
            {error, xmpp:err_forbidden(Txt, Lang)}
-    catch
-       error:{bad_jid,_} ->
-           {error, xmpp:err_jid_malformed()}
     end;
 process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]},
                  StateData) ->