25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-06 16:42:56 +01:00

Switch to Fast XML module

This commit is contained in:
Mickael Remond 2016-02-03 19:03:17 +01:00
parent 5539db37b6
commit dfc29ea03c
63 changed files with 635 additions and 635 deletions

View File

@ -20,9 +20,9 @@
-include("ns.hrl").
-ifdef(NO_EXT_LIB).
-include("xml.hrl").
-include("fxml.hrl").
-else.
-include_lib("p1_xml/include/xml.hrl").
-include_lib("fast_xml/include/fxml.hrl").
-endif.
-define(STANZA_ERROR(Code, Type, Condition),

View File

@ -25,7 +25,7 @@ defmodule Ejabberd.Mixfile do
[mod: {:ejabberd_app, []},
applications: [:ssl],
included_applications: [:lager, :mnesia, :p1_utils, :cache_tab,
:fast_tls, :stringprep, :p1_xml,
:fast_tls, :stringprep, :fast_xml,
:stun, :fast_yaml, :ezlib, :iconv,
:esip, :jiffy, :p1_oauth2, :p1_xmlrpc, :eredis,
:p1_mysql, :p1_pgsql, :sqlite3]]
@ -39,12 +39,12 @@ defmodule Ejabberd.Mixfile do
defp deps do
[{:lager, "~> 3.0"},
{:p1_utils, "~> 1.0", override: true},
{:p1_utils, "~> 1.0"},
{:cache_tab, "~> 1.0"},
{:stringprep, "~> 1.0"},
{:fast_yaml, "~> 1.0"},
{:fast_tls, "~> 1.0"},
{:p1_xml, git: "https://github.com/processone/xml", tag: "1.1.2"},
{:fast_xml, "~> 1.1"},
{:stun, "~> 1.0"},
{:esip, "~> 1.0"},
{:jiffy, "~> 0.14.7"},

View File

@ -6,6 +6,7 @@
"exrm": {:hex, :exrm, "1.0.0-rc7"},
"ezlib": {:hex, :ezlib, "1.0.1"},
"fast_tls": {:hex, :fast_tls, "1.0.1"},
"fast_xml": {:hex, :fast_xml, "1.1.3"},
"fast_yaml": {:hex, :fast_yaml, "1.0.2"},
"getopt": {:hex, :getopt, "0.8.2"},
"goldrush": {:hex, :goldrush, "0.1.7"},
@ -16,7 +17,6 @@
"p1_oauth2": {:hex, :p1_oauth2, "0.6.1"},
"p1_pgsql": {:hex, :p1_pgsql, "1.0.1"},
"p1_utils": {:hex, :p1_utils, "1.0.3"},
"p1_xml": {:git, "https://github.com/processone/xml", "79c6d54e56bf991f1ec70ceb5e255afcb8dbf53f", [tag: "1.1.2"]},
"p1_xmlrpc": {:hex, :p1_xmlrpc, "1.15.1"},
"providers": {:hex, :providers, "1.4.1"},
"relx": {:hex, :relx, "3.5.0"},

View File

@ -12,7 +12,7 @@
{cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.2"}}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.1"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.2"}}},
{p1_xml, ".*", {git, "https://github.com/processone/xml", {tag, "1.1.2"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.3"}}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.1"}}},
{esip, ".*", {git, "https://github.com/processone/esip", "1.0.2"}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.2"}}},
@ -38,7 +38,7 @@
{floating_deps, [cache_tab,
fast_tls,
stringprep,
p1_xml,
fast_xml,
esip,
luerl,
stun,
@ -97,7 +97,7 @@
{"stringprep", []},
{"fast_yaml", []},
{"esip", []},
{"p1_xml", [{if_var_true, full_xml, "--enable-full-xml"}]},
{"fast_xml", [{if_var_true, full_xml, "--enable-full-xml"}]},
{if_var_true, pam, {"p1_pam", []}},
{if_var_true, zlib, {"ezlib", []}},
{if_var_true, iconv, {"iconv", []}}]}.

View File

@ -51,9 +51,9 @@
parse_request(#iq{type = set, lang = Lang, sub_el = SubEl, xmlns = ?NS_COMMANDS}) ->
?DEBUG("entering parse_request...", []),
Node = xml:get_tag_attr_s(<<"node">>, SubEl),
SessionID = xml:get_tag_attr_s(<<"sessionid">>, SubEl),
Action = xml:get_tag_attr_s(<<"action">>, SubEl),
Node = fxml:get_tag_attr_s(<<"node">>, SubEl),
SessionID = fxml:get_tag_attr_s(<<"sessionid">>, SubEl),
Action = fxml:get_tag_attr_s(<<"action">>, SubEl),
XData = find_xdata_el(SubEl),
#xmlel{children = AllEls} = SubEl,
Others = case XData of
@ -76,7 +76,7 @@ find_xdata_el(#xmlel{children = SubEls}) ->
find_xdata_el1([]) -> false;
find_xdata_el1([El | Els]) when is_record(El, xmlel) ->
case xml:get_tag_attr_s(<<"xmlns">>, El) of
case fxml:get_tag_attr_s(<<"xmlns">>, El) of
?NS_XDATA -> El;
_ -> find_xdata_el1(Els)
end;

View File

@ -111,12 +111,12 @@ register_mechanism(Mechanism, Module, PasswordType) ->
%%-include("ejabberd.hrl").
%%-include("jlib.hrl").
%%check_authzid(_State, Props) ->
%% AuthzId = xml:get_attr_s(authzid, Props),
%% AuthzId = fxml:get_attr_s(authzid, Props),
%% case jid:from_string(AuthzId) of
%% error ->
%% {error, "invalid-authzid"};
%% JID ->
%% LUser = jid:nodeprep(xml:get_attr_s(username, Props)),
%% LUser = jid:nodeprep(fxml:get_attr_s(username, Props)),
%% {U, S, R} = jid:tolower(JID),
%% case R of
%% "" ->

View File

@ -83,9 +83,9 @@ mech_step(#state{step = 3, nonce = Nonce} = State,
bad -> {error, <<"bad-protocol">>};
KeyVals ->
DigestURI = proplists:get_value(<<"digest-uri">>, KeyVals, <<>>),
%DigestURI = xml:get_attr_s(<<"digest-uri">>, KeyVals),
%DigestURI = fxml:get_attr_s(<<"digest-uri">>, KeyVals),
UserName = proplists:get_value(<<"username">>, KeyVals, <<>>),
%UserName = xml:get_attr_s(<<"username">>, KeyVals),
%UserName = fxml:get_attr_s(<<"username">>, KeyVals),
case is_digesturi_valid(DigestURI, State#state.host,
State#state.hostfqdn)
of
@ -97,13 +97,13 @@ mech_step(#state{step = 3, nonce = Nonce} = State,
{error, <<"not-authorized">>, UserName};
true ->
AuthzId = proplists:get_value(<<"authzid">>, KeyVals, <<>>),
%AuthzId = xml:get_attr_s(<<"authzid">>, KeyVals),
%AuthzId = fxml:get_attr_s(<<"authzid">>, KeyVals),
case (State#state.get_password)(UserName) of
{false, _} -> {error, <<"not-authorized">>, UserName};
{Passwd, AuthModule} ->
case (State#state.check_password)(UserName, <<"">>,
proplists:get_value(<<"response">>, KeyVals, <<>>),
%xml:get_attr_s(<<"response">>, KeyVals),
%fxml:get_attr_s(<<"response">>, KeyVals),
fun (PW) ->
response(KeyVals,
UserName,

View File

@ -254,7 +254,7 @@ start_apps() ->
ejabberd:start_app(ssl),
ejabberd:start_app(fast_yaml),
ejabberd:start_app(fast_tls),
ejabberd:start_app(p1_xml),
ejabberd:start_app(fast_xml),
ejabberd:start_app(stringprep),
ejabberd:start_app(ezlib),
ejabberd:start_app(cache_tab).

View File

@ -342,15 +342,15 @@ get_subscribed(FsmRef) ->
wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
DefaultLang = ?MYLANG,
case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of
case fxml:get_attr_s(<<"xmlns:stream">>, Attrs) of
?NS_STREAM ->
Server =
case StateData#state.server of
<<"">> ->
jid:nameprep(xml:get_attr_s(<<"to">>, Attrs));
jid:nameprep(fxml:get_attr_s(<<"to">>, Attrs));
S -> S
end,
Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of
Lang = case fxml:get_attr_s(<<"xml:lang">>, Attrs) of
Lang1 when byte_size(Lang1) =< 35 ->
%% As stated in BCP47, 4.4.1:
%% Protocols or specifications that
@ -367,7 +367,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
case lists:member(Server, ?MYHOSTS) of
true when IsBlacklistedIP == false ->
change_shaper(StateData, jid:make(<<"">>, Server, <<"">>)),
case xml:get_attr_s(<<"version">>, Attrs) of
case fxml:get_attr_s(<<"version">>, Attrs) of
<<"1.0">> ->
send_header(StateData, Server, <<"1.0">>, DefaultLang),
case StateData#state.authenticated of
@ -724,19 +724,19 @@ wait_for_feature_request({xmlstreamelement, El},
TLSRequired = StateData#state.tls_required,
SockMod =
(StateData#state.sockmod):get_sockmod(StateData#state.socket),
case {xml:get_attr_s(<<"xmlns">>, Attrs), Name} of
case {fxml:get_attr_s(<<"xmlns">>, Attrs), Name} of
{?NS_SASL, <<"auth">>}
when TLSEnabled or not TLSRequired ->
Mech = xml:get_attr_s(<<"mechanism">>, Attrs),
ClientIn = jlib:decode_base64(xml:get_cdata(Els)),
Mech = fxml:get_attr_s(<<"mechanism">>, Attrs),
ClientIn = jlib:decode_base64(fxml:get_cdata(Els)),
case cyrsasl:server_start(StateData#state.sasl_state,
Mech, ClientIn)
of
{ok, Props} ->
(StateData#state.sockmod):reset_stream(StateData#state.socket),
%U = xml:get_attr_s(username, Props),
%U = fxml:get_attr_s(username, Props),
U = proplists:get_value(username, Props, <<>>),
%AuthModule = xml:get_attr_s(auth_module, Props),
%AuthModule = fxml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, undefined),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p from ~s",
@ -802,7 +802,7 @@ wait_for_feature_request({xmlstreamelement, El},
StateData#state.tls_options)]
end,
Socket = StateData#state.socket,
BProceed = xml:element_to_binary(#xmlel{name = <<"proceed">>,
BProceed = fxml:element_to_binary(#xmlel{name = <<"proceed">>,
attrs = [{<<"xmlns">>, ?NS_TLS}]}),
TLSSocket = (StateData#state.sockmod):starttls(Socket,
TLSOpts,
@ -814,7 +814,7 @@ wait_for_feature_request({xmlstreamelement, El},
{?NS_COMPRESS, <<"compress">>}
when Zlib == true,
(SockMod == gen_tcp) or (SockMod == fast_tls) ->
case xml:get_subtag(El, <<"method">>) of
case fxml:get_subtag(El, <<"method">>) of
false ->
send_element(StateData,
#xmlel{name = <<"failure">>,
@ -824,10 +824,10 @@ wait_for_feature_request({xmlstreamelement, El},
attrs = [], children = []}]}),
fsm_next_state(wait_for_feature_request, StateData);
Method ->
case xml:get_tag_cdata(Method) of
case fxml:get_tag_cdata(Method) of
<<"zlib">> ->
Socket = StateData#state.socket,
BCompressed = xml:element_to_binary(#xmlel{name = <<"compressed">>,
BCompressed = fxml:element_to_binary(#xmlel{name = <<"compressed">>,
attrs = [{<<"xmlns">>, ?NS_COMPRESS}]}),
ZlibSocket = (StateData#state.sockmod):compress(Socket,
BCompressed),
@ -880,18 +880,18 @@ wait_for_sasl_response({xmlstreamelement, #xmlel{name = Name} = El}, StateData)
wait_for_sasl_response({xmlstreamelement, El},
StateData) ->
#xmlel{name = Name, attrs = Attrs, children = Els} = El,
case {xml:get_attr_s(<<"xmlns">>, Attrs), Name} of
case {fxml:get_attr_s(<<"xmlns">>, Attrs), Name} of
{?NS_SASL, <<"response">>} ->
ClientIn = jlib:decode_base64(xml:get_cdata(Els)),
ClientIn = jlib:decode_base64(fxml:get_cdata(Els)),
case cyrsasl:server_step(StateData#state.sasl_state,
ClientIn)
of
{ok, Props} ->
catch
(StateData#state.sockmod):reset_stream(StateData#state.socket),
% U = xml:get_attr_s(username, Props),
% U = fxml:get_attr_s(username, Props),
U = proplists:get_value(username, Props, <<>>),
% AuthModule = xml:get_attr_s(auth_module, Props),
% AuthModule = fxml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, <<>>),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p from ~s",
@ -912,9 +912,9 @@ wait_for_sasl_response({xmlstreamelement, El},
user = U});
{ok, Props, ServerOut} ->
(StateData#state.sockmod):reset_stream(StateData#state.socket),
% U = xml:get_attr_s(username, Props),
% U = fxml:get_attr_s(username, Props),
U = proplists:get_value(username, Props, <<>>),
% AuthModule = xml:get_attr_s(auth_module, Props),
% AuthModule = fxml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, undefined),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p from ~s",
@ -1035,7 +1035,7 @@ wait_for_bind({xmlstreamelement, El}, StateData) ->
#iq{type = set, xmlns = ?NS_BIND, sub_el = SubEl} =
IQ ->
U = StateData#state.user,
R1 = xml:get_path_s(SubEl,
R1 = fxml:get_path_s(SubEl,
[{elem, <<"resource">>}, cdata]),
R = case jid:resourceprep(R1) of
error -> error;
@ -1207,24 +1207,24 @@ session_established2(El, StateData) ->
User = NewStateData#state.user,
Server = NewStateData#state.server,
FromJID = NewStateData#state.jid,
To = xml:get_attr_s(<<"to">>, Attrs),
To = fxml:get_attr_s(<<"to">>, Attrs),
ToJID = case To of
<<"">> -> jid:make(User, Server, <<"">>);
_ -> jid:from_string(To)
end,
NewEl1 = jlib:remove_attr(<<"xmlns">>, El),
NewEl = case xml:get_attr_s(<<"xml:lang">>, Attrs) of
NewEl = case fxml:get_attr_s(<<"xml:lang">>, Attrs) of
<<"">> ->
case NewStateData#state.lang of
<<"">> -> NewEl1;
Lang ->
xml:replace_tag_attr(<<"xml:lang">>, Lang, NewEl1)
fxml:replace_tag_attr(<<"xml:lang">>, Lang, NewEl1)
end;
_ -> NewEl1
end,
NewState = case ToJID of
error ->
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"error">> -> NewStateData;
<<"result">> -> NewStateData;
_ ->
@ -1408,7 +1408,7 @@ handle_info({route, From, To,
StateData,
[{From, To,
Packet}]),
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"probe">> ->
LFrom = jid:tolower(From),
LBFrom =
@ -1625,7 +1625,7 @@ handle_info({route, From, To,
allow ->
{true, Attrs, StateData};
deny ->
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"error">> -> ok;
<<"groupchat">> -> ok;
<<"headline">> -> ok;
@ -1844,7 +1844,7 @@ send_element(StateData, El) when StateData#state.xml_socket ->
(StateData#state.sockmod):send_xml(StateData#state.socket,
{xmlstreamelement, El});
send_element(StateData, El) ->
send_text(StateData, xml:element_to_binary(El)).
send_text(StateData, fxml:element_to_binary(El)).
send_stanza(StateData, Stanza) when StateData#state.csi_state == inactive ->
csi_filter_stanza(StateData, Stanza);
@ -1924,7 +1924,7 @@ is_auth_packet(El) ->
is_stanza(#xmlel{name = Name, attrs = Attrs}) when Name == <<"message">>;
Name == <<"presence">>;
Name == <<"iq">> ->
case xml:get_attr(<<"xmlns">>, Attrs) of
case fxml:get_attr(<<"xmlns">>, Attrs) of
{value, NS} when NS /= <<"jabber:client">>,
NS /= <<"jabber:server">> ->
false;
@ -1936,7 +1936,7 @@ is_stanza(_El) ->
get_auth_tags([#xmlel{name = Name, children = Els} | L],
U, P, D, R) ->
CData = xml:get_cdata(Els),
CData = fxml:get_cdata(Els),
case Name of
<<"username">> -> get_auth_tags(L, CData, P, D, R);
<<"password">> -> get_auth_tags(L, U, CData, D, R);
@ -2003,11 +2003,11 @@ process_presence_probe(From, To, StateData) ->
%% User updates his presence (non-directed presence packet)
presence_update(From, Packet, StateData) ->
#xmlel{attrs = Attrs} = Packet,
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"unavailable">> ->
Status = case xml:get_subtag(Packet, <<"status">>) of
Status = case fxml:get_subtag(Packet, <<"status">>) of
false -> <<"">>;
StatusTag -> xml:get_tag_cdata(StatusTag)
StatusTag -> fxml:get_tag_cdata(StatusTag)
end,
Info = [{ip, StateData#state.ip},
{conn, StateData#state.conn},
@ -2068,7 +2068,7 @@ presence_track(From, To, Packet, StateData) ->
LTo = jid:tolower(To),
User = StateData#state.user,
Server = StateData#state.server,
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"unavailable">> ->
A = remove_element(LTo, StateData#state.pres_a),
check_privacy_route(From, StateData#state{pres_a = A}, From, To, Packet);
@ -2265,11 +2265,11 @@ update_priority(Priority, Packet, StateData) ->
StateData#state.resource, Priority, Packet, Info).
get_priority_from_presence(PresencePacket) ->
case xml:get_subtag(PresencePacket, <<"priority">>) of
case fxml:get_subtag(PresencePacket, <<"priority">>) of
false -> 0;
SubEl ->
case catch
jlib:binary_to_integer(xml:get_tag_cdata(SubEl))
jlib:binary_to_integer(fxml:get_tag_cdata(SubEl))
of
P when is_integer(P) -> P;
_ -> 0
@ -2346,21 +2346,21 @@ resend_subscription_requests(#state{user = User,
get_showtag(undefined) -> <<"unavailable">>;
get_showtag(Presence) ->
case xml:get_path_s(Presence, [{elem, <<"show">>}, cdata]) of
case fxml:get_path_s(Presence, [{elem, <<"show">>}, cdata]) of
<<"">> -> <<"available">>;
ShowTag -> ShowTag
end.
get_statustag(undefined) -> <<"">>;
get_statustag(Presence) ->
xml:get_path_s(Presence, [{elem, <<"status">>}, cdata]).
fxml:get_path_s(Presence, [{elem, <<"status">>}, cdata]).
process_unauthenticated_stanza(StateData, El) ->
NewEl = case xml:get_tag_attr_s(<<"xml:lang">>, El) of
NewEl = case fxml:get_tag_attr_s(<<"xml:lang">>, El) of
<<"">> ->
case StateData#state.lang of
<<"">> -> El;
Lang -> xml:replace_tag_attr(<<"xml:lang">>, Lang, El)
Lang -> fxml:replace_tag_attr(<<"xml:lang">>, Lang, El)
end;
_ -> El
end,
@ -2462,7 +2462,7 @@ is_ip_blacklisted({IP, _Port}, Lang) ->
%% Check from attributes
%% returns invalid-from|NewElement
check_from(El, FromJID) ->
case xml:get_tag_attr(<<"from">>, El) of
case fxml:get_tag_attr(<<"from">>, El) of
false ->
El;
{value, SJID} ->
@ -2573,7 +2573,7 @@ negotiate_stream_mgmt(_El, #state{resource = <<"">>} = StateData) ->
send_element(StateData, ?MGMT_UNEXPECTED_REQUEST(?NS_STREAM_MGMT_3)),
StateData;
negotiate_stream_mgmt(#xmlel{name = Name, attrs = Attrs}, StateData) ->
case xml:get_attr_s(<<"xmlns">>, Attrs) of
case fxml:get_attr_s(<<"xmlns">>, Attrs) of
Xmlns when ?IS_SUPPORTED_MGMT_XMLNS(Xmlns) ->
case stream_mgmt_enabled(StateData) of
true ->
@ -2601,7 +2601,7 @@ negotiate_stream_mgmt(#xmlel{name = Name, attrs = Attrs}, StateData) ->
end.
perform_stream_mgmt(#xmlel{name = Name, attrs = Attrs}, StateData) ->
case xml:get_attr_s(<<"xmlns">>, Attrs) of
case fxml:get_attr_s(<<"xmlns">>, Attrs) of
Xmlns when Xmlns == StateData#state.mgmt_xmlns ->
case Name of
<<"r">> ->
@ -2626,10 +2626,10 @@ perform_stream_mgmt(#xmlel{name = Name, attrs = Attrs}, StateData) ->
handle_enable(#state{mgmt_timeout = DefaultTimeout,
mgmt_max_timeout = MaxTimeout} = StateData, Attrs) ->
Timeout = case xml:get_attr_s(<<"resume">>, Attrs) of
Timeout = case fxml:get_attr_s(<<"resume">>, Attrs) of
ResumeAttr when ResumeAttr == <<"true">>;
ResumeAttr == <<"1">> ->
MaxAttr = xml:get_attr_s(<<"max">>, Attrs),
MaxAttr = fxml:get_attr_s(<<"max">>, Attrs),
case catch jlib:binary_to_integer(MaxAttr) of
Max when is_integer(Max), Max > 0, Max =< MaxTimeout ->
Max;
@ -2669,7 +2669,7 @@ handle_r(StateData) ->
StateData.
handle_a(StateData, Attrs) ->
case catch jlib:binary_to_integer(xml:get_attr_s(<<"h">>, Attrs)) of
case catch jlib:binary_to_integer(fxml:get_attr_s(<<"h">>, Attrs)) of
H when is_integer(H), H >= 0 ->
check_h_attribute(StateData, H);
_ ->
@ -2679,12 +2679,12 @@ handle_a(StateData, Attrs) ->
end.
handle_resume(StateData, Attrs) ->
R = case xml:get_attr_s(<<"xmlns">>, Attrs) of
R = case fxml:get_attr_s(<<"xmlns">>, Attrs) of
Xmlns when ?IS_SUPPORTED_MGMT_XMLNS(Xmlns) ->
case stream_mgmt_enabled(StateData) of
true ->
case {xml:get_attr(<<"previd">>, Attrs),
catch jlib:binary_to_integer(xml:get_attr_s(<<"h">>, Attrs))}
case {fxml:get_attr(<<"previd">>, Attrs),
catch jlib:binary_to_integer(fxml:get_attr_s(<<"h">>, Attrs))}
of
{{value, PrevID}, H} when is_integer(H), H >= 0 ->
case inherit_session_state(StateData, PrevID) of
@ -2815,9 +2815,9 @@ handle_unacked_stanzas(StateData, F)
[N, jid:to_string(StateData#state.jid)]),
lists:foreach(
fun({_, Time, #xmlel{attrs = Attrs} = El}) ->
From_s = xml:get_attr_s(<<"from">>, Attrs),
From_s = fxml:get_attr_s(<<"from">>, Attrs),
From = jid:from_string(From_s),
To_s = xml:get_attr_s(<<"to">>, Attrs),
To_s = fxml:get_attr_s(<<"to">>, Attrs),
To = jid:from_string(To_s),
F(From, To, El, Time)
end, queue:to_list(Queue))
@ -2867,7 +2867,7 @@ handle_unacked_stanzas(StateData)
case is_encapsulated_forward(El) of
true ->
?DEBUG("Dropping forwarded message stanza from ~s",
[xml:get_attr_s(<<"from">>, El#xmlel.attrs)]);
[fxml:get_attr_s(<<"from">>, El#xmlel.attrs)]);
false ->
case ejabberd_hooks:run_fold(message_is_archived,
StateData#state.server,
@ -2886,9 +2886,9 @@ handle_unacked_stanzas(_StateData) ->
ok.
is_encapsulated_forward(#xmlel{name = <<"message">>} = El) ->
SubTag = case {xml:get_subtag(El, <<"sent">>),
xml:get_subtag(El, <<"received">>),
xml:get_subtag(El, <<"result">>)} of
SubTag = case {fxml:get_subtag(El, <<"sent">>),
fxml:get_subtag(El, <<"received">>),
fxml:get_subtag(El, <<"result">>)} of
{false, false, false} ->
false;
{Tag, false, false} ->
@ -2901,7 +2901,7 @@ is_encapsulated_forward(#xmlel{name = <<"message">>} = El) ->
if SubTag == false ->
false;
true ->
case xml:get_subtag(SubTag, <<"forwarded">>) of
case fxml:get_subtag(SubTag, <<"forwarded">>) of
false ->
false;
_ ->
@ -2989,7 +2989,7 @@ csi_filter_stanza(#state{csi_state = CsiState, jid = JID} = StateData,
queue -> csi_queue_add(StateData, Stanza);
drop -> StateData;
send ->
From = xml:get_tag_attr_s(<<"from">>, Stanza),
From = fxml:get_tag_attr_s(<<"from">>, Stanza),
StateData1 = csi_queue_send(StateData, From),
StateData2 = send_stanza(StateData1#state{csi_state = active},
Stanza),
@ -3000,7 +3000,7 @@ csi_queue_add(#state{csi_queue = Queue} = StateData, Stanza) ->
case length(StateData#state.csi_queue) >= csi_max_queue(StateData) of
true -> csi_queue_add(csi_queue_flush(StateData), Stanza);
false ->
From = xml:get_tag_attr_s(<<"from">>, Stanza),
From = fxml:get_tag_attr_s(<<"from">>, Stanza),
NewQueue = lists:keystore(From, 1, Queue, {From, p1_time_compat:timestamp(), Stanza}),
StateData#state{csi_queue = NewQueue}
end.

View File

@ -320,7 +320,7 @@ build_captcha_html(Id, Lang) ->
-spec process_reply(xmlel()) -> ok | {error, bad_match | not_found | malformed}.
process_reply(#xmlel{} = El) ->
case xml:get_subtag(El, <<"x">>) of
case fxml:get_subtag(El, <<"x">>) of
false -> {error, malformed};
Xdata ->
Fields = jlib:parse_xdata_submit(Xdata),

View File

@ -32,7 +32,7 @@
-include("ejabberd_commands.hrl").
-include("ejabberd.hrl").
-define(RAW(V), if HTMLOutput -> xml:crypt(iolist_to_binary(V)); true -> iolist_to_binary(V) end).
-define(RAW(V), if HTMLOutput -> fxml:crypt(iolist_to_binary(V)); true -> iolist_to_binary(V) end).
-define(TAG(N), if HTMLOutput -> [<<"<", ??N, "/>">>]; true -> md_tag(N, <<"">>) end).
-define(TAG(N, V), if HTMLOutput -> [<<"<", ??N, ">">>, V, <<"</", ??N, ">">>]; true -> md_tag(N, V) end).
-define(TAG(N, C, V), if HTMLOutput -> [<<"<", ??N, " class='", C, "'>">>, V, <<"</", ??N, ">">>]; true -> md_tag(N, V) end).

View File

@ -532,10 +532,10 @@ make_xhtml_output(State, Status, Headers, XHTML) ->
Data = case lists:member(html, Headers) of
true ->
iolist_to_binary([?HTML_DOCTYPE,
xml:element_to_binary(XHTML)]);
fxml:element_to_binary(XHTML)]);
_ ->
iolist_to_binary([?XHTML_DOCTYPE,
xml:element_to_binary(XHTML)])
fxml:element_to_binary(XHTML)])
end,
Headers1 = case lists:keysearch(<<"Content-Type">>, 1,
Headers)

View File

@ -224,7 +224,7 @@ process_request(Data, IP, HOpts) ->
of
%% No existing session:
{ok, {<<"">>, Rid, Attrs, Payload}} ->
case xml:get_attr_s(<<"to">>, Attrs) of
case fxml:get_attr_s(<<"to">>, Attrs) of
<<"">> ->
?DEBUG("Session not created (Improper addressing)", []),
{200, ?HEADER,
@ -248,13 +248,13 @@ process_request(Data, IP, HOpts) ->
end;
%% Existing session
{ok, {Sid, Rid, Attrs, Payload1}} ->
StreamStart = case xml:get_attr_s(<<"xmpp:restart">>,
StreamStart = case fxml:get_attr_s(<<"xmpp:restart">>,
Attrs)
of
<<"true">> -> true;
_ -> false
end,
Payload2 = case xml:get_attr_s(<<"type">>, Attrs) of
Payload2 = case fxml:get_attr_s(<<"type">>, Attrs) of
<<"terminate">> ->
Payload1 ++ [{xmlstreamend, <<"stream:stream">>}];
_ -> Payload1
@ -280,7 +280,7 @@ process_request(Data, IP, HOpts) ->
handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
Payload, PayloadSize, IP) ->
?DEBUG("got pid: ~p", [Pid]),
Wait = case str:to_integer(xml:get_attr_s(<<"wait">>,
Wait = case str:to_integer(fxml:get_attr_s(<<"wait">>,
Attrs))
of
{error, _} -> ?MAX_WAIT;
@ -289,7 +289,7 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
true -> CWait
end
end,
Hold = case str:to_integer(xml:get_attr_s(<<"hold">>,
Hold = case str:to_integer(fxml:get_attr_s(<<"hold">>,
Attrs))
of
{error, _} -> (?MAX_REQUESTS) - 1;
@ -299,7 +299,7 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
end
end,
Pdelay = case
str:to_integer(xml:get_attr_s(<<"process-delay">>,
str:to_integer(fxml:get_attr_s(<<"process-delay">>,
Attrs))
of
{error, _} -> ?PROCESS_DELAY_DEFAULT;
@ -312,12 +312,12 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
?PROCESS_DELAY_MIN])
end,
Version = case catch
list_to_float(binary_to_list(xml:get_attr_s(<<"ver">>, Attrs)))
list_to_float(binary_to_list(fxml:get_attr_s(<<"ver">>, Attrs)))
of
{'EXIT', _} -> 0.0;
V -> V
end,
XmppVersion = xml:get_attr_s(<<"xmpp:version">>, Attrs),
XmppVersion = fxml:get_attr_s(<<"xmpp:version">>, Attrs),
?DEBUG("Create session: ~p", [Sid]),
mnesia:dirty_write(
#http_bind{id = Sid,
@ -589,8 +589,8 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs,
Request,
StateName, StateData, RidAllow) ->
?DEBUG("Actually processing request: ~p", [Request]),
Key = xml:get_attr_s(<<"key">>, Attrs),
NewKey = xml:get_attr_s(<<"newkey">>, Attrs),
Key = fxml:get_attr_s(<<"key">>, Attrs),
NewKey = fxml:get_attr_s(<<"newkey">>, Attrs),
KeyAllow = case RidAllow of
repeat -> true;
false -> false;
@ -801,7 +801,7 @@ handle_http_put_error(Reason,
case Reason of
not_exists ->
{200, ?HEADER,
xml:element_to_binary(#xmlel{name = <<"body">>,
fxml:element_to_binary(#xmlel{name = <<"body">>,
attrs =
[{<<"xmlns">>, ?NS_HTTP_BIND},
{<<"type">>, <<"terminate">>},
@ -810,7 +810,7 @@ handle_http_put_error(Reason,
children = []})};
bad_key ->
{200, ?HEADER,
xml:element_to_binary(#xmlel{name = <<"body">>,
fxml:element_to_binary(#xmlel{name = <<"body">>,
attrs =
[{<<"xmlns">>, ?NS_HTTP_BIND},
{<<"type">>, <<"terminate">>},
@ -819,7 +819,7 @@ handle_http_put_error(Reason,
children = []})};
polling_too_frequently ->
{200, ?HEADER,
xml:element_to_binary(#xmlel{name = <<"body">>,
fxml:element_to_binary(#xmlel{name = <<"body">>,
attrs =
[{<<"xmlns">>, ?NS_HTTP_BIND},
{<<"type">>, <<"terminate">>},
@ -855,7 +855,7 @@ rid_allow(OldRid, NewRid, Attrs, Hold, MaxPause) ->
%% We did not miss any packet, we can process it immediately:
NewRid == OldRid + 1 ->
case catch
jlib:binary_to_integer(xml:get_attr_s(<<"pause">>,
jlib:binary_to_integer(fxml:get_attr_s(<<"pause">>,
Attrs))
of
{'EXIT', _} -> {true, 0};
@ -929,9 +929,9 @@ prepare_outpacket_response(#http_bind{id = Sid,
_Rid, OutPacket, true) ->
case OutPacket of
[{xmlstreamstart, _, OutAttrs} | Els] ->
AuthID = xml:get_attr_s(<<"id">>, OutAttrs),
From = xml:get_attr_s(<<"from">>, OutAttrs),
Version = xml:get_attr_s(<<"version">>, OutAttrs),
AuthID = fxml:get_attr_s(<<"id">>, OutAttrs),
From = fxml:get_attr_s(<<"from">>, OutAttrs),
Version = fxml:get_attr_s(<<"version">>, OutAttrs),
OutEls = case Els of
[] -> [];
[{xmlstreamelement,
@ -968,7 +968,7 @@ prepare_outpacket_response(#http_bind{id = Sid,
MaxInactivity = get_max_inactivity(To, ?MAX_INACTIVITY),
MaxPause = get_max_pause(To),
{200, ?HEADER,
xml:element_to_binary(#xmlel{name = <<"body">>,
fxml:element_to_binary(#xmlel{name = <<"body">>,
attrs =
[{<<"xmlns">>, ?NS_HTTP_BIND},
{<<"sid">>, Sid},
@ -1032,7 +1032,7 @@ send_outpacket(#http_bind{pid = FsmRef}, OutPacket) ->
TypedEls = lists:foldl(fun ({xmlstreamelement, El},
Acc) ->
Acc ++
[xml:element_to_binary(check_default_xmlns(El))];
[fxml:element_to_binary(check_default_xmlns(El))];
({xmlstreamraw, R}, Acc) ->
Acc ++ [R]
end,
@ -1067,7 +1067,7 @@ send_outpacket(#http_bind{pid = FsmRef}, OutPacket) ->
|| {xmlstreamelement, OEl} <- StreamTail]
end,
{200, ?HEADER,
xml:element_to_binary(#xmlel{name = <<"body">>,
fxml:element_to_binary(#xmlel{name = <<"body">>,
attrs =
[{<<"xmlns">>,
?NS_HTTP_BIND}],
@ -1114,14 +1114,14 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
?DEBUG("--- incoming data --- ~n~s~n --- END "
"--- ",
[Data]),
case xml_stream:parse_element(Data) of
case fxml_stream:parse_element(Data) of
#xmlel{name = <<"body">>, attrs = Attrs,
children = Els} ->
Xmlns = xml:get_attr_s(<<"xmlns">>, Attrs),
Xmlns = fxml:get_attr_s(<<"xmlns">>, Attrs),
if Xmlns /= (?NS_HTTP_BIND) -> {error, bad_request};
true ->
case catch
jlib:binary_to_integer(xml:get_attr_s(<<"rid">>,
jlib:binary_to_integer(fxml:get_attr_s(<<"rid">>,
Attrs))
of
{'EXIT', _} -> {error, bad_request};
@ -1133,7 +1133,7 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
end
end,
Els),
Sid = xml:get_attr_s(<<"sid">>, Attrs),
Sid = fxml:get_attr_s(<<"sid">>, Attrs),
if PayloadSize =< MaxStanzaSize ->
{ok, {Sid, Rid, Attrs, FixedEls}};
true -> {size_limit, Sid}
@ -1165,7 +1165,7 @@ set_inactivity_timer(_Pause, MaxInactivity) ->
elements_to_string([]) -> [];
elements_to_string([El | Els]) ->
[xml:element_to_binary(El) | elements_to_string(Els)].
[fxml:element_to_binary(El) | elements_to_string(Els)].
%% @spec (To, Default::integer()) -> integer()
%% where To = [] | {Host::string(), Version::string()}
@ -1188,7 +1188,7 @@ get_max_pause(_) -> ?MAX_PAUSE.
check_default_xmlns(#xmlel{name = Name, attrs = Attrs,
children = Els} =
El) ->
case xml:get_tag_attr_s(<<"xmlns">>, El) of
case fxml:get_tag_attr_s(<<"xmlns">>, El) of
<<"">> ->
#xmlel{name = Name,
attrs = [{<<"xmlns">>, ?NS_CLIENT} | Attrs],

View File

@ -171,11 +171,11 @@ handle_sync_event({send_xml, Packet}, _From, StateName,
{true, {xmlstreamelement, #xmlel{name=Name2} = El2}} ->
El3 = case Name2 of
<<"stream:", _/binary>> ->
xml:replace_tag_attr(<<"xmlns:stream">>, ?NS_STREAM, El2);
fxml:replace_tag_attr(<<"xmlns:stream">>, ?NS_STREAM, El2);
_ ->
case xml:get_tag_attr_s(<<"xmlns">>, El2) of
case fxml:get_tag_attr_s(<<"xmlns">>, El2) of
<<"">> ->
xml:replace_tag_attr(<<"xmlns">>, <<"jabber:client">>, El2);
fxml:replace_tag_attr(<<"xmlns">>, <<"jabber:client">>, El2);
_ ->
El2
end
@ -186,12 +186,12 @@ handle_sync_event({send_xml, Packet}, _From, StateName,
end,
case Packet2 of
{xmlstreamstart, Name, Attrs3} ->
B = xml:element_to_binary(#xmlel{name = Name, attrs = Attrs3}),
B = fxml:element_to_binary(#xmlel{name = Name, attrs = Attrs3}),
WsPid ! {send, <<(binary:part(B, 0, byte_size(B)-2))/binary, ">">>};
{xmlstreamend, Name} ->
WsPid ! {send, <<"</", Name/binary, ">">>};
{xmlstreamelement, El} ->
WsPid ! {send, xml:element_to_binary(El)};
WsPid ! {send, fxml:element_to_binary(El)};
{xmlstreamraw, Bin} ->
WsPid ! {send, Bin};
{xmlstreamcdata, Bin2} ->
@ -210,7 +210,7 @@ handle_sync_event(close, _From, StateName, #state{ws = {_, WsPid}, rfc_compilant
when StateName /= stream_end_sent ->
Close = #xmlel{name = <<"close">>,
attrs = [{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-framing">>}]},
WsPid ! {send, xml:element_to_binary(Close)},
WsPid ! {send, fxml:element_to_binary(Close)},
{stop, normal, StateData};
handle_sync_event(close, _From, _StateName, StateData) ->
{stop, normal, StateData}.
@ -316,9 +316,9 @@ get_human_html_xmlel() ->
parse(#state{rfc_compilant = C} = State, Data) ->
case C of
undefined ->
P = xml_stream:new(self()),
P2 = xml_stream:parse(P, Data),
xml_stream:close(P2),
P = fxml_stream:new(self()),
P2 = fxml_stream:parse(P, Data),
fxml_stream:close(P2),
case parsed_items([]) of
error ->
{State#state{rfc_compilant = true}, <<"parse error">>};
@ -330,7 +330,7 @@ parse(#state{rfc_compilant = C} = State, Data) ->
parse(State#state{rfc_compilant = false}, Data)
end;
true ->
El = xml_stream:parse_element(Data),
El = fxml_stream:parse_element(Data),
case El of
#xmlel{name = <<"open">>, attrs = Attrs} ->
Attrs2 = [{<<"xmlns:stream">>, ?NS_STREAM}, {<<"xmlns">>, <<"jabber:client">>} |

View File

@ -272,7 +272,7 @@ do_route(From, To, Packet) ->
end;
true ->
#xmlel{attrs = Attrs} = Packet,
case xml:get_attr_s(<<"type">>, Attrs) of
case fxml:get_attr_s(<<"type">>, Attrs) of
<<"error">> -> ok;
<<"result">> -> ok;
_ ->

View File

@ -64,7 +64,7 @@
-define(NS_PIEFXIS, <<"http://www.xmpp.org/extensions/xep-0227.html#ns">>).
-define(NS_XI, <<"http://www.w3.org/2001/XInclude">>).
-record(state, {xml_stream_state :: xml_stream:xml_stream_state(),
-record(state, {xml_stream_state :: fxml_stream:xml_stream_state(),
user = <<"">> :: binary(),
server = <<"">> :: binary(),
fd :: file:io_device(),
@ -85,7 +85,7 @@ import_file(FileName, State) ->
case file:open(FileName, [read, binary]) of
{ok, Fd} ->
Dir = filename:dirname(FileName),
XMLStreamState = xml_stream:new(self(), infinity),
XMLStreamState = fxml_stream:new(self(), infinity),
Res = process(State#state{xml_stream_state = XMLStreamState,
fd = Fd,
dir = Dir}),
@ -257,7 +257,7 @@ export_user(User, Server, Fd) ->
get_privacy(User, Server) ++
get_roster(User, Server) ++
get_private(User, Server),
print(Fd, xml:element_to_binary(
print(Fd, fxml:element_to_binary(
#xmlel{name = <<"user">>,
attrs = [{<<"name">>, User},
{<<"password">>, Pass}],
@ -387,17 +387,17 @@ get_private(User, Server) ->
process(#state{xml_stream_state = XMLStreamState, fd = Fd} = State) ->
case file:read(Fd, ?CHUNK_SIZE) of
{ok, Data} ->
NewXMLStreamState = xml_stream:parse(XMLStreamState, Data),
NewXMLStreamState = fxml_stream:parse(XMLStreamState, Data),
case process_els(State#state{xml_stream_state =
NewXMLStreamState}) of
{ok, NewState} ->
process(NewState);
Err ->
xml_stream:close(NewXMLStreamState),
fxml_stream:close(NewXMLStreamState),
Err
end;
eof ->
xml_stream:close(XMLStreamState),
fxml_stream:close(XMLStreamState),
ok
end.
@ -415,7 +415,7 @@ process_els(State) ->
end.
process_el({xmlstreamstart, <<"server-data">>, Attrs}, State) ->
case xml:get_attr_s(<<"xmlns">>, Attrs) of
case fxml:get_attr_s(<<"xmlns">>, Attrs) of
?NS_PIEFXIS ->
{ok, State};
?NS_PIE ->
@ -430,7 +430,7 @@ process_el({xmlstreamcdata, _}, State) ->
process_el({xmlstreamelement, #xmlel{name = <<"xi:include">>,
attrs = Attrs}},
#state{dir = Dir, user = <<"">>} = State) ->
FileName = xml:get_attr_s(<<"href">>, Attrs),
FileName = fxml:get_attr_s(<<"href">>, Attrs),
case import_file(filename:join([Dir, FileName]), State) of
ok ->
{ok, State};
@ -443,7 +443,7 @@ process_el({xmlstreamstart, <<"host">>, Attrs}, State) ->
process_el({xmlstreamelement, #xmlel{name = <<"host">>,
attrs = Attrs,
children = Els}}, State) ->
JIDS = xml:get_attr_s(<<"jid">>, Attrs),
JIDS = fxml:get_attr_s(<<"jid">>, Attrs),
case jid:from_string(JIDS) of
#jid{lserver = S} ->
case lists:member(S, ?MYHOSTS) of
@ -486,8 +486,8 @@ process_users([], State) ->
process_user(#xmlel{name = <<"user">>, attrs = Attrs, children = Els},
#state{server = LServer} = State) ->
Name = xml:get_attr_s(<<"name">>, Attrs),
Password = xml:get_attr_s(<<"password">>, Attrs),
Name = fxml:get_attr_s(<<"name">>, Attrs),
Password = fxml:get_attr_s(<<"password">>, Attrs),
PasswordFormat = ejabberd_config:get_option({auth_password_format, LServer}, fun(X) -> X end, plain),
Pass = case PasswordFormat of
scram ->
@ -525,7 +525,7 @@ process_user_els([], State) ->
process_user_el(#xmlel{name = Name, attrs = Attrs, children = Els} = El,
State) ->
case {Name, xml:get_attr_s(<<"xmlns">>, Attrs)} of
case {Name, fxml:get_attr_s(<<"xmlns">>, Attrs)} of
{<<"query">>, ?NS_ROSTER} ->
process_roster(El, State);
{<<"query">>, ?NS_PRIVACY} ->
@ -584,7 +584,7 @@ process_privacy(El, State = #state{user = U, server = S}) ->
[], JID, JID, #iq{type = set, sub_el = El}) of
{error, Error} = Err ->
#xmlel{children = Els} = El,
Name = case xml:remove_cdata(Els) of
Name = case fxml:remove_cdata(Els) of
[#xmlel{name = N}] -> N;
_ -> undefined
end,
@ -628,7 +628,7 @@ process_vcard(El, State = #state{user = U, server = S}) ->
%% @spec (Dir::string(), Host::string()) -> ok
process_offline_msg(El, State = #state{user = U, server = S}) ->
FromS = xml:get_attr_s(<<"from">>, El#xmlel.attrs),
FromS = fxml:get_attr_s(<<"from">>, El#xmlel.attrs),
case jid:from_string(FromS) of
#jid{} = From ->
To = jid:make(U, S, <<>>),
@ -645,7 +645,7 @@ process_offline_msg(El, State = #state{user = U, server = S}) ->
%% @spec (Dir::string(), Fn::string(), Host::string()) -> ok
process_presence(El, #state{user = U, server = S} = State) ->
FromS = xml:get_attr_s(<<"from">>, El#xmlel.attrs),
FromS = fxml:get_attr_s(<<"from">>, El#xmlel.attrs),
case jid:from_string(FromS) of
#jid{} = From ->
To = jid:make(U, S, <<>>),

View File

@ -53,7 +53,7 @@
shaper_state = none :: shaper:shaper(),
c2s_pid :: pid(),
max_stanza_size = infinity :: non_neg_integer() | infinity,
xml_stream_state :: xml_stream:xml_stream_state(),
xml_stream_state :: fxml_stream:xml_stream_state(),
timeout = infinity:: timeout()}).
-define(HIBERNATE_TIMEOUT, 90000).
@ -160,7 +160,7 @@ handle_call(reset_stream, _From, State) ->
Reply = ok,
{reply, Reply, NewState, ?HIBERNATE_TIMEOUT};
handle_call({become_controller, C2SPid}, _From, State) ->
XMLStreamState = xml_stream:new(C2SPid, State#state.max_stanza_size),
XMLStreamState = fxml_stream:new(C2SPid, State#state.max_stanza_size),
NewState = State#state{c2s_pid = C2SPid,
xml_stream_state = XMLStreamState},
activate_socket(NewState),
@ -284,7 +284,7 @@ process_data(Data,
undefined ->
XMLStreamState;
_ ->
xml_stream:parse(XMLStreamState, Data)
fxml_stream:parse(XMLStreamState, Data)
end,
{NewShaperState, Pause} = shaper:update(ShaperState, byte_size(Data)),
if
@ -309,7 +309,7 @@ element_wrapper(Element) -> Element.
close_stream(undefined) -> ok;
close_stream(XMLStreamState) ->
xml_stream:close(XMLStreamState).
fxml_stream:close(XMLStreamState).
reset_parser(#state{xml_stream_state = undefined} = State) ->
State;
@ -317,14 +317,14 @@ reset_parser(#state{c2s_pid = C2SPid,
max_stanza_size = MaxStanzaSize,
xml_stream_state = XMLStreamState}
= State) ->
NewStreamState = try xml_stream:reset(XMLStreamState)
NewStreamState = try fxml_stream:reset(XMLStreamState)
catch error:_ ->
close_stream(XMLStreamState),
case C2SPid of