mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Deprecate jlib:integer_to_binary/1 and jlib:binary_to_integer/1
This commit is contained in:
parent
58969fb854
commit
fa31e3ef23
@ -45,7 +45,7 @@ mech_new(Host, _GetPassword, _CheckPassword, _CheckPasswordDigest) ->
|
|||||||
|
|
||||||
mech_step(#state{server = Server} = S, ClientIn) ->
|
mech_step(#state{server = Server} = S, ClientIn) ->
|
||||||
User = iolist_to_binary([randoms:get_string(),
|
User = iolist_to_binary([randoms:get_string(),
|
||||||
jlib:integer_to_binary(p1_time_compat:unique_integer([positive]))]),
|
integer_to_binary(p1_time_compat:unique_integer([positive]))]),
|
||||||
case ejabberd_auth:is_user_exists(User, Server) of
|
case ejabberd_auth:is_user_exists(User, Server) of
|
||||||
true -> mech_step(S, ClientIn);
|
true -> mech_step(S, ClientIn);
|
||||||
false -> {ok, [{username, User}, {authzid, User}, {auth_module, ejabberd_auth_anonymous}]}
|
false -> {ok, [{username, User}, {authzid, User}, {auth_module, ejabberd_auth_anonymous}]}
|
||||||
|
@ -1633,7 +1633,7 @@ new_id() -> randoms:get_string().
|
|||||||
-spec new_uniq_id() -> binary().
|
-spec new_uniq_id() -> binary().
|
||||||
new_uniq_id() ->
|
new_uniq_id() ->
|
||||||
iolist_to_binary([randoms:get_string(),
|
iolist_to_binary([randoms:get_string(),
|
||||||
jlib:integer_to_binary(p1_time_compat:unique_integer([positive]))]).
|
integer_to_binary(p1_time_compat:unique_integer([positive]))]).
|
||||||
|
|
||||||
-spec get_conn_type(state()) -> c2s | c2s_tls | c2s_compressed | websocket |
|
-spec get_conn_type(state()) -> c2s | c2s_tls | c2s_compressed | websocket |
|
||||||
c2s_compressed_tls | http_bind.
|
c2s_compressed_tls | http_bind.
|
||||||
|
@ -392,7 +392,7 @@ get_url(Str) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
get_transfer_protocol(PortString) ->
|
get_transfer_protocol(PortString) ->
|
||||||
PortNumber = jlib:binary_to_integer(PortString),
|
PortNumber = binary_to_integer(PortString),
|
||||||
PortListeners = get_port_listeners(PortNumber),
|
PortListeners = get_port_listeners(PortNumber),
|
||||||
get_captcha_transfer_protocol(PortListeners).
|
get_captcha_transfer_protocol(PortListeners).
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
-define(SPAN(N, V), ?TAG_R(span, ??N, V)).
|
-define(SPAN(N, V), ?TAG_R(span, ??N, V)).
|
||||||
|
|
||||||
-define(STR(A), ?SPAN(str,[<<"\"">>, A, <<"\"">>])).
|
-define(STR(A), ?SPAN(str,[<<"\"">>, A, <<"\"">>])).
|
||||||
-define(NUM(A), ?SPAN(num,jlib:integer_to_binary(A))).
|
-define(NUM(A), ?SPAN(num,integer_to_binary(A))).
|
||||||
-define(FIELD(A), ?SPAN(field,A)).
|
-define(FIELD(A), ?SPAN(field,A)).
|
||||||
-define(ID(A), ?SPAN(id,A)).
|
-define(ID(A), ?SPAN(id,A)).
|
||||||
-define(OP(A), ?SPAN(op,A)).
|
-define(OP(A), ?SPAN(op,A)).
|
||||||
@ -171,7 +171,7 @@ xml_gen({Name, integer}, Int, Indent, HTMLOutput) ->
|
|||||||
[?XML(member, Indent,
|
[?XML(member, Indent,
|
||||||
[?XML_L(name, Indent, 1, ?ID_A(Name)),
|
[?XML_L(name, Indent, 1, ?ID_A(Name)),
|
||||||
?XML(value, Indent, 1,
|
?XML(value, Indent, 1,
|
||||||
[?XML_L(integer, Indent, 2, ?ID(jlib:integer_to_binary(Int)))])])];
|
[?XML_L(integer, Indent, 2, ?ID(integer_to_binary(Int)))])])];
|
||||||
xml_gen({Name, string}, Str, Indent, HTMLOutput) ->
|
xml_gen({Name, string}, Str, Indent, HTMLOutput) ->
|
||||||
[?XML(member, Indent,
|
[?XML(member, Indent,
|
||||||
[?XML_L(name, Indent, 1, ?ID_A(Name)),
|
[?XML_L(name, Indent, 1, ?ID_A(Name)),
|
||||||
|
@ -252,7 +252,7 @@ process_header(State, Data) ->
|
|||||||
request_headers = add_header(Name, Auth, State)};
|
request_headers = add_header(Name, Auth, State)};
|
||||||
{ok,
|
{ok,
|
||||||
{http_header, _, 'Content-Length' = Name, _, SLen}} ->
|
{http_header, _, 'Content-Length' = Name, _, SLen}} ->
|
||||||
case catch jlib:binary_to_integer(SLen) of
|
case catch binary_to_integer(SLen) of
|
||||||
Len when is_integer(Len) ->
|
Len when is_integer(Len) ->
|
||||||
State#state{request_content_length = Len,
|
State#state{request_content_length = Len,
|
||||||
request_headers = add_header(Name, SLen, State)};
|
request_headers = add_header(Name, SLen, State)};
|
||||||
@ -327,10 +327,10 @@ get_transfer_protocol(SockMod, HostPort) ->
|
|||||||
case {SockMod, PortList} of
|
case {SockMod, PortList} of
|
||||||
{gen_tcp, []} -> {Host, 80, http};
|
{gen_tcp, []} -> {Host, 80, http};
|
||||||
{gen_tcp, [Port]} ->
|
{gen_tcp, [Port]} ->
|
||||||
{Host, jlib:binary_to_integer(Port), http};
|
{Host, binary_to_integer(Port), http};
|
||||||
{fast_tls, []} -> {Host, 443, https};
|
{fast_tls, []} -> {Host, 443, https};
|
||||||
{fast_tls, [Port]} ->
|
{fast_tls, [Port]} ->
|
||||||
{Host, jlib:binary_to_integer(Port), https}
|
{Host, binary_to_integer(Port), https}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% XXX bard: search through request handlers looking for one that
|
%% XXX bard: search through request handlers looking for one that
|
||||||
@ -587,12 +587,12 @@ make_text_output(State, Status, Reason, Headers, Text) ->
|
|||||||
of
|
of
|
||||||
{value, _} ->
|
{value, _} ->
|
||||||
[{<<"Content-Length">>,
|
[{<<"Content-Length">>,
|
||||||
jlib:integer_to_binary(byte_size(Data))}
|
integer_to_binary(byte_size(Data))}
|
||||||
| Headers];
|
| Headers];
|
||||||
_ ->
|
_ ->
|
||||||
[{<<"Content-Type">>, <<"text/html; charset=utf-8">>},
|
[{<<"Content-Type">>, <<"text/html; charset=utf-8">>},
|
||||||
{<<"Content-Length">>,
|
{<<"Content-Length">>,
|
||||||
jlib:integer_to_binary(byte_size(Data))}
|
integer_to_binary(byte_size(Data))}
|
||||||
| Headers]
|
| Headers]
|
||||||
end,
|
end,
|
||||||
HeadersOut = case {State#state.request_version,
|
HeadersOut = case {State#state.request_version,
|
||||||
@ -617,7 +617,7 @@ make_text_output(State, Status, Reason, Headers, Text) ->
|
|||||||
_ -> Reason
|
_ -> Reason
|
||||||
end,
|
end,
|
||||||
SL = [Version,
|
SL = [Version,
|
||||||
jlib:integer_to_binary(Status), <<" ">>,
|
integer_to_binary(Status), <<" ">>,
|
||||||
NewReason, <<"\r\n">>],
|
NewReason, <<"\r\n">>],
|
||||||
Data2 = case State#state.request_method of
|
Data2 = case State#state.request_method of
|
||||||
'HEAD' -> <<"">>;
|
'HEAD' -> <<"">>;
|
||||||
|
@ -853,7 +853,7 @@ rid_allow(OldRid, NewRid, Attrs, Hold, MaxPause) ->
|
|||||||
%% We did not miss any packet, we can process it immediately:
|
%% We did not miss any packet, we can process it immediately:
|
||||||
NewRid == OldRid + 1 ->
|
NewRid == OldRid + 1 ->
|
||||||
case catch
|
case catch
|
||||||
jlib:binary_to_integer(fxml:get_attr_s(<<"pause">>,
|
binary_to_integer(fxml:get_attr_s(<<"pause">>,
|
||||||
Attrs))
|
Attrs))
|
||||||
of
|
of
|
||||||
{'EXIT', _} -> {true, 0};
|
{'EXIT', _} -> {true, 0};
|
||||||
@ -1119,7 +1119,7 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
|
|||||||
if Xmlns /= (?NS_HTTP_BIND) -> {error, bad_request};
|
if Xmlns /= (?NS_HTTP_BIND) -> {error, bad_request};
|
||||||
true ->
|
true ->
|
||||||
case catch
|
case catch
|
||||||
jlib:binary_to_integer(fxml:get_attr_s(<<"rid">>,
|
binary_to_integer(fxml:get_attr_s(<<"rid">>,
|
||||||
Attrs))
|
Attrs))
|
||||||
of
|
of
|
||||||
{'EXIT', _} -> {error, bad_request};
|
{'EXIT', _} -> {error, bad_request};
|
||||||
|
@ -147,7 +147,7 @@ timestamp_to_now(I) ->
|
|||||||
{MSec, Sec, USec}.
|
{MSec, Sec, USec}.
|
||||||
|
|
||||||
dec_priority(Prio) ->
|
dec_priority(Prio) ->
|
||||||
case catch jlib:binary_to_integer(Prio) of
|
case catch binary_to_integer(Prio) of
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
undefined;
|
undefined;
|
||||||
Int ->
|
Int ->
|
||||||
@ -157,7 +157,7 @@ dec_priority(Prio) ->
|
|||||||
enc_priority(undefined) ->
|
enc_priority(undefined) ->
|
||||||
<<"">>;
|
<<"">>;
|
||||||
enc_priority(Int) when is_integer(Int) ->
|
enc_priority(Int) when is_integer(Int) ->
|
||||||
jlib:integer_to_binary(Int).
|
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),
|
||||||
|
@ -768,7 +768,7 @@ sqlite_to_odbc(Host, {rowid, _}) ->
|
|||||||
sqlite_to_odbc(_Host, [{columns, Columns}, {rows, TRows}]) ->
|
sqlite_to_odbc(_Host, [{columns, Columns}, {rows, TRows}]) ->
|
||||||
Rows = [lists:map(
|
Rows = [lists:map(
|
||||||
fun(I) when is_integer(I) ->
|
fun(I) when is_integer(I) ->
|
||||||
jlib:integer_to_binary(I);
|
integer_to_binary(I);
|
||||||
(B) ->
|
(B) ->
|
||||||
B
|
B
|
||||||
end, tuple_to_list(Row)) || Row <- TRows],
|
end, tuple_to_list(Row)) || Row <- TRows],
|
||||||
@ -813,11 +813,11 @@ pgsql_item_to_odbc({<<"FETCH", _/binary>>, Rows,
|
|||||||
{selected, [element(1, Row) || Row <- Rows], Recs};
|
{selected, [element(1, Row) || Row <- Rows], Recs};
|
||||||
pgsql_item_to_odbc(<<"INSERT ", OIDN/binary>>) ->
|
pgsql_item_to_odbc(<<"INSERT ", OIDN/binary>>) ->
|
||||||
[_OID, N] = str:tokens(OIDN, <<" ">>),
|
[_OID, N] = str:tokens(OIDN, <<" ">>),
|
||||||
{updated, jlib:binary_to_integer(N)};
|
{updated, binary_to_integer(N)};
|
||||||
pgsql_item_to_odbc(<<"DELETE ", N/binary>>) ->
|
pgsql_item_to_odbc(<<"DELETE ", N/binary>>) ->
|
||||||
{updated, jlib:binary_to_integer(N)};
|
{updated, binary_to_integer(N)};
|
||||||
pgsql_item_to_odbc(<<"UPDATE ", N/binary>>) ->
|
pgsql_item_to_odbc(<<"UPDATE ", N/binary>>) ->
|
||||||
{updated, jlib:binary_to_integer(N)};
|
{updated, binary_to_integer(N)};
|
||||||
pgsql_item_to_odbc({error, Error}) -> {error, Error};
|
pgsql_item_to_odbc({error, Error}) -> {error, Error};
|
||||||
pgsql_item_to_odbc(_) -> {updated, undefined}.
|
pgsql_item_to_odbc(_) -> {updated, undefined}.
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ mysql_item_to_odbc(Columns, Recs) ->
|
|||||||
to_odbc({selected, Columns, Recs}) ->
|
to_odbc({selected, Columns, Recs}) ->
|
||||||
Rows = [lists:map(
|
Rows = [lists:map(
|
||||||
fun(I) when is_integer(I) ->
|
fun(I) when is_integer(I) ->
|
||||||
jlib:integer_to_binary(I);
|
integer_to_binary(I);
|
||||||
(B) ->
|
(B) ->
|
||||||
B
|
B
|
||||||
end, Row) || Row <- Recs],
|
end, Row) || Row <- Recs],
|
||||||
|
@ -300,7 +300,7 @@ process_command2([<<"showlh">>, SNode], From, To) ->
|
|||||||
process_command2([<<"setlh">>, SNode, NewValueString],
|
process_command2([<<"setlh">>, SNode, NewValueString],
|
||||||
From, To) ->
|
From, To) ->
|
||||||
Node = jlib:binary_to_atom(SNode),
|
Node = jlib:binary_to_atom(SNode),
|
||||||
NewValue = jlib:binary_to_integer(NewValueString),
|
NewValue = binary_to_integer(NewValueString),
|
||||||
remote_command(Node, [setlh, NewValue], From, To);
|
remote_command(Node, [setlh, NewValue], From, To);
|
||||||
process_command2([<<"help">>], From, To) ->
|
process_command2([<<"help">>], From, To) ->
|
||||||
send_message(To, From, help());
|
send_message(To, From, help());
|
||||||
|
@ -1458,8 +1458,8 @@ list_users_in_diapason(Host, Diap, Lang, URLFunc) ->
|
|||||||
Users = ejabberd_auth:get_vh_registered_users(Host),
|
Users = ejabberd_auth:get_vh_registered_users(Host),
|
||||||
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
|
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
|
||||||
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
|
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
|
||||||
N1 = jlib:binary_to_integer(S1),
|
N1 = binary_to_integer(S1),
|
||||||
N2 = jlib:binary_to_integer(S2),
|
N2 = binary_to_integer(S2),
|
||||||
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
||||||
[list_given_users(Host, Sub, <<"../../">>, Lang,
|
[list_given_users(Host, Sub, <<"../../">>, Lang,
|
||||||
URLFunc)].
|
URLFunc)].
|
||||||
@ -1648,7 +1648,7 @@ user_info(User, Server, Query, Lang) ->
|
|||||||
"://",
|
"://",
|
||||||
(jlib:ip_to_list(IP))/binary,
|
(jlib:ip_to_list(IP))/binary,
|
||||||
":",
|
":",
|
||||||
(jlib:integer_to_binary(Port))/binary,
|
(integer_to_binary(Port))/binary,
|
||||||
"#",
|
"#",
|
||||||
(jlib:atom_to_binary(Node))/binary>>
|
(jlib:atom_to_binary(Node))/binary>>
|
||||||
end,
|
end,
|
||||||
@ -2520,7 +2520,7 @@ make_netprot_html(NetProt) ->
|
|||||||
get_port_data(PortIP, Opts) ->
|
get_port_data(PortIP, Opts) ->
|
||||||
{Port, IPT, IPS, _IPV, NetProt, OptsClean} =
|
{Port, IPT, IPS, _IPV, NetProt, OptsClean} =
|
||||||
ejabberd_listener:parse_listener_portip(PortIP, Opts),
|
ejabberd_listener:parse_listener_portip(PortIP, Opts),
|
||||||
SPort = jlib:integer_to_binary(Port),
|
SPort = integer_to_binary(Port),
|
||||||
SSPort = list_to_binary(
|
SSPort = list_to_binary(
|
||||||
lists:map(fun (N) ->
|
lists:map(fun (N) ->
|
||||||
io_lib:format("~.16b", [N])
|
io_lib:format("~.16b", [N])
|
||||||
|
@ -126,7 +126,7 @@ xdb_data(User, Server, #xmlel{attrs = Attrs} = El) ->
|
|||||||
TimeStamp = fxml:get_attr_s(<<"last">>, Attrs),
|
TimeStamp = fxml:get_attr_s(<<"last">>, Attrs),
|
||||||
Status = fxml:get_tag_cdata(El),
|
Status = fxml:get_tag_cdata(El),
|
||||||
catch mod_last:store_last_info(User, Server,
|
catch mod_last:store_last_info(User, Server,
|
||||||
jlib:binary_to_integer(TimeStamp),
|
binary_to_integer(TimeStamp),
|
||||||
Status),
|
Status),
|
||||||
ok;
|
ok;
|
||||||
?NS_VCARD ->
|
?NS_VCARD ->
|
||||||
|
@ -74,7 +74,9 @@
|
|||||||
{resourceprep, 1},
|
{resourceprep, 1},
|
||||||
{jid_tolower, 1},
|
{jid_tolower, 1},
|
||||||
{jid_remove_resource, 1},
|
{jid_remove_resource, 1},
|
||||||
{jid_replace_resource, 2}]).
|
{jid_replace_resource, 2},
|
||||||
|
{integer_to_binary, 1},
|
||||||
|
{binary_to_integer, 1}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
|
@ -546,7 +546,7 @@ import_start(LServer, DBType) ->
|
|||||||
|
|
||||||
import(_LServer, {sql, _}, _DBType, <<"caps_features">>,
|
import(_LServer, {sql, _}, _DBType, <<"caps_features">>,
|
||||||
[Node, SubNode, Feature, _TimeStamp]) ->
|
[Node, SubNode, Feature, _TimeStamp]) ->
|
||||||
Feature1 = case catch jlib:binary_to_integer(Feature) of
|
Feature1 = case catch binary_to_integer(Feature) of
|
||||||
I when is_integer(I), I>0 -> I;
|
I when is_integer(I), I>0 -> I;
|
||||||
_ -> Feature
|
_ -> Feature
|
||||||
end,
|
end,
|
||||||
|
@ -29,7 +29,7 @@ caps_read(LServer, {Node, SubNode}) ->
|
|||||||
?SQL("select @(feature)s from caps_features where"
|
?SQL("select @(feature)s from caps_features where"
|
||||||
" node=%(Node)s and subnode=%(SubNode)s")) of
|
" node=%(Node)s and subnode=%(SubNode)s")) of
|
||||||
{selected, [{H}|_] = Fs} ->
|
{selected, [{H}|_] = Fs} ->
|
||||||
case catch jlib:binary_to_integer(H) of
|
case catch binary_to_integer(H) of
|
||||||
Int when is_integer(Int), Int>=0 ->
|
Int when is_integer(Int), Int>=0 ->
|
||||||
{ok, Int};
|
{ok, Int};
|
||||||
_ ->
|
_ ->
|
||||||
@ -58,7 +58,7 @@ export(_Server) ->
|
|||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
sql_write_features_t({Node, SubNode}, Features) ->
|
sql_write_features_t({Node, SubNode}, Features) ->
|
||||||
NewFeatures = if is_integer(Features) ->
|
NewFeatures = if is_integer(Features) ->
|
||||||
[jlib:integer_to_binary(Features)];
|
[integer_to_binary(Features)];
|
||||||
true ->
|
true ->
|
||||||
Features
|
Features
|
||||||
end,
|
end,
|
||||||
|
@ -552,8 +552,8 @@ get_local_items({_, Host},
|
|||||||
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
|
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
|
||||||
try
|
try
|
||||||
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
|
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
|
||||||
N1 = jlib:binary_to_integer(S1),
|
N1 = binary_to_integer(S1),
|
||||||
N2 = jlib:binary_to_integer(S2),
|
N2 = binary_to_integer(S2),
|
||||||
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
||||||
{result, lists:map(
|
{result, lists:map(
|
||||||
fun({S, U}) ->
|
fun({S, U}) ->
|
||||||
@ -1659,11 +1659,11 @@ set_form(From, Host, ?NS_ADMINL(<<"user-stats">>), Lang,
|
|||||||
IPs1 = [ejabberd_sm:get_user_ip(User, Server, Resource)
|
IPs1 = [ejabberd_sm:get_user_ip(User, Server, Resource)
|
||||||
|| Resource <- Resources],
|
|| Resource <- Resources],
|
||||||
IPs = [<<(jlib:ip_to_list(IP))/binary, ":",
|
IPs = [<<(jlib:ip_to_list(IP))/binary, ":",
|
||||||
(jlib:integer_to_binary(Port))/binary>>
|
(integer_to_binary(Port))/binary>>
|
||||||
|| {IP, Port} <- IPs1],
|
|| {IP, Port} <- IPs1],
|
||||||
Items = ejabberd_hooks:run_fold(roster_get, Server, [],
|
Items = ejabberd_hooks:run_fold(roster_get, Server, [],
|
||||||
[{User, Server}]),
|
[{User, Server}]),
|
||||||
Rostersize = jlib:integer_to_binary(erlang:length(Items)),
|
Rostersize = integer_to_binary(erlang:length(Items)),
|
||||||
{result,
|
{result,
|
||||||
#xdata{type = form,
|
#xdata{type = form,
|
||||||
fields = [?HFIELD(),
|
fields = [?HFIELD(),
|
||||||
@ -1695,7 +1695,7 @@ search_running_node(SNode, [Node | Nodes]) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
stop_node(From, Host, ENode, Action, XData) ->
|
stop_node(From, Host, ENode, Action, XData) ->
|
||||||
Delay = jlib:binary_to_integer(get_value(<<"delay">>, XData)),
|
Delay = binary_to_integer(get_value(<<"delay">>, XData)),
|
||||||
Subject = case get_value(<<"subject">>, XData) of
|
Subject = case get_value(<<"subject">>, XData) of
|
||||||
<<"">> ->
|
<<"">> ->
|
||||||
[];
|
[];
|
||||||
|
@ -267,7 +267,7 @@ process(_Path, Request) ->
|
|||||||
get_api_version(#request{path = Path}) ->
|
get_api_version(#request{path = Path}) ->
|
||||||
get_api_version(lists:reverse(Path));
|
get_api_version(lists:reverse(Path));
|
||||||
get_api_version([<<"v", String/binary>> | Tail]) ->
|
get_api_version([<<"v", String/binary>> | Tail]) ->
|
||||||
case catch jlib:binary_to_integer(String) of
|
case catch binary_to_integer(String) of
|
||||||
N when is_integer(N) ->
|
N when is_integer(N) ->
|
||||||
N;
|
N;
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
-define(FORMAT(Error), file:format_error(Error)).
|
-define(FORMAT(Error), file:format_error(Error)).
|
||||||
-define(URL_ENC(URL), binary_to_list(ejabberd_http:url_encode(URL))).
|
-define(URL_ENC(URL), binary_to_list(ejabberd_http:url_encode(URL))).
|
||||||
-define(ADDR_TO_STR(IP), ejabberd_config:may_hide_data(jlib:ip_to_list(IP))).
|
-define(ADDR_TO_STR(IP), ejabberd_config:may_hide_data(jlib:ip_to_list(IP))).
|
||||||
-define(STR_TO_INT(Str, B), jlib:binary_to_integer(iolist_to_binary(Str), B)).
|
-define(STR_TO_INT(Str, B), binary_to_integer(iolist_to_binary(Str), B)).
|
||||||
-define(DEFAULT_CONTENT_TYPE, <<"application/octet-stream">>).
|
-define(DEFAULT_CONTENT_TYPE, <<"application/octet-stream">>).
|
||||||
-define(CONTENT_TYPES,
|
-define(CONTENT_TYPES,
|
||||||
[{<<".avi">>, <<"video/avi">>},
|
[{<<".avi">>, <<"video/avi">>},
|
||||||
@ -578,7 +578,7 @@ process_iq(_From, #iq{}, _State) ->
|
|||||||
create_slot(#state{service_url = undefined, max_size = MaxSize},
|
create_slot(#state{service_url = undefined, max_size = MaxSize},
|
||||||
JID, File, Size, _ContentType, Lang) when MaxSize /= infinity,
|
JID, File, Size, _ContentType, Lang) when MaxSize /= infinity,
|
||||||
Size > MaxSize ->
|
Size > MaxSize ->
|
||||||
Text = <<"File larger than ", (jlib:integer_to_binary(MaxSize))/binary,
|
Text = <<"File larger than ", (integer_to_binary(MaxSize))/binary,
|
||||||
" Bytes.">>,
|
" Bytes.">>,
|
||||||
?INFO_MSG("Rejecting file ~s from ~s (too large: ~B bytes)",
|
?INFO_MSG("Rejecting file ~s from ~s (too large: ~B bytes)",
|
||||||
[File, jid:to_string(JID), Size]),
|
[File, jid:to_string(JID), Size]),
|
||||||
@ -609,7 +609,7 @@ create_slot(#state{service_url = ServiceURL},
|
|||||||
Lang) ->
|
Lang) ->
|
||||||
Options = [{body_format, binary}, {full_result, false}],
|
Options = [{body_format, binary}, {full_result, false}],
|
||||||
HttpOptions = [{timeout, ?SERVICE_REQUEST_TIMEOUT}],
|
HttpOptions = [{timeout, ?SERVICE_REQUEST_TIMEOUT}],
|
||||||
SizeStr = jlib:integer_to_binary(Size),
|
SizeStr = integer_to_binary(Size),
|
||||||
GetRequest = binary_to_list(ServiceURL) ++
|
GetRequest = binary_to_list(ServiceURL) ++
|
||||||
"?jid=" ++ ?URL_ENC(jid:to_string({U, S, <<"">>})) ++
|
"?jid=" ++ ?URL_ENC(jid:to_string({U, S, <<"">>})) ++
|
||||||
"&name=" ++ ?URL_ENC(File) ++
|
"&name=" ++ ?URL_ENC(File) ++
|
||||||
@ -727,7 +727,7 @@ iq_disco_info(Host, Lang, Name, AddInfo) ->
|
|||||||
infinity ->
|
infinity ->
|
||||||
AddInfo;
|
AddInfo;
|
||||||
MaxSize ->
|
MaxSize ->
|
||||||
MaxSizeStr = jlib:integer_to_binary(MaxSize),
|
MaxSizeStr = integer_to_binary(MaxSize),
|
||||||
Fields = [#xdata_field{type = hidden,
|
Fields = [#xdata_field{type = hidden,
|
||||||
var = <<"FORM_TYPE">>,
|
var = <<"FORM_TYPE">>,
|
||||||
values = [?NS_HTTP_UPLOAD]},
|
values = [?NS_HTTP_UPLOAD]},
|
||||||
|
@ -62,7 +62,7 @@ import(LServer) ->
|
|||||||
[{<<"select username, seconds, state from last">>,
|
[{<<"select username, seconds, state from last">>,
|
||||||
fun([LUser, TimeStamp, State]) ->
|
fun([LUser, TimeStamp, State]) ->
|
||||||
#last_activity{us = {LUser, LServer},
|
#last_activity{us = {LUser, LServer},
|
||||||
timestamp = jlib:binary_to_integer(
|
timestamp = binary_to_integer(
|
||||||
TimeStamp),
|
TimeStamp),
|
||||||
status = State}
|
status = State}
|
||||||
end}].
|
end}].
|
||||||
|
@ -97,7 +97,7 @@ store(Pkt, _, {LUser, LServer}, Type, Peer, Nick, _Dir) ->
|
|||||||
_ ->
|
_ ->
|
||||||
LPeer = {PUser, PServer, _} = jid:tolower(Peer),
|
LPeer = {PUser, PServer, _} = jid:tolower(Peer),
|
||||||
TS = p1_time_compat:timestamp(),
|
TS = p1_time_compat:timestamp(),
|
||||||
ID = jlib:integer_to_binary(now_to_usec(TS)),
|
ID = integer_to_binary(now_to_usec(TS)),
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
mnesia:write(
|
mnesia:write(
|
||||||
#archive_msg{us = {LUser, LServer},
|
#archive_msg{us = {LUser, LServer},
|
||||||
@ -145,7 +145,7 @@ select(_LServer, JidRequestor,
|
|||||||
Result = {lists:map(
|
Result = {lists:map(
|
||||||
fun(Msg) ->
|
fun(Msg) ->
|
||||||
{Msg#archive_msg.id,
|
{Msg#archive_msg.id,
|
||||||
jlib:binary_to_integer(Msg#archive_msg.id),
|
binary_to_integer(Msg#archive_msg.id),
|
||||||
mod_mam:msg_to_el(Msg, MsgType, JidRequestor,
|
mod_mam:msg_to_el(Msg, MsgType, JidRequestor,
|
||||||
JidArchive)}
|
JidArchive)}
|
||||||
end, FilteredMsgs), IsComplete, Count},
|
end, FilteredMsgs), IsComplete, Count},
|
||||||
|
@ -55,7 +55,7 @@ extended_fields() ->
|
|||||||
|
|
||||||
store(Pkt, LServer, {LUser, LHost}, Type, Peer, Nick, _Dir) ->
|
store(Pkt, LServer, {LUser, LHost}, Type, Peer, Nick, _Dir) ->
|
||||||
TSinteger = p1_time_compat:system_time(micro_seconds),
|
TSinteger = p1_time_compat:system_time(micro_seconds),
|
||||||
ID = jlib:integer_to_binary(TSinteger),
|
ID = integer_to_binary(TSinteger),
|
||||||
SUser = case Type of
|
SUser = case Type of
|
||||||
chat -> LUser;
|
chat -> LUser;
|
||||||
groupchat -> jid:to_string({LUser, LHost, <<>>})
|
groupchat -> jid:to_string({LUser, LHost, <<>>})
|
||||||
@ -154,14 +154,14 @@ select(LServer, JidRequestor, #jid{luser = LUser} = JidArchive,
|
|||||||
fun([TS, XML, PeerBin, Kind, Nick]) ->
|
fun([TS, XML, PeerBin, Kind, Nick]) ->
|
||||||
try
|
try
|
||||||
#xmlel{} = El = fxml_stream:parse_element(XML),
|
#xmlel{} = El = fxml_stream:parse_element(XML),
|
||||||
Now = usec_to_now(jlib:binary_to_integer(TS)),
|
Now = usec_to_now(binary_to_integer(TS)),
|
||||||
PeerJid = jid:tolower(jid:from_string(PeerBin)),
|
PeerJid = jid:tolower(jid:from_string(PeerBin)),
|
||||||
T = case Kind of
|
T = case Kind of
|
||||||
<<"">> -> chat;
|
<<"">> -> chat;
|
||||||
null -> chat;
|
null -> chat;
|
||||||
_ -> jlib:binary_to_atom(Kind)
|
_ -> jlib:binary_to_atom(Kind)
|
||||||
end,
|
end,
|
||||||
[{TS, jlib:binary_to_integer(TS),
|
[{TS, binary_to_integer(TS),
|
||||||
mod_mam:msg_to_el(#archive_msg{timestamp = Now,
|
mod_mam:msg_to_el(#archive_msg{timestamp = Now,
|
||||||
packet = El,
|
packet = El,
|
||||||
type = T,
|
type = T,
|
||||||
@ -176,7 +176,7 @@ select(LServer, JidRequestor, #jid{luser = LUser} = JidArchive,
|
|||||||
[Err, TS, XML, PeerBin, Kind, Nick]),
|
[Err, TS, XML, PeerBin, Kind, Nick]),
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end, Res1), IsComplete, jlib:binary_to_integer(Count)};
|
end, Res1), IsComplete, binary_to_integer(Count)};
|
||||||
_ ->
|
_ ->
|
||||||
{[], false, 0}
|
{[], false, 0}
|
||||||
end.
|
end.
|
||||||
@ -208,12 +208,12 @@ make_sql_query(User, LServer,
|
|||||||
_ -> fun ejabberd_sql:escape/1
|
_ -> fun ejabberd_sql:escape/1
|
||||||
end,
|
end,
|
||||||
LimitClause = if is_integer(Max), Max >= 0, ODBCType /= mssql ->
|
LimitClause = if is_integer(Max), Max >= 0, ODBCType /= mssql ->
|
||||||
[<<" limit ">>, jlib:integer_to_binary(Max+1)];
|
[<<" limit ">>, integer_to_binary(Max+1)];
|
||||||
true ->
|
true ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
TopClause = if is_integer(Max), Max >= 0, ODBCType == mssql ->
|
TopClause = if is_integer(Max), Max >= 0, ODBCType == mssql ->
|
||||||
[<<" TOP ">>, jlib:integer_to_binary(Max+1)];
|
[<<" TOP ">>, integer_to_binary(Max+1)];
|
||||||
true ->
|
true ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
@ -235,7 +235,7 @@ make_sql_query(User, LServer,
|
|||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
PageClause = case catch jlib:binary_to_integer(ID) of
|
PageClause = case catch binary_to_integer(ID) of
|
||||||
I when is_integer(I), I >= 0 ->
|
I when is_integer(I), I >= 0 ->
|
||||||
case Direction of
|
case Direction of
|
||||||
before ->
|
before ->
|
||||||
@ -251,14 +251,14 @@ make_sql_query(User, LServer,
|
|||||||
StartClause = case Start of
|
StartClause = case Start of
|
||||||
{_, _, _} ->
|
{_, _, _} ->
|
||||||
[<<" and timestamp >= ">>,
|
[<<" and timestamp >= ">>,
|
||||||
jlib:integer_to_binary(now_to_usec(Start))];
|
integer_to_binary(now_to_usec(Start))];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
EndClause = case End of
|
EndClause = case End of
|
||||||
{_, _, _} ->
|
{_, _, _} ->
|
||||||
[<<" and timestamp <= ">>,
|
[<<" and timestamp <= ">>,
|
||||||
jlib:integer_to_binary(now_to_usec(End))];
|
integer_to_binary(now_to_usec(End))];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
|
@ -761,7 +761,7 @@ change_room_option(Name, Service, OptionString, ValueString) ->
|
|||||||
password -> ValueString;
|
password -> ValueString;
|
||||||
subject ->ValueString;
|
subject ->ValueString;
|
||||||
subject_author ->ValueString;
|
subject_author ->ValueString;
|
||||||
max_users -> jlib:binary_to_integer(ValueString);
|
max_users -> binary_to_integer(ValueString);
|
||||||
_ -> jlib:binary_to_atom(ValueString)
|
_ -> jlib:binary_to_atom(ValueString)
|
||||||
end,
|
end,
|
||||||
change_room_option(Name, Service, Option, Value).
|
change_room_option(Name, Service, Option, Value).
|
||||||
|
@ -301,7 +301,7 @@ get_sm_items(Acc, _From, _To, _Node, _Lang) ->
|
|||||||
([xdata()], jid(), jid(), binary(), binary()) -> [xdata()].
|
([xdata()], jid(), jid(), binary(), binary()) -> [xdata()].
|
||||||
get_info(_Acc, #jid{luser = U, lserver = S, lresource = R},
|
get_info(_Acc, #jid{luser = U, lserver = S, lresource = R},
|
||||||
#jid{luser = U, lserver = S}, ?NS_FLEX_OFFLINE, _Lang) ->
|
#jid{luser = U, lserver = S}, ?NS_FLEX_OFFLINE, _Lang) ->
|
||||||
N = jlib:integer_to_binary(count_offline_messages(U, S)),
|
N = integer_to_binary(count_offline_messages(U, S)),
|
||||||
case ejabberd_sm:get_session_pid(U, S, R) of
|
case ejabberd_sm:get_session_pid(U, S, R) of
|
||||||
Pid when is_pid(Pid) ->
|
Pid when is_pid(Pid) ->
|
||||||
Pid ! dont_ask_offline;
|
Pid ! dont_ask_offline;
|
||||||
|
@ -198,7 +198,7 @@ export(Server) ->
|
|||||||
[<<"select id from privacy_list order by "
|
[<<"select id from privacy_list order by "
|
||||||
"id desc limit 1;">>]) of
|
"id desc limit 1;">>]) of
|
||||||
{selected, [<<"id">>], [[I]]} ->
|
{selected, [<<"id">>], [[I]]} ->
|
||||||
put(id, jlib:binary_to_integer(I));
|
put(id, binary_to_integer(I));
|
||||||
_ ->
|
_ ->
|
||||||
put(id, 0)
|
put(id, 0)
|
||||||
end,
|
end,
|
||||||
|
@ -3279,7 +3279,7 @@ max_items(Host, Options) ->
|
|||||||
-define(INTEGER_CONFIG_FIELD(Label, Var),
|
-define(INTEGER_CONFIG_FIELD(Label, Var),
|
||||||
?STRINGXFIELD(Label,
|
?STRINGXFIELD(Label,
|
||||||
<<"pubsub#", (atom_to_binary(Var, latin1))/binary>>,
|
<<"pubsub#", (atom_to_binary(Var, latin1))/binary>>,
|
||||||
(jlib:integer_to_binary(get_option(Options, Var))))).
|
(integer_to_binary(get_option(Options, Var))))).
|
||||||
|
|
||||||
-define(JLIST_CONFIG_FIELD(Label, Var, Opts),
|
-define(JLIST_CONFIG_FIELD(Label, Var, Opts),
|
||||||
?LISTXFIELD(Label,
|
?LISTXFIELD(Label,
|
||||||
@ -3418,7 +3418,7 @@ add_opt(Key, Value, Opts) ->
|
|||||||
set_xoption(Host, Opts, add_opt(Opt, Val, NewOpts))).
|
set_xoption(Host, Opts, add_opt(Opt, Val, NewOpts))).
|
||||||
|
|
||||||
-define(SET_INTEGER_XOPT(Opt, Val, Min, Max),
|
-define(SET_INTEGER_XOPT(Opt, Val, Min, Max),
|
||||||
case catch jlib:binary_to_integer(Val) of
|
case catch binary_to_integer(Val) of
|
||||||
IVal when is_integer(IVal), IVal >= Min ->
|
IVal when is_integer(IVal), IVal >= Min ->
|
||||||
if (Max =:= undefined) orelse (IVal =< Max) ->
|
if (Max =:= undefined) orelse (IVal =< Max) ->
|
||||||
set_xoption(Host, Opts, add_opt(Opt, IVal, NewOpts));
|
set_xoption(Host, Opts, add_opt(Opt, IVal, NewOpts));
|
||||||
|
@ -907,21 +907,21 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
|||||||
[?XCT(<<"td">>, <<"Description:">>),
|
[?XCT(<<"td">>, <<"Description:">>),
|
||||||
?XE(<<"td">>,
|
?XE(<<"td">>,
|
||||||
[?TEXTAREA(<<"description">>,
|
[?TEXTAREA(<<"description">>,
|
||||||
jlib:integer_to_binary(lists:max([3,
|
integer_to_binary(lists:max([3,
|
||||||
DescNL])),
|
DescNL])),
|
||||||
<<"20">>, Description)])]),
|
<<"20">>, Description)])]),
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XCT(<<"td">>, <<"Members:">>),
|
[?XCT(<<"td">>, <<"Members:">>),
|
||||||
?XE(<<"td">>,
|
?XE(<<"td">>,
|
||||||
[?TEXTAREA(<<"members">>,
|
[?TEXTAREA(<<"members">>,
|
||||||
jlib:integer_to_binary(lists:max([3,
|
integer_to_binary(lists:max([3,
|
||||||
byte_size(FMembers)])),
|
byte_size(FMembers)])),
|
||||||
<<"20">>, FMembers)])]),
|
<<"20">>, FMembers)])]),
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XCT(<<"td">>, <<"Displayed Groups:">>),
|
[?XCT(<<"td">>, <<"Displayed Groups:">>),
|
||||||
?XE(<<"td">>,
|
?XE(<<"td">>,
|
||||||
[?TEXTAREA(<<"dispgroups">>,
|
[?TEXTAREA(<<"dispgroups">>,
|
||||||
jlib:integer_to_binary(lists:max([3, length(FDisplayedGroups)])),
|
integer_to_binary(lists:max([3, length(FDisplayedGroups)])),
|
||||||
<<"20">>,
|
<<"20">>,
|
||||||
list_to_binary(FDisplayedGroups))])])])])),
|
list_to_binary(FDisplayedGroups))])])])])),
|
||||||
(?H1GL((?T(<<"Shared Roster Groups">>)),
|
(?H1GL((?T(<<"Shared Roster Groups">>)),
|
||||||
|
@ -82,7 +82,7 @@ search(LServer, Data, AllowReturnAll, MaxMatch) ->
|
|||||||
infinity ->
|
infinity ->
|
||||||
<<"">>;
|
<<"">>;
|
||||||
Val ->
|
Val ->
|
||||||
[<<" LIMIT ">>, jlib:integer_to_binary(Val)]
|
[<<" LIMIT ">>, integer_to_binary(Val)]
|
||||||
end,
|
end,
|
||||||
case catch ejabberd_sql:sql_query(
|
case catch ejabberd_sql:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
|
@ -134,7 +134,7 @@ boolean_to_sql(false) -> <<"0">>.
|
|||||||
|
|
||||||
timestamp_to_sql(T) -> jlib:now_to_utc_string(T).
|
timestamp_to_sql(T) -> jlib:now_to_utc_string(T).
|
||||||
|
|
||||||
sql_to_integer(N) -> jlib:binary_to_integer(N).
|
sql_to_integer(N) -> binary_to_integer(N).
|
||||||
|
|
||||||
sql_to_boolean(B) -> B == <<"1">>.
|
sql_to_boolean(B) -> B == <<"1">>.
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ var_xfield(_) -> {error, badarg}.
|
|||||||
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
||||||
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
||||||
val_xfield(digest_frequency = Opt, [Val]) ->
|
val_xfield(digest_frequency = Opt, [Val]) ->
|
||||||
case catch jlib:binary_to_integer(Val) of
|
case catch binary_to_integer(Val) of
|
||||||
N when is_integer(N) -> N;
|
N when is_integer(N) -> N;
|
||||||
_ ->
|
_ ->
|
||||||
Txt = <<"Value of '~s' should be integer">>,
|
Txt = <<"Value of '~s' should be integer">>,
|
||||||
@ -225,7 +225,7 @@ val_xfield(subscription_type, [<<"items">>]) -> items;
|
|||||||
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
|
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
|
||||||
val_xfield(subscription_depth, [<<"all">>]) -> all;
|
val_xfield(subscription_depth, [<<"all">>]) -> all;
|
||||||
val_xfield(subscription_depth = Opt, [Depth]) ->
|
val_xfield(subscription_depth = Opt, [Depth]) ->
|
||||||
case catch jlib:binary_to_integer(Depth) of
|
case catch binary_to_integer(Depth) of
|
||||||
N when is_integer(N) -> N;
|
N when is_integer(N) -> N;
|
||||||
_ ->
|
_ ->
|
||||||
Txt = <<"Value of '~s' should be integer">>,
|
Txt = <<"Value of '~s' should be integer">>,
|
||||||
|
@ -168,7 +168,7 @@ var_xfield(_) -> {error, badarg}.
|
|||||||
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
||||||
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
|
||||||
val_xfield(digest_frequency = Opt, [Val]) ->
|
val_xfield(digest_frequency = Opt, [Val]) ->
|
||||||
case catch jlib:binary_to_integer(Val) of
|
case catch binary_to_integer(Val) of
|
||||||
N when is_integer(N) -> N;
|
N when is_integer(N) -> N;
|
||||||
_ ->
|
_ ->
|
||||||
Txt = <<"Value of '~s' should be integer">>,
|
Txt = <<"Value of '~s' should be integer">>,
|
||||||
@ -190,7 +190,7 @@ val_xfield(subscription_type, [<<"items">>]) -> items;
|
|||||||
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
|
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
|
||||||
val_xfield(subscription_depth, [<<"all">>]) -> all;
|
val_xfield(subscription_depth, [<<"all">>]) -> all;
|
||||||
val_xfield(subscription_depth = Opt, [Depth]) ->
|
val_xfield(subscription_depth = Opt, [Depth]) ->
|
||||||
case catch jlib:binary_to_integer(Depth) of
|
case catch binary_to_integer(Depth) of
|
||||||
N when is_integer(N) -> N;
|
N when is_integer(N) -> N;
|
||||||
_ ->
|
_ ->
|
||||||
Txt = <<"Value of '~s' should be integer">>,
|
Txt = <<"Value of '~s' should be integer">>,
|
||||||
|
@ -36,5 +36,5 @@ start() ->
|
|||||||
|
|
||||||
get_string() ->
|
get_string() ->
|
||||||
R = crypto:rand_uniform(0, 16#10000000000000000),
|
R = crypto:rand_uniform(0, 16#10000000000000000),
|
||||||
jlib:integer_to_binary(R).
|
integer_to_binary(R).
|
||||||
|
|
||||||
|
@ -6686,8 +6686,8 @@ enc_tzo({H, M}) ->
|
|||||||
|
|
||||||
dec_tzo(Val) ->
|
dec_tzo(Val) ->
|
||||||
[H1, M1] = str:tokens(Val, <<":">>),
|
[H1, M1] = str:tokens(Val, <<":">>),
|
||||||
H = jlib:binary_to_integer(H1),
|
H = binary_to_integer(H1),
|
||||||
M = jlib:binary_to_integer(M1),
|
M = binary_to_integer(M1),
|
||||||
if H >= -12, H =< 12, M >= 0, M < 60 -> {H, M} end.
|
if H >= -12, H =< 12, M >= 0, M < 60 -> {H, M} end.
|
||||||
|
|
||||||
decode_thumbnail(__TopXMLNS, __IgnoreEls,
|
decode_thumbnail(__TopXMLNS, __IgnoreEls,
|
||||||
|
@ -3390,8 +3390,8 @@
|
|||||||
-spec dec_tzo(_) -> {integer(), integer()}.
|
-spec dec_tzo(_) -> {integer(), integer()}.
|
||||||
dec_tzo(Val) ->
|
dec_tzo(Val) ->
|
||||||
[H1, M1] = str:tokens(Val, <<":">>),
|
[H1, M1] = str:tokens(Val, <<":">>),
|
||||||
H = jlib:binary_to_integer(H1),
|
H = binary_to_integer(H1),
|
||||||
M = jlib:binary_to_integer(M1),
|
M = binary_to_integer(M1),
|
||||||
if H >= -12, H =< 12, M >= 0, M < 60 ->
|
if H >= -12, H =< 12, M >= 0, M < 60 ->
|
||||||
{H, M}
|
{H, M}
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user