25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01: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> 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 * src/ejabberd_c2s.erl: Better error handling for stream
compression support (thanks to Sergei Golovan) compression support (thanks to Sergei Golovan)

View File

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

View File

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

View File

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