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

Fix R15B compilation

This commit is contained in:
Evgeniy Khramtsov 2015-03-09 17:50:14 +03:00
parent 72d9b099c6
commit c0540e1377

View File

@ -30,7 +30,7 @@
%%%=================================================================== %%%===================================================================
-spec init() -> ok | {error, any()}. -spec init() -> ok | {error, any()}.
init() -> init() ->
Node = ejabberd_odbc:escape(erlang:atom_to_binary(node(), utf8)), Node = ejabberd_odbc:escape(jlib:atom_to_binary(node())),
lists:foldl( lists:foldl(
fun(Host, ok) -> fun(Host, ok) ->
case ejabberd_odbc:sql_query( case ejabberd_odbc:sql_query(
@ -70,7 +70,7 @@ set_session(#session{sid = {Now, Pid}, usr = {U, LServer, R},
PrioS = enc_priority(Priority), PrioS = enc_priority(Priority),
TS = now_to_timestamp(Now), TS = now_to_timestamp(Now),
PidS = list_to_binary(erlang:pid_to_list(Pid)), PidS = list_to_binary(erlang:pid_to_list(Pid)),
Node = ejabberd_odbc:escape(erlang:atom_to_binary(node(Pid), utf8)), Node = ejabberd_odbc:escape(jlib:atom_to_binary(node(Pid))),
case odbc_queries:update( case odbc_queries:update(
LServer, LServer,
<<"sm">>, <<"sm">>,
@ -145,10 +145,10 @@ get_sessions(LUser, LServer, LResource) ->
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================
now_to_timestamp({MSec, Sec, USec}) -> now_to_timestamp({MSec, Sec, USec}) ->
erlang:integer_to_binary((MSec * 1000000 + Sec) * 1000000 + USec). jlib:integer_to_binary((MSec * 1000000 + Sec) * 1000000 + USec).
timestamp_to_now(TS) -> timestamp_to_now(TS) ->
I = erlang:binary_to_integer(TS), I = jlib:binary_to_integer(TS),
Head = I div 1000000, Head = I div 1000000,
USec = I rem 1000000, USec = I rem 1000000,
MSec = Head div 1000000, MSec = Head div 1000000,
@ -156,7 +156,7 @@ timestamp_to_now(TS) ->
{MSec, Sec, USec}. {MSec, Sec, USec}.
dec_priority(Prio) -> dec_priority(Prio) ->
case catch erlang:binary_to_integer(Prio) of case catch jlib:binary_to_integer(Prio) of
{'EXIT', _} -> {'EXIT', _} ->
undefined; undefined;
Int -> Int ->
@ -166,7 +166,7 @@ dec_priority(Prio) ->
enc_priority(undefined) -> enc_priority(undefined) ->
<<"">>; <<"">>;
enc_priority(Int) when is_integer(Int) -> enc_priority(Int) when is_integer(Int) ->
erlang:integer_to_binary(Int). jlib:integer_to_binary(Int).
row_to_session(LServer, [USec, PidS, User, Resource, PrioS, InfoS]) -> row_to_session(LServer, [USec, PidS, User, Resource, PrioS, InfoS]) ->
Now = timestamp_to_now(USec), Now = timestamp_to_now(USec),