24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

Improve stream error stanza when receives invalid handshake from component.

SVN Revision: 2641
This commit is contained in:
Badlop 2009-10-06 10:05:10 +00:00
parent 75793f7cf4
commit f4e35033e7

View File

@ -198,9 +198,23 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
end, StateData#state.hosts),
{next_state, stream_established, StateData};
_ ->
send_element(StateData,
#xmlel{ns = ?NS_XMPP, name = 'error', children = [
#xmlcdata{cdata = <<"Invalid Handshake">>}]}),
TextEl =
#xmlel{ns = ?NS_STANZA_ERRORS,
name = 'text',
children =
[#xmlcdata{cdata = <<"Invalid Handshake">>}]
},
NotAuthorizedEl =
#xmlel{ns = ?NS_STANZA_ERRORS,
name = 'not-authorized',
children = [TextEl]
},
InvalidHandshakeEl =
#xmlel{ns = ?NS_XMPP,
name = 'error',
children = [NotAuthorizedEl]
},
send_element(StateData, InvalidHandshakeEl),
send_element(StateData, exmpp_stream:closing()),
{stop, normal, StateData}
end;