24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

Don't use deprecated functions from jlib.erl

This commit is contained in:
Evgeniy Khramtsov 2016-11-23 10:41:26 +03:00
parent ee8cc1dac2
commit 6f2f1e87c9
4 changed files with 9 additions and 9 deletions

View File

@ -966,7 +966,7 @@ attrs_to_body_attrs(Attrs) ->
[], Attrs). [], Attrs).
to_int(S, Min) -> to_int(S, Min) ->
case jlib:binary_to_integer(S) of case binary_to_integer(S) of
I when I >= Min -> I; I when I >= Min -> I;
_ -> erlang:error(badarg) _ -> erlang:error(badarg)
end. end.

View File

@ -217,7 +217,7 @@ import_start(LServer, DBType) ->
import(LServer, {sql, _}, DBType, <<"last">>, [LUser, TimeStamp, State]) -> import(LServer, {sql, _}, DBType, <<"last">>, [LUser, TimeStamp, State]) ->
TS = case TimeStamp of TS = case TimeStamp of
<<"">> -> 0; <<"">> -> 0;
_ -> jlib:binary_to_integer(TimeStamp) _ -> binary_to_integer(TimeStamp)
end, end,
LA = #last_activity{us = {LUser, LServer}, LA = #last_activity{us = {LUser, LServer},
timestamp = TS, timestamp = TS,

View File

@ -868,10 +868,10 @@ import(LServer, {sql, _}, DBType, <<"spool">>,
fxml:get_attr_s(<<"to">>, El#xmlel.attrs)), fxml:get_attr_s(<<"to">>, El#xmlel.attrs)),
Stamp = fxml:get_path_s(El, [{elem, <<"delay">>}, Stamp = fxml:get_path_s(El, [{elem, <<"delay">>},
{attr, <<"stamp">>}]), {attr, <<"stamp">>}]),
TS = case jlib:datetime_string_to_timestamp(Stamp) of TS = try xmpp_util:decode_timestamp(Stamp) of
{MegaSecs, Secs, _} -> {MegaSecs, Secs, _} ->
{MegaSecs, Secs, 0}; {MegaSecs, Secs, 0}
undefined -> catch _:_ ->
p1_time_compat:timestamp() p1_time_compat:timestamp()
end, end,
US = {LUser, LServer}, US = {LUser, LServer},

View File

@ -552,13 +552,13 @@ numeric_to_binary(<<0, _, _:6/binary, T/binary>>) ->
fun(X, Sum) -> fun(X, Sum) ->
Sum*10000 + X Sum*10000 + X
end, 0, [X || <<X:16>> <= T]), end, 0, [X || <<X:16>> <= T]),
jlib:integer_to_binary(Res). integer_to_binary(Res).
bool_to_binary(<<0>>) -> <<"0">>; bool_to_binary(<<0>>) -> <<"0">>;
bool_to_binary(<<1>>) -> <<"1">>. bool_to_binary(<<1>>) -> <<"1">>.
prepare_list_data(mysql, [ID|Row]) -> prepare_list_data(mysql, [ID|Row]) ->
[jlib:binary_to_integer(ID)|Row]; [binary_to_integer(ID)|Row];
prepare_list_data(pgsql, [<<ID:64>>, prepare_list_data(pgsql, [<<ID:64>>,
SType, SValue, SAction, SOrder, SMatchAll, SType, SValue, SAction, SOrder, SMatchAll,
SMatchIQ, SMatchMessage, SMatchPresenceIn, SMatchIQ, SMatchMessage, SMatchPresenceIn,
@ -572,7 +572,7 @@ prepare_list_data(pgsql, [<<ID:64>>,
bool_to_binary(SMatchPresenceOut)]. bool_to_binary(SMatchPresenceOut)].
prepare_id(mysql, ID) -> prepare_id(mysql, ID) ->
jlib:binary_to_integer(ID); binary_to_integer(ID);
prepare_id(pgsql, <<ID:32>>) -> prepare_id(pgsql, <<ID:32>>) ->
ID. ID.