25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-31 15:21:38 +01:00

Get rid of dreaded tuple_to_list(now())

This commit is contained in:
Evgeniy Khramtsov 2012-10-26 20:02:25 +10:00
parent 7d3d008940
commit a4e320c263
4 changed files with 5 additions and 10 deletions

View File

@ -43,7 +43,7 @@ mech_new(Host, _GetPassword, _CheckPassword, _CheckPasswordDigest) ->
{ok, #state{server = Host}}. {ok, #state{server = Host}}.
mech_step(#state{server = Server}, _ClientIn) -> mech_step(#state{server = Server}, _ClientIn) ->
User = iolist_to_binary([randoms:get_string() | tuple_to_list(now())]), User = randoms:get_string(),
case ejabberd_auth:is_user_exists(User, Server) of case ejabberd_auth:is_user_exists(User, Server) of
true -> {error, <<"not-authorized">>}; true -> {error, <<"not-authorized">>};
false -> {ok, [{username, User}, {auth_module, ejabberd_auth_anonymous}]} false -> {ok, [{username, User}, {auth_module, ejabberd_auth_anonymous}]}

View File

@ -1125,8 +1125,7 @@ resource_conflict_action(U, S, R) ->
acceptnew -> {accept_resource, R}; acceptnew -> {accept_resource, R};
closenew -> closenew; closenew -> closenew;
setresource -> setresource ->
Rnew = iolist_to_binary([randoms:get_string() Rnew = randoms:get_string(),
| tuple_to_list(now())]),
{accept_resource, Rnew} {accept_resource, Rnew}
end. end.
@ -1139,9 +1138,7 @@ wait_for_bind({xmlstreamelement, El}, StateData) ->
[{elem, <<"resource">>}, cdata]), [{elem, <<"resource">>}, cdata]),
R = case jlib:resourceprep(R1) of R = case jlib:resourceprep(R1) of
error -> error; error -> error;
<<"">> -> <<"">> -> randoms:get_string();
iolist_to_binary([randoms:get_string()
| tuple_to_list(now())]);
Resource -> Resource Resource -> Resource
end, end,
case R of case R of

View File

@ -1102,8 +1102,7 @@ start_shaper_timer(Timeout) ->
erlang:start_timer(Timeout, self(), shaper_timeout). erlang:start_timer(Timeout, self(), shaper_timeout).
make_random_jid(Host) -> make_random_jid(Host) ->
User = iolist_to_binary([randoms:get_string() User = randoms:get_string(),
| tuple_to_list(now())]),
jlib:make_jid(User, Host, randoms:get_string()). jlib:make_jid(User, Host, randoms:get_string()).
make_socket(Pid, IP) -> {http_bind, Pid, IP}. make_socket(Pid, IP) -> {http_bind, Pid, IP}.

View File

@ -1278,6 +1278,5 @@ get_session(SID) ->
end. end.
make_random_jid(Host) -> make_random_jid(Host) ->
User = iolist_to_binary([randoms:get_string() User = randoms:get_string(),
| tuple_to_list(now())]),
jlib:make_jid(User, Host, randoms:get_string()). jlib:make_jid(User, Host, randoms:get_string()).