From d63be79df9d4fb6686726dbaccd002c5189ffdbc Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Mon, 20 Jan 2014 16:06:05 +0200 Subject: [PATCH] Use 'to' field only in the first client stream initialization --- src/ejabberd_c2s.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index e5304044a..5a02f98bd 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -291,7 +291,12 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) -> DefaultLang = ?MYLANG, case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of ?NS_STREAM -> - Server = jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)), + Server = + case StateData#state.server of + undefined -> + jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)); + S -> S + end, case lists:member(Server, ?MYHOSTS) of true -> Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of