Changed API of some mod_muc_admin command arguments

With this commit, arguments change in two commands:
* destroy_room: does not require Host argument
* send_direct_invitation: instead of Room, now requires Name and Service
This commit is contained in:
Badlop 2015-08-12 13:26:24 +02:00
parent ab0f488dda
commit 8c9c556f1f
1 changed files with 10 additions and 10 deletions

View File

@ -12,11 +12,11 @@
-behaviour(gen_mod).
-export([start/2, stop/1, muc_online_rooms/1,
muc_unregister_nick/1, create_room/3, destroy_room/3,
muc_unregister_nick/1, create_room/3, destroy_room/2,
create_rooms_file/1, destroy_rooms_file/1,
rooms_unused_list/2, rooms_unused_destroy/2,
get_user_rooms/2, get_room_occupants/2,
get_room_occupants_number/2, send_direct_invitation/4,
get_room_occupants_number/2, send_direct_invitation/5,
change_room_option/4, get_room_options/2,
set_room_affiliation/4, get_room_affiliations/2,
web_menu_main/2, web_page_main/2, web_menu_host/3,
@ -77,8 +77,7 @@ commands() ->
#ejabberd_commands{name = destroy_room, tags = [muc_room],
desc = "Destroy a MUC room",
module = ?MODULE, function = destroy_room,
args = [{name, binary}, {service, binary},
{host, binary}],
args = [{name, binary}, {service, binary}],
result = {res, rescode}},
#ejabberd_commands{name = create_rooms_file, tags = [muc],
desc = "Create the rooms indicated in file",
@ -129,7 +128,7 @@ commands() ->
desc = "Send a direct invitation to several destinations",
longdesc = "Password and Message can also be: none. Users JIDs are separated with : ",
module = ?MODULE, function = send_direct_invitation,
args = [{room, binary}, {password, binary}, {reason, binary}, {users, binary}],
args = [{name, binary}, {service, binary}, {password, binary}, {reason, binary}, {users, binary}],
result = {res, rescode}},
#ejabberd_commands{name = change_room_option, tags = [muc_room],
@ -444,12 +443,12 @@ muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
io:format("Creating room ~s@~s~n", [Name, Host]),
mod_muc:store_room(ServerHost, Host, Name, DefRoomOpts).
%% @spec (Name::binary(), Host::binary(), ServerHost::binary()) ->
%% @spec (Name::binary(), Host::binary()) ->
%% ok | {error, room_not_exists}
%% @doc Destroy the room immediately.
%% If the room has participants, they are not notified that the room was destroyed;
%% they will notice when they try to chat and receive an error that the room doesn't exist.
destroy_room(Name, Service, _Server) ->
destroy_room(Name, Service) ->
case mnesia:dirty_read(muc_online_room, {Name, Service}) of
[R] ->
Pid = R#muc_online_room.pid,
@ -461,7 +460,7 @@ destroy_room(Name, Service, _Server) ->
destroy_room({N, H, SH}) ->
io:format("Destroying room: ~s@~s - vhost: ~s~n", [N, H, SH]),
destroy_room(N, H, SH).
destroy_room(N, H).
%%----------------------------
@ -689,8 +688,9 @@ get_room_occupants_number(Room, Host) ->
%%----------------------------
%% http://xmpp.org/extensions/xep-0249.html
send_direct_invitation(RoomString, Password, Reason, UsersString) ->
RoomJid = jlib:string_to_jid(RoomString),
send_direct_invitation(RoomName, RoomService, Password, Reason, UsersString) ->
RoomJid = jlib:make_jid(RoomName, RoomService, <<"">>),
RoomString = jlib:jid_to_string(RoomJid),
XmlEl = build_invitation(Password, Reason, RoomString),
UsersStrings = get_users_to_invite(RoomJid, binary_to_list(UsersString)),
[send_direct_invitation(RoomJid, jlib:string_to_jid(list_to_binary(UserStrings)), XmlEl)