25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01: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]} sub_el = [SubEl, ?ERR_BAD_REQUEST]}
end; end;
get -> 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, IQ#iq{type = result,
sub_el = [{xmlelement, sub_el = [{xmlelement,
"query", "query",
@ -197,8 +209,9 @@ process_iq(From, To,
Lang, Lang,
"Choose a username and password " "Choose a username and password "
"to register with this server")}]}, "to register with this server")}]},
{xmlelement, "username", [], []}, {xmlelement, "username", [], UsernameSubels},
{xmlelement, "password", [], []}]}]} {xmlelement, "password", [], []}
| QuerySubels]}]}
end. end.
%% @doc Try to change password and return IQ response %% @doc Try to change password and return IQ response