summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2015-08-12 13:26:24 +0200
committerBadlop <badlop@process-one.net>2015-08-12 13:26:24 +0200
commit8c9c556f1f4851535366ea1f20ae7c7dcc1e3fab (patch)
tree76ef1fd57b699de4bc22d89a4f8faf09b68c38f5
parentRoom response to disco#info node muc#traffic should be an error (EJAB-741) (diff)
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
-rw-r--r--src/mod_muc_admin.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl
index 6aa3482d..7d044434 100644
--- a/src/mod_muc_admin.erl
+++ b/src/mod_muc_admin.erl
@@ -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)