Fix user_resources command, and ejabberd_xmlrpc parsing auth details in call

This commit is contained in:
Badlop 2014-03-31 16:51:47 +02:00
parent 5bf3c784da
commit 8b9c49440a
2 changed files with 7 additions and 3 deletions

View File

@ -800,7 +800,7 @@ commands() ->
tags = [session], tags = [session],
desc = "List user's connected resources", desc = "List user's connected resources",
module = ?MODULE, function = user_resources, module = ?MODULE, function = user_resources,
args = [{user, string}, {host, string}], args = [{user, binary}, {host, binary}],
result = {resources, {list, {resource, string}}}}]. result = {resources, {list, {resource, string}}}}].
-spec connected_users() -> [binary()]. -spec connected_users() -> [binary()].

View File

@ -345,14 +345,18 @@ build_fault_response(Code, ParseString, ParseArgs) ->
do_command(AccessCommands, Auth, Command, AttrL, ArgsF, do_command(AccessCommands, Auth, Command, AttrL, ArgsF,
ResultF) -> ResultF) ->
ArgsFormatted = format_args(AttrL, ArgsF), ArgsFormatted = format_args(AttrL, ArgsF),
{UserT, ServerT, PasswordT} = Auth, AuthBin = convert_auth(Auth),
AuthBin = {list_to_binary(UserT), list_to_binary(ServerT), list_to_binary(PasswordT)},
Result = Result =
ejabberd_commands:execute_command(AccessCommands, AuthBin, ejabberd_commands:execute_command(AccessCommands, AuthBin,
Command, ArgsFormatted), Command, ArgsFormatted),
ResultFormatted = format_result(Result, ResultF), ResultFormatted = format_result(Result, ResultF),
{command_result, ResultFormatted}. {command_result, ResultFormatted}.
convert_auth(noauth) ->
noauth;
convert_auth({UserT, ServerT, PasswordT}) ->
{list_to_binary(UserT), list_to_binary(ServerT), list_to_binary(PasswordT)}.
%%----------------------------- %%-----------------------------
%% Format arguments %% Format arguments
%%----------------------------- %%-----------------------------