mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_muc/mod_muc.erl: Export function to create MUC
room (thanks to Eric Cestari) (EJAB-729) SVN Revision: 1878
This commit is contained in:
parent
b0e749eca5
commit
2bd54854ec
@ -1,5 +1,8 @@
|
|||||||
2009-02-16 Badlop <badlop@process-one.net>
|
2009-02-16 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]).
|
||||||
|
|
||||||
@ -102,6 +103,13 @@ room_destroyed(Host, Room, Pid, ServerHost) ->
|
|||||||
{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) ->
|
store_room(Host, Name, Opts) ->
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
mnesia:write(#muc_room{name_host = {Name, Host},
|
mnesia:write(#muc_room{name_host = {Name, Host},
|
||||||
@ -210,7 +218,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