diff --git a/mod_statsdx/src/mod_stats2file.erl b/mod_statsdx/src/mod_stats2file.erl
index 3733361..f850728 100644
--- a/mod_statsdx/src/mod_stats2file.erl
+++ b/mod_statsdx/src/mod_stats2file.erl
@@ -27,18 +27,18 @@
start(_Host, Opts) ->
case whereis(?PROCNAME) of
undefined ->
- Interval = gen_mod:get_opt(interval, Opts, 5),
+ Interval = gen_mod:get_opt(interval, Opts, fun(O) -> O end, 5),
I = Interval*60*1000,
%I = 9000, %+++
- Type = gen_mod:get_opt(type, Opts, html),
+ Type = gen_mod:get_opt(type, Opts, fun(O) -> O end, html),
- Split = gen_mod:get_opt(split, Opts, false),
+ Split = gen_mod:get_opt(split, Opts, fun(O) -> O end, false),
- BaseFilename = gen_mod:get_opt(basefilename, Opts, "/tmp/ejasta"),
+ BaseFilename = binary_to_list(gen_mod:get_opt(basefilename, Opts, fun(O) -> O end, "/tmp/ejasta")),
- Hosts_all = ejabberd_config:get_global_option(hosts),
- Hosts = gen_mod:get_opt(hosts, Opts, Hosts_all),
+ Hosts_all = ejabberd_config:get_global_option(hosts, fun(O) -> O end),
+ Hosts = gen_mod:get_opt(hosts, Opts, fun(O) -> O end, Hosts_all),
register(?PROCNAME, spawn(?MODULE, loop, [I, Hosts, BaseFilename, Type, Split]));
_ ->
@@ -215,7 +215,7 @@ write_stats(I, node, Node, F, T) ->
fwbr(F, T),
CPUTime = element(1, rpc:call(Node, erlang, statistics, [runtime])),
- fw(F, "~s (ms): ~w",[?T("CPUtime"), CPUTime]),
+ fw(F, "~s (ms): ~w",["CPUtime", CPUTime]),
fwbr(F, T),
MT = trunc(erlang:memory(total)/1024),
@@ -362,12 +362,12 @@ get(Node, A) ->
fw(F, S) -> file:write(F, S).
fw(F, S, O) -> file:write(F, io_lib:format(S, O)).
-fwt(F, S, O, html) -> fw(F, "~s: ~p
~n",[?T(S), O]);
-fwt(F, S, O, txt) -> fw(F, "~s: ~p~n",[?T(S), O]);
+fwt(F, S, O, html) -> fw(F, "~s: ~p
~n",[S, O]);
+fwt(F, S, O, txt) -> fw(F, "~s: ~p~n",[S, O]);
fwt(F, _, O, dat) -> fw(F, "~p~n",[O]).
-fwts(F, S, O, html) -> fw(F, "~s: ~s
~n",[?T(S), O]);
-fwts(F, S, O, txt) -> fw(F, "~s: ~s~n",[?T(S), O]);
+fwts(F, S, O, html) -> fw(F, "~s: ~s
~n",[S, O]);
+fwts(F, S, O, txt) -> fw(F, "~s: ~s~n",[S, O]);
fwts(F, _, O, dat) -> fw(F, "~s~n",[O]).
%fwtsn(F, S, O, html) -> fw(F, "~s: ~s
",[?T(S), O]);
diff --git a/mod_statsdx/src/mod_statsdx.erl b/mod_statsdx/src/mod_statsdx.erl
index 3b5422c..7d0927f 100644
--- a/mod_statsdx/src/mod_statsdx.erl
+++ b/mod_statsdx/src/mod_statsdx.erl
@@ -221,7 +221,7 @@ remove_user(_User, Server) ->
user_send_packet(FromJID, ToJID, NewEl) ->
%% Registrarse para tramitar Host/mod_stats2file
- case list_to_atom(ToJID#jid.lresource) of
+ case list_to_atom(binary_to_list(ToJID#jid.lresource)) of
?MODULE -> received_response(FromJID, ToJID, NewEl);
_ -> ok
end.
@@ -618,7 +618,9 @@ get_s2sconnections(Host) ->
%% {Host, Res} = ets:foldl(F2, {Host, 0}, irc_connection),
%% Res.
-is_host(Host, Subhost) ->
+is_host(HostBin, SubhostBin) ->
+ Host = binary_to_list(HostBin),
+ Subhost = binary_to_list(SubhostBin),
Pos = string:len(Host)-string:len(Subhost)+1,
case string:rstr(Host, Subhost) of
Pos -> true;
@@ -763,15 +765,15 @@ user_logout(User, Host, Resource, _Status) ->
end.
request_iqversion(User, Host, Resource) ->
- From = jlib:make_jid("", Host, atom_to_list(?MODULE)),
+ From = jlib:make_jid(<<"">>, Host, list_to_binary(atom_to_list(?MODULE))),
FromStr = jlib:jid_to_string(From),
To = jlib:make_jid(User, Host, Resource),
ToStr = jlib:jid_to_string(To),
- Packet = {xmlelement,"iq",
- [{"from",FromStr}, {"to",ToStr}, {"type","get"},
- {"id", "statsdx" ++ randoms:get_string()}],
- [{xmlelement, "query",
- [{"xmlns","jabber:iq:version"}], []}]},
+ Packet = {xmlel,<<"iq">>,
+ [{<<"from">>,FromStr}, {<<"to">>,ToStr}, {<<"type">>,<<"get">>},
+ {<<"id">>, list_to_binary("statsdx"++randoms:get_string())}],
+ [{xmlel, <<"query">>,
+ [{<<"xmlns">>,<<"jabber:iq:version">>}], []}]},
ejabberd_local:route(From, To, Packet).
%% cuando el virtualJID recibe una respuesta iqversion,