summaryrefslogtreecommitdiff
path: root/src/mod_muc/mod_muc.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2009-04-22 12:05:10 +0000
committerBadlop <badlop@process-one.net>2009-04-22 12:05:10 +0000
commitb59ecb83e8df04316ad8656444f7ded0fd610fee (patch)
treed82c10f84c6e703d1c772af6aeefdbe7c557bb36 /src/mod_muc/mod_muc.erl
parent* src/cyrsasl.erl: Change API of check_password: pass a function (diff)
* src/mod_muc/mod_muc.erl: Limit number of characters in Room ID,
Name and Description (EJAB-899) * src/mod_muc/mod_muc_room.erl: Likewise * doc/guide.tex: Likewise * doc/guide.html: Likewise SVN Revision: 2034
Diffstat (limited to 'src/mod_muc/mod_muc.erl')
-rw-r--r--src/mod_muc/mod_muc.erl17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc/mod_muc.erl
index 6edbbdf8..2a7242fd 100644
--- a/src/mod_muc/mod_muc.erl
+++ b/src/mod_muc/mod_muc.erl
@@ -460,8 +460,10 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
Type = xml:get_attr_s("type", Attrs),
case {Name, Type} of
{"presence", ""} ->
- case acl:match_rule(ServerHost, AccessCreate, From) of
- allow ->
+ case check_user_can_create_room(ServerHost,
+ AccessCreate, From,
+ Room) of
+ true ->
?DEBUG("MUC: open new room '~s'~n", [Room]),
{ok, Pid} = mod_muc_room:start(
Host, ServerHost, Access,
@@ -471,7 +473,7 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
register_room(Host, Room, Pid),
mod_muc_room:route(Pid, From, Nick, Packet),
ok;
- _ ->
+ false ->
Lang = xml:get_attr_s("xml:lang", Attrs),
ErrText = "Room creation is denied by service policy",
Err = jlib:make_error_reply(
@@ -493,7 +495,14 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
end
end.
-
+check_user_can_create_room(ServerHost, AccessCreate, From, RoomID) ->
+ case acl:match_rule(ServerHost, AccessCreate, From) of
+ allow ->
+ (length(RoomID) =< gen_mod:get_module_opt(ServerHost, mod_muc,
+ max_room_id, infinite));
+ _ ->
+ false
+ end.
load_permanent_rooms(Host, ServerHost, Access, HistorySize, RoomShaper) ->