mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-16 22:05:29 +02:00
More correct dispatching of normal messages to conference room
is_invitation/1 function returns true if <x> element of message is an invitation
This commit is contained in:
parent
c4f9a050c9
commit
2a41ca0628
|
@ -256,6 +256,9 @@ normal_state({route, From, "",
|
||||||
From, Err),
|
From, Err),
|
||||||
{next_state, normal_state, StateData};
|
{next_state, normal_state, StateData};
|
||||||
Type when (Type == "") or (Type == "normal") ->
|
Type when (Type == "") or (Type == "normal") ->
|
||||||
|
IsInvitation = is_invitation(Els),
|
||||||
|
if
|
||||||
|
IsInvitation ->
|
||||||
case catch check_invitation(From, Els, Lang, StateData) of
|
case catch check_invitation(From, Els, Lang, StateData) of
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
|
@ -292,6 +295,9 @@ normal_state({route, From, "",
|
||||||
{next_state, normal_state, StateData}
|
{next_state, normal_state, StateData}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
true ->
|
||||||
|
{next_state, normal_state, StateData}
|
||||||
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
ErrText = "Improper message type",
|
ErrText = "Improper message type",
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
|
@ -3623,6 +3629,24 @@ get_mucroom_disco_items(StateData) ->
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% Invitation support
|
% Invitation support
|
||||||
|
|
||||||
|
is_invitation(Els) ->
|
||||||
|
case xml:remove_cdata(Els) of
|
||||||
|
[{xmlelement, "x", _Attrs1, Els1} = XEl] ->
|
||||||
|
case xml:get_tag_attr_s("xmlns", XEl) of
|
||||||
|
?NS_MUC_USER ->
|
||||||
|
case xml:remove_cdata(Els1) of
|
||||||
|
[{xmlelement, "invite", _, _}] ->
|
||||||
|
true;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
check_invitation(From, Els, Lang, StateData) ->
|
check_invitation(From, Els, Lang, StateData) ->
|
||||||
FAffiliation = get_affiliation(From, StateData),
|
FAffiliation = get_affiliation(From, StateData),
|
||||||
CanInvite = (StateData#state.config)#config.allow_user_invites
|
CanInvite = (StateData#state.config)#config.allow_user_invites
|
||||||
|
|
Loading…
Reference in New Issue
Block a user