25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Applied VH patch

SVN Revision: 310
This commit is contained in:
Alexey Shchepin 2005-04-17 22:59:44 +00:00
parent e46b28f27f
commit 530c036984

View File

@ -70,36 +70,36 @@ process(Node, ["reopen-log"]) ->
?STATUS_SUCCESS ?STATUS_SUCCESS
end; end;
process(Node, ["register", User, Password]) -> process(Node, ["register", User, Server, Password]) ->
case rpc:call(Node, ejabberd_auth, try_register, [User, Password]) of case rpc:call(Node, ejabberd_auth, try_register, [User, Server, Password]) of
{atomic, ok} -> {atomic, ok} ->
?STATUS_SUCCESS; ?STATUS_SUCCESS;
{atomic, exists} -> {atomic, exists} ->
io:format("User ~p already registered on node ~p~n", io:format("User ~p already registered on node ~p~n",
[User, Node]), [User ++ "@" ++ Server, Node]),
?STATUS_ERROR; ?STATUS_ERROR;
{error, Reason} -> {error, Reason} ->
io:format("Can't register user ~p on node ~p: ~p~n", io:format("Can't register user ~p on node ~p: ~p~n",
[User, Node, Reason]), [User ++ "@" ++ Server, Node, Reason]),
?STATUS_ERROR; ?STATUS_ERROR;
{badrpc, Reason} -> {badrpc, Reason} ->
io:format("Can't register user ~p on node ~p: ~p~n", io:format("Can't register user ~p on node ~p: ~p~n",
[User, Node, Reason]), [User ++ "@" ++ Server, Node, Reason]),
?STATUS_BADRPC ?STATUS_BADRPC
end; end;
process(Node, ["unregister", User]) -> process(Node, ["unregister", User, Server]) ->
case rpc:call(Node, ejabberd_auth, remove_user, [User]) of case rpc:call(Node, ejabberd_auth, remove_user, [User, Server]) of
{atomic, ok} ->
?STATUS_SUCCESS;
{error, Reason} -> {error, Reason} ->
io:format("Can't unregister user ~p on node ~p: ~p~n", io:format("Can't unregister user ~p on node ~p: ~p~n",
[User, Node, Reason]), [User ++ "@" ++ Server, Node, Reason]),
?STATUS_ERROR; ?STATUS_ERROR;
{badrpc, Reason} -> {badrpc, Reason} ->
io:format("Can't unregister user ~p on node ~p: ~p~n", io:format("Can't unregister user ~p on node ~p: ~p~n",
[User, Node, Reason]), [User ++ "@" ++ Server, Node, Reason]),
?STATUS_BADRPC ?STATUS_BADRPC;
_ ->
?STATUS_SUCCESS
end; end;
process(Node, ["backup", Path]) -> process(Node, ["backup", Path]) ->
@ -178,7 +178,7 @@ process(Node, ["registered-users"]) ->
Users when is_list(Users) -> Users when is_list(Users) ->
NewLine = io_lib:format("~n", []), NewLine = io_lib:format("~n", []),
SUsers = lists:sort(Users), SUsers = lists:sort(Users),
FUsers = lists:map(fun(U) -> [U, NewLine] end, SUsers), FUsers = lists:map(fun({U, S}) -> [U, $@, S, NewLine] end, SUsers),
io:format("~s", [FUsers]), io:format("~s", [FUsers]),
?STATUS_SUCCESS; ?STATUS_SUCCESS;
{error, Reason} -> {error, Reason} ->
@ -216,8 +216,8 @@ print_usage() ->
" stop\t\t\t\tstop ejabberd~n" " stop\t\t\t\tstop ejabberd~n"
" restart\t\t\trestart ejabberd~n" " restart\t\t\trestart ejabberd~n"
" reopen-log\t\t\treopen log file~n" " reopen-log\t\t\treopen log file~n"
" register user password\tregister a user~n" " register user server password\tregister a user~n"
" unregister user\t\tunregister a user~n" " unregister user server\t\tunregister a user~n"
" backup file\t\t\tstore a database backup in file~n" " backup file\t\t\tstore a database backup in file~n"
" restore file\t\t\trestore a database backup from file~n" " restore file\t\t\trestore a database backup from file~n"
" install-fallback file\t\tinstall a database fallback from file~n" " install-fallback file\t\tinstall a database fallback from file~n"