mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Use more pattern-matching
This commit is contained in:
parent
a91ae03dc6
commit
f919349173
@ -3735,18 +3735,12 @@ is_voice_request({xmlelement, "x", _, _} = Elem) ->
|
|||||||
end;
|
end;
|
||||||
is_voice_request(Els) ->
|
is_voice_request(Els) ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(X, Acc) ->
|
fun(_, true) ->
|
||||||
case Acc of
|
true;
|
||||||
false ->
|
({xmlelement, "x", _, _} = X, false) ->
|
||||||
case X of
|
|
||||||
{xmlelement, "x", _, _} ->
|
|
||||||
is_voice_request(X);
|
is_voice_request(X);
|
||||||
_ ->
|
(_, _) ->
|
||||||
false
|
false
|
||||||
end;
|
|
||||||
true ->
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end, false, Els).
|
end, false, Els).
|
||||||
|
|
||||||
check_voice_request_fields(_, false) ->
|
check_voice_request_fields(_, false) ->
|
||||||
@ -3805,18 +3799,12 @@ is_voice_approvement({xmlelement, "x", _, _} = Elem) ->
|
|||||||
end;
|
end;
|
||||||
is_voice_approvement(Els) ->
|
is_voice_approvement(Els) ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(X, Acc) ->
|
fun(_, true) ->
|
||||||
case Acc of
|
true;
|
||||||
false ->
|
({xmlelement, "x", _, _} = X, false) ->
|
||||||
case X of
|
|
||||||
{xmlelement, "x", _, _} ->
|
|
||||||
is_voice_approvement(X);
|
is_voice_approvement(X);
|
||||||
_ ->
|
(_, _) ->
|
||||||
false
|
false
|
||||||
end;
|
|
||||||
true ->
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end, false, Els).
|
end, false, Els).
|
||||||
|
|
||||||
check_voice_approvement_fields(_, false) ->
|
check_voice_approvement_fields(_, false) ->
|
||||||
@ -3836,7 +3824,7 @@ check_voice_approvement_fields({"muc#request_allow", "1"}, true) ->
|
|||||||
check_voice_approvement_fields({"muc#request_allow", _}, _) ->
|
check_voice_approvement_fields({"muc#request_allow", _}, _) ->
|
||||||
false;
|
false;
|
||||||
check_voice_approvement_fields(_, true) ->
|
check_voice_approvement_fields(_, true) ->
|
||||||
true; % do not check any other fields
|
true. % do not check any other fields
|
||||||
|
|
||||||
extract_jid_from_voice_approvement(Els) ->
|
extract_jid_from_voice_approvement(Els) ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
|
Loading…
Reference in New Issue
Block a user