mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Create room on configuration request as per XEP-0045, 10.1.3
This commit is contained in:
parent
3803a8de3c
commit
f304149615
@ -488,9 +488,8 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
_ ->
|
_ ->
|
||||||
case mnesia:dirty_read(muc_online_room, {Room, Host}) of
|
case mnesia:dirty_read(muc_online_room, {Room, Host}) of
|
||||||
[] ->
|
[] ->
|
||||||
Type = fxml:get_attr_s(<<"type">>, Attrs),
|
case is_create_request(Packet) of
|
||||||
case {Name, Type} of
|
true ->
|
||||||
{<<"presence">>, <<"">>} ->
|
|
||||||
case check_user_can_create_room(ServerHost,
|
case check_user_can_create_room(ServerHost,
|
||||||
AccessCreate, From, Room) and
|
AccessCreate, From, Room) and
|
||||||
check_create_roomid(ServerHost, Room) of
|
check_create_roomid(ServerHost, Room) of
|
||||||
@ -508,7 +507,7 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
Packet, ?ERRT_FORBIDDEN(Lang, ErrText)),
|
Packet, ?ERRT_FORBIDDEN(Lang, ErrText)),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end;
|
end;
|
||||||
_ ->
|
false ->
|
||||||
Lang = fxml:get_attr_s(<<"xml:lang">>, Attrs),
|
Lang = fxml:get_attr_s(<<"xml:lang">>, Attrs),
|
||||||
ErrText = <<"Conference room does not exist">>,
|
ErrText = <<"Conference room does not exist">>,
|
||||||
Err = jlib:make_error_reply(Packet,
|
Err = jlib:make_error_reply(Packet,
|
||||||
@ -523,6 +522,22 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec is_create_request(xmlel()) -> boolean().
|
||||||
|
is_create_request(#xmlel{name = <<"presence">>} = Packet) ->
|
||||||
|
<<"">> == fxml:get_tag_attr_s(<<"type">>, Packet);
|
||||||
|
is_create_request(#xmlel{name = <<"iq">>} = Packet) ->
|
||||||
|
case jlib:iq_query_info(Packet) of
|
||||||
|
#iq{type = set, xmlns = ?NS_MUCSUB,
|
||||||
|
sub_el = #xmlel{name = <<"subscribe">>}} ->
|
||||||
|
true;
|
||||||
|
#iq{type = get, xmlns = ?NS_MUC_OWNER, sub_el = SubEl} ->
|
||||||
|
[] == fxml:remove_cdata(SubEl#xmlel.children);
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end;
|
||||||
|
is_create_request(_) ->
|
||||||
|
false.
|
||||||
|
|
||||||
check_user_can_create_room(ServerHost, AccessCreate,
|
check_user_can_create_room(ServerHost, AccessCreate,
|
||||||
From, _RoomID) ->
|
From, _RoomID) ->
|
||||||
case acl:match_rule(ServerHost, AccessCreate, From) of
|
case acl:match_rule(ServerHost, AccessCreate, From) of
|
||||||
|
Loading…
Reference in New Issue
Block a user