More fixes to work with ejabberd 14
This commit is contained in:
parent
5eafb8188a
commit
bdac50591a
|
@ -230,7 +230,7 @@ user_send_packet_traffic(FromJID, ToJID, NewEl) ->
|
||||||
%% Only required for traffic stats
|
%% Only required for traffic stats
|
||||||
Host = FromJID#jid.lserver,
|
Host = FromJID#jid.lserver,
|
||||||
HostTo = ToJID#jid.lserver,
|
HostTo = ToJID#jid.lserver,
|
||||||
{xmlelement, Type, _, _} = NewEl,
|
{xmlel, Type, _, _} = NewEl,
|
||||||
Type2 = case Type of
|
Type2 = case Type of
|
||||||
"iq" -> iq;
|
"iq" -> iq;
|
||||||
"message" -> message;
|
"message" -> message;
|
||||||
|
@ -247,7 +247,7 @@ user_send_packet_traffic(FromJID, ToJID, NewEl) ->
|
||||||
user_receive_packet_traffic(_JID, From, To, FixedPacket) ->
|
user_receive_packet_traffic(_JID, From, To, FixedPacket) ->
|
||||||
HostFrom = From#jid.lserver,
|
HostFrom = From#jid.lserver,
|
||||||
Host = To#jid.lserver,
|
Host = To#jid.lserver,
|
||||||
{xmlelement, Type, _, _} = FixedPacket,
|
{xmlel, Type, _, _} = FixedPacket,
|
||||||
Type2 = case Type of
|
Type2 = case Type of
|
||||||
"iq" -> iq;
|
"iq" -> iq;
|
||||||
"message" -> message;
|
"message" -> message;
|
||||||
|
@ -783,15 +783,15 @@ received_response(From, _To, El) ->
|
||||||
catch
|
catch
|
||||||
_:_ -> ok
|
_:_ -> ok
|
||||||
end.
|
end.
|
||||||
received_response(From, {xmlelement, "iq", Attrs, Elc}) ->
|
received_response(From, {xmlel, <<"iq">>, Attrs, Elc}) ->
|
||||||
User = From#jid.luser,
|
User = From#jid.luser,
|
||||||
Host = From#jid.lserver,
|
Host = From#jid.lserver,
|
||||||
Resource = From#jid.lresource,
|
Resource = From#jid.lresource,
|
||||||
|
|
||||||
"result" = xml:get_attr_s("type", Attrs),
|
<<"result">> = xml:get_attr_s(<<"type">>, Attrs),
|
||||||
Lang = case xml:get_attr_s("xml:lang", Attrs) of
|
Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of
|
||||||
[] -> "unknown";
|
[] -> "unknown";
|
||||||
L -> L
|
L -> binary_to_list(L)
|
||||||
end,
|
end,
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name("server"),
|
||||||
|
@ -799,11 +799,11 @@ received_response(From, {xmlelement, "iq", Attrs, Elc}) ->
|
||||||
update_counter_create(TableServer, {lang, server, Lang}, 1),
|
update_counter_create(TableServer, {lang, server, Lang}, 1),
|
||||||
|
|
||||||
[El] = xml:remove_cdata(Elc),
|
[El] = xml:remove_cdata(Elc),
|
||||||
{xmlelement, _, Attrs2, _Els2} = El,
|
{xmlel, _, Attrs2, _Els2} = El,
|
||||||
?NS_VERSION = xml:get_attr_s("xmlns", Attrs2),
|
?NS_VERSION = xml:get_attr_s(<<"xmlns">>, Attrs2),
|
||||||
|
|
||||||
Client = get_tag_cdata_subtag(El, "name"),
|
Client = get_tag_cdata_subtag(El, <<"name">>),
|
||||||
Version = get_tag_cdata_subtag(El, "version"),
|
Version = get_tag_cdata_subtag(El, <<"version">>),
|
||||||
OS = get_tag_cdata_subtag(El, "os"),
|
OS = get_tag_cdata_subtag(El, "os"),
|
||||||
{Client_id, OS_id} = identify(Client, OS),
|
{Client_id, OS_id} = identify(Client, OS),
|
||||||
|
|
||||||
|
@ -838,8 +838,8 @@ update_counter_create(Table, Element, C) ->
|
||||||
get_tag_cdata_subtag(E, T) ->
|
get_tag_cdata_subtag(E, T) ->
|
||||||
E2 = xml:get_subtag(E, T),
|
E2 = xml:get_subtag(E, T),
|
||||||
case E2 of
|
case E2 of
|
||||||
false -> <<"unknown">>;
|
false -> "unknown";
|
||||||
_ -> xml:get_tag_cdata(E2)
|
_ -> binary_to_list(xml:get_tag_cdata(E2))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
list_elem(Type, id) ->
|
list_elem(Type, id) ->
|
||||||
|
@ -915,7 +915,7 @@ get_client_os(Server) ->
|
||||||
CO1 = ets:match(table_name(Server), {{client_os, Server, '$1', '$2'}, '$3'}),
|
CO1 = ets:match(table_name(Server), {{client_os, Server, '$1', '$2'}, '$3'}),
|
||||||
CO2 = lists:map(
|
CO2 = lists:map(
|
||||||
fun([Cl, Os, A3]) ->
|
fun([Cl, Os, A3]) ->
|
||||||
{list_to_binary(lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)])), A3}
|
{lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)]), A3}
|
||||||
end,
|
end,
|
||||||
CO1
|
CO1
|
||||||
),
|
),
|
||||||
|
@ -925,7 +925,7 @@ get_client_conntype(Server) ->
|
||||||
CO1 = ets:match(table_name(Server), {{client_conntype, Server, '$1', '$2'}, '$3'}),
|
CO1 = ets:match(table_name(Server), {{client_conntype, Server, '$1', '$2'}, '$3'}),
|
||||||
CO2 = lists:map(
|
CO2 = lists:map(
|
||||||
fun([Cl, Os, A3]) ->
|
fun([Cl, Os, A3]) ->
|
||||||
{list_to_binary(lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)])), A3}
|
{lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)]), A3}
|
||||||
end,
|
end,
|
||||||
CO1
|
CO1
|
||||||
),
|
),
|
||||||
|
@ -1505,15 +1505,16 @@ do_sessions_table(_Node, _Lang, Filter, {Sort_direction, Sort_column}, Host) ->
|
||||||
Sessions = get_sessions_filtered(Filter, Host),
|
Sessions = get_sessions_filtered(Filter, Host),
|
||||||
SessionsSorted = sort_sessions(Sort_direction, Sort_column, Sessions),
|
SessionsSorted = sort_sessions(Sort_direction, Sort_column, Sessions),
|
||||||
lists:map(
|
lists:map(
|
||||||
fun( {{session, JID}, Client_id, OS_id, Lang, ConnType, Client, Version, OS} ) ->
|
fun( {{session, JID}, Client_id, OS_id, LangS, ConnType, Client, Version, OS} ) ->
|
||||||
User = JID#jid.luser,
|
Lang = list_to_binary(LangS),
|
||||||
Server = JID#jid.lserver,
|
User = binary_to_list(JID#jid.luser),
|
||||||
|
Server = binary_to_list(JID#jid.lserver),
|
||||||
UserURL = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
UserURL = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
||||||
?XE("tr", [
|
?XE("tr", [
|
||||||
?XE(<<"td">>, [?AC(UserURL, jlib:jid_to_string(JID))]),
|
?XE(<<"td">>, [?AC(list_to_binary(UserURL), jlib:jid_to_string(JID))]),
|
||||||
?XCTB("td", atom_to_list(Client_id)),
|
?XCTB("td", atom_to_list(Client_id)),
|
||||||
?XCTB("td", atom_to_list(OS_id)),
|
?XCTB("td", atom_to_list(OS_id)),
|
||||||
?XCTB("td", Lang),
|
?XCTB("td", LangS),
|
||||||
?XCTB("td", atom_to_list(ConnType)),
|
?XCTB("td", atom_to_list(ConnType)),
|
||||||
?XCTB("td", Client),
|
?XCTB("td", Client),
|
||||||
?XCTB("td", Version),
|
?XCTB("td", Version),
|
||||||
|
@ -1544,12 +1545,12 @@ get_sessions_filtered(Filter, server) ->
|
||||||
?MYHOSTS);
|
?MYHOSTS);
|
||||||
get_sessions_filtered(Filter, Host) ->
|
get_sessions_filtered(Filter, Host) ->
|
||||||
Match = case Filter of
|
Match = case Filter of
|
||||||
[{"client", Client}] -> {{session, '$1'}, list_to_atom(Client), '$2', '$3', '$4', '$5', '$6', '$7'};
|
[{<<"client">>, Client}] -> {{session, '$1'}, list_to_atom(binary_to_list(Client)), '$2', '$3', '$4', '$5', '$6', '$7'};
|
||||||
[{"os", OS}] -> {{session, '$1'}, '$2', list_to_atom(OS), '$3', '$4', '$5', '$6', '$7'};
|
[{<<"os">>, OS}] -> {{session, '$1'}, '$2', list_to_atom(binary_to_list(OS)), '$3', '$4', '$5', '$6', '$7'};
|
||||||
[{"conntype", ConnType}] -> {{session, '$1'}, '$2', '$3', '$4', list_to_atom(ConnType), '$5', '$6', '$7'};
|
[{<<"conntype">>, ConnType}] -> {{session, '$1'}, '$2', '$3', '$4', list_to_atom(binary_to_list(ConnType)), '$5', '$6', '$7'};
|
||||||
[{"languages", Lang}] -> {{session, '$1'}, '$2', '$3', Lang, '$4', '$5', '$6', '$7'};
|
[{<<"languages">>, Lang}] -> {{session, '$1'}, '$2', '$3', binary_to_list(Lang), '$4', '$5', '$6', '$7'};
|
||||||
[{"client", Client}, {"os", OS}] -> {{session, '$1'}, list_to_atom(Client), list_to_atom(OS), '$3', '$4', '$5', '$6', '$7'};
|
[{<<"client">>, Client}, {<<"os">>, OS}] -> {{session, '$1'}, list_to_atom(binary_to_list(Client)), list_to_atom(binary_to_list(OS)), '$3', '$4', '$5', '$6', '$7'};
|
||||||
[{"client", Client}, {"conntype", ConnType}] -> {{session, '$1'}, list_to_atom(Client), '$2', '$3', list_to_atom(ConnType), '$5', '$6', '$7'};
|
[{<<"client">>, Client}, {<<"conntype">>, ConnType}] -> {{session, '$1'}, list_to_atom(binary_to_list(Client)), '$2', '$3', list_to_atom(binary_to_list(ConnType)), '$5', '$6', '$7'};
|
||||||
_ -> {{session, '$1'}, '$2', '$3', '$4', '$5'}
|
_ -> {{session, '$1'}, '$2', '$3', '$4', '$5'}
|
||||||
end,
|
end,
|
||||||
ets:match_object(table_name(Host), Match).
|
ets:match_object(table_name(Host), Match).
|
||||||
|
|
Loading…
Reference in New Issue