25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Don't require a full JID as argument, instead set a dummy resource (#2710)

This commit is contained in:
Badlop 2018-12-10 21:06:26 +01:00
parent f2bd2f6e37
commit 446ff9257c

View File

@ -263,9 +263,9 @@ get_commands_spec() ->
#ejabberd_commands{name = subscribe_room, tags = [muc_room],
desc = "Subscribe to a MUC conference",
module = ?MODULE, function = subscribe_room,
args_desc = ["Full JID, including some resource", "a user's nick",
args_desc = ["User JID", "a user's nick",
"the room to subscribe", "nodes separated by commas: ,"],
args_example = ["tom@localhost/dummy", "Tom", "room1@conference.localhost",
args_example = ["tom@localhost", "Tom", "room1@conference.localhost",
"urn:xmpp:mucsub:nodes:messages,urn:xmpp:mucsub:nodes:affiliations"],
result_desc = "The list of nodes that has subscribed",
result_example = ["urn:xmpp:mucsub:nodes:messages",
@ -1104,9 +1104,8 @@ subscribe_room(User, Nick, Room, Nodes) ->
try jid:decode(Room) of
#jid{luser = Name, lserver = Host} when Name /= <<"">> ->
try jid:decode(User) of
#jid{lresource = <<"">>} ->
throw({error, "User's JID should have a resource"});
UserJID ->
UserJID1 ->
UserJID = jid:replace_resource(UserJID1, <<"modmucadmin">>),
case get_room_pid(Name, Host) of
Pid when is_pid(Pid) ->
case p1_fsm:sync_send_all_state_event(