25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-07 14:58:56 +02:00

* src/ejabberd_c2s.erl: Remove top-level xmlns from incoming

stanzas
* src/ejabberd_s2s_in.erl: Likewise
* src/ejabberd_service.erl: Likewise

SVN Revision: 492
This commit is contained in:
Alexey Shchepin 2006-01-25 00:35:12 +00:00
parent 976a616662
commit efacb0ad66
4 changed files with 19 additions and 9 deletions

View File

@ -1,5 +1,10 @@
2006-01-25 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_c2s.erl: Remove top-level xmlns from incoming
stanzas
* src/ejabberd_s2s_in.erl: Likewise
* src/ejabberd_service.erl: Likewise
* src/ejabberd_c2s.erl: Better error handling for stream
compression support (thanks to Sergei Golovan)

View File

@ -751,15 +751,16 @@ session_established({xmlstreamelement, El}, StateData) ->
_ ->
jlib:string_to_jid(To)
end,
NewEl1 = jlib:remove_attr("xmlns", El),
NewEl = case xml:get_attr_s("xml:lang", Attrs) of
"" ->
case StateData#state.lang of
"" -> El;
"" -> NewEl1;
Lang ->
xml:replace_tag_attr("xml:lang", Lang, El)
xml:replace_tag_attr("xml:lang", Lang, NewEl1)
end;
_ ->
El
NewEl1
end,
NewState =
case ToJID of

View File

@ -346,7 +346,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
[]}),
{next_state, stream_established, StateData#state{timer = Timer}};
_ ->
{xmlelement, Name, Attrs, _Els} = El,
NewEl = jlib:remove_attr("xmlns", El),
{xmlelement, Name, Attrs, _Els} = NewEl,
From_s = xml:get_attr_s("from", Attrs),
From = jlib:string_to_jid(From_s),
To_s = xml:get_attr_s("to", Attrs),
@ -366,7 +367,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
if ((Name == "iq") or
(Name == "message") or
(Name == "presence")) ->
ejabberd_router:route(From, To, El);
ejabberd_router:route(
From, To, NewEl);
true ->
error
end;
@ -380,7 +382,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
if ((Name == "iq") or
(Name == "message") or
(Name == "presence")) ->
ejabberd_router:route(From, To, El);
ejabberd_router:route(
From, To, NewEl);
true ->
error
end;

View File

@ -198,7 +198,8 @@ wait_for_handshake(closed, StateData) ->
stream_established({xmlstreamelement, El}, StateData) ->
{xmlelement, Name, Attrs, _Els} = El,
NewEl = jlib:remove_attr("xmlns", El),
{xmlelement, Name, Attrs, _Els} = NewEl,
From = xml:get_attr_s("from", Attrs),
FromJID1 = jlib:string_to_jid(From),
FromJID = case FromJID1 of
@ -218,9 +219,9 @@ stream_established({xmlstreamelement, El}, StateData) ->
(Name == "message") or
(Name == "presence")) and
(ToJID /= error) and (FromJID /= error) ->
ejabberd_router:route(FromJID, ToJID, El);
ejabberd_router:route(FromJID, ToJID, NewEl);
true ->
Err = jlib:make_error_reply(El, ?ERR_BAD_REQUEST),
Err = jlib:make_error_reply(NewEl, ?ERR_BAD_REQUEST),
send_element(StateData, Err),
error
end,