mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Simplify and particularize the code of previous commit (EJAB-1333)
This commit is contained in:
parent
05d95f2dd7
commit
a8dd91512c
@ -1294,24 +1294,20 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
|
|||||||
{error, bad_request}
|
{error, bad_request}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% This BOSH stanza contains at least one XMPP stanza without namespace,
|
%% This BOSH stanza contains at least one XMPP stanza without NS,
|
||||||
%% and exmpp sets the ns of BOSH to it and its children, instead of assuming jabber:client.
|
%% and exmpp sets the NS of BOSH to it and its children, instead of assuming jabber:client.
|
||||||
%% To avoid that, we set the jabber:client ns to the BOSH stanza, parse it,
|
%% To avoid that, we set the jabber:client NS to the BOSH stanza, parse it,
|
||||||
%% and the NS will be inherited to the ns-less XMPP stanza.
|
%% and the NS will be inherited to the NS-less XMPP stanza.
|
||||||
force_ns(Data) ->
|
force_ns(Data) ->
|
||||||
Data2 = change_ns(Data, ?NS_HTTP_BIND_s, ?NS_JABBER_CLIENT_s),
|
Data2 = change_ns(Data, ""),
|
||||||
[#xmlel{children = Els}] = exmpp_xmlstream:parse_element(Data2),
|
[#xmlel{children = Els}] = exmpp_xmlstream:parse_element(Data2),
|
||||||
Els.
|
Els.
|
||||||
change_ns(String, ?NS_HTTP_BIND_s, ?NS_JABBER_CLIENT_s) ->
|
change_ns([], Res) ->
|
||||||
change_ns(String, ?NS_HTTP_BIND_s, ?NS_JABBER_CLIENT_s, "").
|
|
||||||
change_ns([], _NSin, _NSout, Res) ->
|
|
||||||
lists:reverse(Res);
|
lists:reverse(Res);
|
||||||
%%change_ns(NSin ++ String, NSin, NSout, Res) when FirstString->
|
change_ns(?NS_HTTP_BIND_s ++ String, Res) ->
|
||||||
change_ns(?NS_HTTP_BIND_s ++ String, NSin, NSout, Res) ->
|
change_ns(String, lists:reverse(?NS_JABBER_CLIENT_s) ++ Res);
|
||||||
%%change_ns([$h,$t,$t,$p,$:,$/,$/,$j,$a,$b,$b,$e,$r,$.,$o,$r,$g,$/,$p,$r,$o,$t,$o,$c,$o,$l,$/,$h,$t,$t,$p,$b,$i,$n,$d|String], NSin, NSout, Res) ->
|
change_ns([Char | String], Res) ->
|
||||||
change_ns(String, NSin, NSout, lists:reverse(NSout) ++ Res);
|
change_ns(String, [Char | Res]).
|
||||||
change_ns([Char | String], NSin, NSout, Res) ->
|
|
||||||
change_ns(String, NSin, NSout, [Char | Res]).
|
|
||||||
|
|
||||||
send_receiver_reply(undefined, _Reply) ->
|
send_receiver_reply(undefined, _Reply) ->
|
||||||
ok;
|
ok;
|
||||||
|
Loading…
Reference in New Issue
Block a user