25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-09 15:06:54 +02:00

Return Registered element when account exists (thanks to PioneerMike)

This commit is contained in:
Badlop 2010-07-28 19:32:42 +02:00
parent c8df607173
commit 5113d28bb4

View File

@ -187,6 +187,18 @@ process_iq(From, To,
sub_el = [SubEl, ?ERR_BAD_REQUEST]}
end;
get ->
{UsernameSubels, QuerySubels} =
case From of
#jid{user = User, lserver = Server} ->
case ejabberd_auth:is_user_exists(User,Server) of
true ->
{[{xmlcdata, User}], [{xmlelement, "registered", [], []}]};
false ->
{[{xmlcdata, User}], []}
end;
_ ->
{[], []}
end,
IQ#iq{type = result,
sub_el = [{xmlelement,
"query",
@ -197,8 +209,9 @@ process_iq(From, To,
Lang,
"Choose a username and password "
"to register with this server")}]},
{xmlelement, "username", [], []},
{xmlelement, "password", [], []}]}]}
{xmlelement, "username", [], UsernameSubels},
{xmlelement, "password", [], []}
| QuerySubels]}]}
end.
%% @doc Try to change password and return IQ response