mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
o Use the new exmpp_stream:opening_reply/3 function in wait_for_stream/2.
o The function terminate/3 is converted to exmpp. SVN Revision: 1377
This commit is contained in:
parent
4e2e68a3fb
commit
e93e846e16
@ -5,6 +5,10 @@
|
|||||||
JID form with empty strings for unspecified fields. Users are able to
|
JID form with empty strings for unspecified fields. Users are able to
|
||||||
connect to ejabberd but some features don't seem to work proprerly.
|
connect to ejabberd but some features don't seem to work proprerly.
|
||||||
|
|
||||||
|
* src/ejabberd_c2s.erl: Use the new exmpp_stream:opening_reply/3
|
||||||
|
function in wait_for_stream/2. The function terminate/3 is converted
|
||||||
|
to exmpp.
|
||||||
|
|
||||||
2008-06-23 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-06-23 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl (session_established): Convert JID to the
|
* src/ejabberd_c2s.erl (session_established): Convert JID to the
|
||||||
|
@ -277,8 +277,7 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) ->
|
|||||||
DL
|
DL
|
||||||
end,
|
end,
|
||||||
Header = exmpp_stream:opening_reply(Opening,
|
Header = exmpp_stream:opening_reply(Opening,
|
||||||
StateData#state.streamid),
|
StateData#state.streamid, DefaultLang),
|
||||||
Header1 = exmpp_stream:set_lang(Header, DefaultLang),
|
|
||||||
case NS of
|
case NS of
|
||||||
?NS_XMPP ->
|
?NS_XMPP ->
|
||||||
Server = exmpp_stringprep:nameprep(
|
Server = exmpp_stringprep:nameprep(
|
||||||
@ -291,7 +290,7 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) ->
|
|||||||
exmpp_jid:make_bare_jid(undefined, Server)),
|
exmpp_jid:make_bare_jid(undefined, Server)),
|
||||||
case exmpp_stream:get_version(Opening) of
|
case exmpp_stream:get_version(Opening) of
|
||||||
{1, 0} ->
|
{1, 0} ->
|
||||||
send_element(StateData, Header1),
|
send_element(StateData, Header),
|
||||||
case StateData#state.authenticated of
|
case StateData#state.authenticated of
|
||||||
false ->
|
false ->
|
||||||
SASLState =
|
SASLState =
|
||||||
@ -373,12 +372,12 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) ->
|
|||||||
(not StateData#state.tls_enabled) and
|
(not StateData#state.tls_enabled) and
|
||||||
StateData#state.tls_required ->
|
StateData#state.tls_required ->
|
||||||
send_element(StateData,
|
send_element(StateData,
|
||||||
exmpp_xml:append_child(Header1,
|
exmpp_xml:append_child(Header,
|
||||||
exmpp_stream:error('policy-violation',
|
exmpp_stream:error('policy-violation',
|
||||||
"en", "Use of STARTTLS required"))),
|
"en", "Use of STARTTLS required"))),
|
||||||
{stop, normal, StateData};
|
{stop, normal, StateData};
|
||||||
true ->
|
true ->
|
||||||
send_element(StateData, Header1),
|
send_element(StateData, Header),
|
||||||
fsm_next_state(wait_for_auth,
|
fsm_next_state(wait_for_auth,
|
||||||
StateData#state{
|
StateData#state{
|
||||||
server = Server,
|
server = Server,
|
||||||
@ -386,14 +385,14 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) ->
|
|||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Header2 = exmpp_stream:set_initiating_entity(Header1,
|
Header2 = exmpp_stream:set_initiating_entity(Header,
|
||||||
?MYNAME),
|
?MYNAME),
|
||||||
send_element(StateData, exmpp_xml:append_child(Header2,
|
send_element(StateData, exmpp_xml:append_child(Header2,
|
||||||
exmpp_stream:error('host-unknown'))),
|
exmpp_stream:error('host-unknown'))),
|
||||||
{stop, normal, StateData}
|
{stop, normal, StateData}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Header2 = exmpp_stream:set_initiating_entity(Header1, ?MYNAME),
|
Header2 = exmpp_stream:set_initiating_entity(Header, ?MYNAME),
|
||||||
send_element(StateData, exmpp_xml:append_child(Header2,
|
send_element(StateData, exmpp_xml:append_child(Header2,
|
||||||
exmpp_stream:error('invalid-namespace'))),
|
exmpp_stream:error('invalid-namespace'))),
|
||||||
{stop, normal, StateData}
|
{stop, normal, StateData}
|
||||||
@ -1328,26 +1327,29 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
replaced ->
|
replaced ->
|
||||||
?INFO_MSG("(~w) Replaced session for ~s",
|
?INFO_MSG("(~w) Replaced session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
jlib:jid_to_string(StateData#state.jid)]),
|
exmpp_jid:jid_to_string(StateData#state.jid)]),
|
||||||
From = StateData#state.jid,
|
From = StateData#state.jid,
|
||||||
Packet = {xmlelement, "presence",
|
Packet = exmpp_presence:unavailable(),
|
||||||
[{"type", "unavailable"}],
|
Packet1 = exmpp_presence:set_status(Packet,
|
||||||
[{xmlelement, "status", [],
|
"Replaced by new connection"),
|
||||||
[{xmlcdata, "Replaced by new connection"}]}]},
|
|
||||||
ejabberd_sm:close_session_unset_presence(
|
ejabberd_sm:close_session_unset_presence(
|
||||||
StateData#state.sid,
|
StateData#state.sid,
|
||||||
StateData#state.user,
|
StateData#state.user,
|
||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
StateData#state.resource,
|
StateData#state.resource,
|
||||||
"Replaced by new connection"),
|
"Replaced by new connection"),
|
||||||
|
% XXX OLD FORMAT: From, Packet1
|
||||||
|
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
||||||
|
Packet1Old = exmpp_xml:xmlel_to_xmlelement(Packet1,
|
||||||
|
?DEFAULT_NS, ?PREFIXED_NS),
|
||||||
presence_broadcast(
|
presence_broadcast(
|
||||||
StateData, From, StateData#state.pres_a, Packet),
|
StateData, FromOld, StateData#state.pres_a, Packet1Old),
|
||||||
presence_broadcast(
|
presence_broadcast(
|
||||||
StateData, From, StateData#state.pres_i, Packet);
|
StateData, FromOld, StateData#state.pres_i, Packet1Old);
|
||||||
_ ->
|
_ ->
|
||||||
?INFO_MSG("(~w) Close session for ~s",
|
?INFO_MSG("(~w) Close session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
jlib:jid_to_string(StateData#state.jid)]),
|
exmpp_jid:jid_to_string(StateData#state.jid)]),
|
||||||
|
|
||||||
EmptySet = ?SETS:new(),
|
EmptySet = ?SETS:new(),
|
||||||
case StateData of
|
case StateData of
|
||||||
@ -1361,8 +1363,11 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
StateData#state.resource);
|
StateData#state.resource);
|
||||||
_ ->
|
_ ->
|
||||||
From = StateData#state.jid,
|
From = StateData#state.jid,
|
||||||
Packet = {xmlelement, "presence",
|
Packet = exmpp_presence:unavailable(),
|
||||||
[{"type", "unavailable"}], []},
|
% XXX OLD FORMAT: From, Packet.
|
||||||
|
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
||||||
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
|
?DEFAULT_NS, ?PREFIXED_NS),
|
||||||
ejabberd_sm:close_session_unset_presence(
|
ejabberd_sm:close_session_unset_presence(
|
||||||
StateData#state.sid,
|
StateData#state.sid,
|
||||||
StateData#state.user,
|
StateData#state.user,
|
||||||
@ -1370,9 +1375,9 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
StateData#state.resource,
|
StateData#state.resource,
|
||||||
""),
|
""),
|
||||||
presence_broadcast(
|
presence_broadcast(
|
||||||
StateData, From, StateData#state.pres_a, Packet),
|
StateData, FromOld, StateData#state.pres_a, PacketOld),
|
||||||
presence_broadcast(
|
presence_broadcast(
|
||||||
StateData, From, StateData#state.pres_i, Packet)
|
StateData, FromOld, StateData#state.pres_i, PacketOld)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
@ -2018,5 +2023,4 @@ is_ip_blacklisted({IP,_Port}) ->
|
|||||||
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]).
|
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]).
|
||||||
|
|
||||||
short_jid(JID) ->
|
short_jid(JID) ->
|
||||||
JID1 = exmpp_jid:to_ejabberd_jid(JID),
|
{JID#jid.lnode, JID#jid.ldomain, JID#jid.lresource}.
|
||||||
{JID1#jid.lnode, JID1#jid.ldomain, JID1#jid.lresource}.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user