mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Merge 1878 from trunk.
* src/mod_muc/mod_muc.erl: Export function to create MUC room (thanks to Eric Cestari) (EJAB-729) SVN Revision: 1944
This commit is contained in:
parent
23ec55975e
commit
f0c0b2230a
@ -1,5 +1,8 @@
|
|||||||
2009-03-03 Badlop <badlop@process-one.net>
|
2009-03-03 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/mod_muc/mod_muc.erl: Export function to create MUC
|
||||||
|
room (thanks to Eric Cestari) (EJAB-729)
|
||||||
|
|
||||||
* src/mod_roster.erl: When account is deleted, cancel presence
|
* src/mod_roster.erl: When account is deleted, cancel presence
|
||||||
subscription for all roster items (EJAB-790)
|
subscription for all roster items (EJAB-790)
|
||||||
* src/mod_roster_odbc.erl: Likewise
|
* src/mod_roster_odbc.erl: Likewise
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
store_room/3,
|
store_room/3,
|
||||||
restore_room/2,
|
restore_room/2,
|
||||||
forget_room/2,
|
forget_room/2,
|
||||||
|
create_room/5,
|
||||||
process_iq_disco_items/4,
|
process_iq_disco_items/4,
|
||||||
can_use_nick/3]).
|
can_use_nick/3]).
|
||||||
|
|
||||||
@ -105,6 +106,13 @@ room_destroyed(Host, Room, Pid, ServerHost) when is_binary(Host),
|
|||||||
{room_destroyed, {Room, Host}, Pid},
|
{room_destroyed, {Room, Host}, Pid},
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
%% @doc Create a room.
|
||||||
|
%% If Opts = default, the default room options are used.
|
||||||
|
%% Else use the passed options as defined in mod_muc_room.
|
||||||
|
create_room(Host, Name, From, Nick, Opts) ->
|
||||||
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
|
gen_server:call(Proc, {create, Name, From, Nick, Opts}).
|
||||||
|
|
||||||
store_room(Host, Name, Opts) when is_binary(Host), is_binary(Name) ->
|
store_room(Host, Name, Opts) when is_binary(Host), is_binary(Name) ->
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
mnesia:write(#muc_room{name_host = {Name, Host},
|
mnesia:write(#muc_room{name_host = {Name, Host},
|
||||||
@ -212,7 +220,28 @@ init([Host, Opts]) ->
|
|||||||
%% Description: Handling call messages
|
%% Description: Handling call messages
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
handle_call(stop, _From, State) ->
|
handle_call(stop, _From, State) ->
|
||||||
{stop, normal, ok, State}.
|
{stop, normal, ok, State};
|
||||||
|
|
||||||
|
handle_call({create, Room, From, Nick, Opts},
|
||||||
|
_From,
|
||||||
|
#state{host = Host,
|
||||||
|
server_host = ServerHost,
|
||||||
|
access = Access,
|
||||||
|
default_room_opts = DefOpts,
|
||||||
|
history_size = HistorySize,
|
||||||
|
room_shaper = RoomShaper} = State) ->
|
||||||
|
?DEBUG("MUC: create new room '~s'~n", [Room]),
|
||||||
|
NewOpts = case Opts of
|
||||||
|
default -> DefOpts;
|
||||||
|
_ -> Opts
|
||||||
|
end,
|
||||||
|
{ok, Pid} = mod_muc_room:start(
|
||||||
|
Host, ServerHost, Access,
|
||||||
|
Room, HistorySize,
|
||||||
|
RoomShaper, From,
|
||||||
|
Nick, NewOpts),
|
||||||
|
register_room(Host, Room, Pid),
|
||||||
|
{reply, ok, State}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Function: handle_cast(Msg, State) -> {noreply, State} |
|
%% Function: handle_cast(Msg, State) -> {noreply, State} |
|
||||||
|
Loading…
Reference in New Issue
Block a user