mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Use the new clause of exmpp_stanza:reply_with_error/2, exmpp_iq:error/2,
exmpp_iq:error_without_original/2 and the new exmpp_jid:make_bare_jid/1. SVN Revision: 1394
This commit is contained in:
parent
87218e1447
commit
8c33e12616
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
* src/ejabberd_sm.erl: Convert to exmpp.
|
* src/ejabberd_sm.erl: Convert to exmpp.
|
||||||
|
|
||||||
|
* src/ejabberd_c2s.erl, src/ejabberd_s2s.erl, src/ejabberd_s2s_in.erl,
|
||||||
|
src/ejabberd_s2s_out.erl: Use the new clause of
|
||||||
|
exmpp_stanza:reply_with_error/2, exmpp_iq:error/2,
|
||||||
|
exmpp_iq:error_without_original/2 and the new
|
||||||
|
exmpp_jid:make_bare_jid/1.
|
||||||
|
|
||||||
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/Makefile.in: Remove the -I flag for exmpp includes; the
|
* src/Makefile.in: Remove the -I flag for exmpp includes; the
|
||||||
|
@ -124,6 +124,7 @@
|
|||||||
[?NS_JABBER_CLIENT], [{?NS_XMPP, "stream"}])).
|
[?NS_JABBER_CLIENT], [{?NS_XMPP, "stream"}])).
|
||||||
-define(ERR_FEATURE_NOT_IMPLEMENTED, ?STANZA_ERROR('feature-not-implemented')).
|
-define(ERR_FEATURE_NOT_IMPLEMENTED, ?STANZA_ERROR('feature-not-implemented')).
|
||||||
|
|
||||||
|
% XXX OLD FORMAT: Re-include jlib.hrl (after clean-up).
|
||||||
-record(iq, {id = "",
|
-record(iq, {id = "",
|
||||||
type,
|
type,
|
||||||
xmlns = "",
|
xmlns = "",
|
||||||
@ -236,7 +237,7 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) ->
|
|||||||
true ->
|
true ->
|
||||||
Lang = exmpp_stream:get_lang(Opening),
|
Lang = exmpp_stream:get_lang(Opening),
|
||||||
change_shaper(StateData,
|
change_shaper(StateData,
|
||||||
exmpp_jid:make_bare_jid(undefined, Server)),
|
exmpp_jid:make_bare_jid(Server)),
|
||||||
case exmpp_stream:get_version(Opening) of
|
case exmpp_stream:get_version(Opening) of
|
||||||
{1, 0} ->
|
{1, 0} ->
|
||||||
send_element(StateData, Header),
|
send_element(StateData, Header),
|
||||||
@ -442,8 +443,8 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
"(~w) Failed legacy authentication for ~s",
|
"(~w) Failed legacy authentication for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_string(JID)]),
|
exmpp_jid:jid_to_string(JID)]),
|
||||||
Err = exmpp_stanza:error('not-authorized'),
|
Res = exmpp_iq:error_without_original(El,
|
||||||
Res = exmpp_iq:error_without_original(El, Err),
|
'not-authorized'),
|
||||||
send_element(StateData, Res),
|
send_element(StateData, Res),
|
||||||
fsm_next_state(wait_for_auth, StateData)
|
fsm_next_state(wait_for_auth, StateData)
|
||||||
end;
|
end;
|
||||||
@ -452,8 +453,8 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
"(~w) Forbidden legacy authentication for ~s",
|
"(~w) Forbidden legacy authentication for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_string(JID)]),
|
exmpp_jid:jid_to_string(JID)]),
|
||||||
Err = exmpp_stanza:error('not-allowed'),
|
Res = exmpp_iq:error_without_original(El,
|
||||||
Res = exmpp_iq:error_without_original(El, Err),
|
'not-allowed'),
|
||||||
send_element(StateData, Res),
|
send_element(StateData, Res),
|
||||||
fsm_next_state(wait_for_auth, StateData)
|
fsm_next_state(wait_for_auth, StateData)
|
||||||
end
|
end
|
||||||
@ -463,8 +464,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
"(~w) Forbidden legacy authentication for "
|
"(~w) Forbidden legacy authentication for "
|
||||||
"username '~s' with resource '~s'",
|
"username '~s' with resource '~s'",
|
||||||
[StateData#state.socket, U, R]),
|
[StateData#state.socket, U, R]),
|
||||||
Err1 = exmpp_stanza:error('jid-malformed'),
|
Res1 = exmpp_iq:error_without_original(El, 'jid-malformed'),
|
||||||
Res1 = exmpp_iq:error_without_original(El, Err1),
|
|
||||||
send_element(StateData, Res1),
|
send_element(StateData, Res1),
|
||||||
fsm_next_state(wait_for_auth, StateData)
|
fsm_next_state(wait_for_auth, StateData)
|
||||||
end;
|
end;
|
||||||
@ -1134,8 +1134,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
{false, Attrs, StateData}
|
{false, Attrs, StateData}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
% XXX OLD FORMAT: broadcast?
|
#xmlel{name = 'broadcast', attrs = Attrs} ->
|
||||||
#xmlel{ns = _NS, name = 'broadcast', attrs = Attrs} ->
|
|
||||||
% XXX OLD FORMAT: Els are #xmlelement.
|
% XXX OLD FORMAT: Els are #xmlelement.
|
||||||
Els = PacketOld#xmlelement.children,
|
Els = PacketOld#xmlelement.children,
|
||||||
?DEBUG("broadcast~n~p~n", [Els]),
|
?DEBUG("broadcast~n~p~n", [Els]),
|
||||||
@ -1182,8 +1181,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
gen_iq_handler:handle(Host, Module, Function, Opts,
|
gen_iq_handler:handle(Host, Module, Function, Opts,
|
||||||
FromOld, ToOld, IQ);
|
FromOld, ToOld, IQ);
|
||||||
[] ->
|
[] ->
|
||||||
Err = exmpp_stanza:error('feature-not-implemented'),
|
Res = exmpp_iq:error(Packet, 'feature-not-implemented'),
|
||||||
Res = exmpp_iq:error(Packet, Err),
|
|
||||||
ejabberd_router:route(To, From, Res)
|
ejabberd_router:route(To, From, Res)
|
||||||
end,
|
end,
|
||||||
{false, Attrs, StateData};
|
{false, Attrs, StateData};
|
||||||
@ -1200,9 +1198,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
allow ->
|
allow ->
|
||||||
{true, Attrs, StateData};
|
{true, Attrs, StateData};
|
||||||
deny ->
|
deny ->
|
||||||
Err = exmpp_stanza:error(
|
Res = exmpp_iq:error(Packet, 'feature-not-implemented'),
|
||||||
'feature-not-implemented'),
|
|
||||||
Res = exmpp_iq:error(Packet, Err),
|
|
||||||
ejabberd_router:route(To, From, Res),
|
ejabberd_router:route(To, From, Res),
|
||||||
{false, Attrs, StateData}
|
{false, Attrs, StateData}
|
||||||
end
|
end
|
||||||
@ -1975,10 +1971,9 @@ process_unauthenticated_stanza(StateData, El) ->
|
|||||||
% The only reasonable IQ's here are auth and register IQ's
|
% The only reasonable IQ's here are auth and register IQ's
|
||||||
% They contain secrets, so don't include subelements to response
|
% They contain secrets, so don't include subelements to response
|
||||||
ResIQ = exmpp_iq:error_without_original(El,
|
ResIQ = exmpp_iq:error_without_original(El,
|
||||||
exmpp_stanza:error(El#xmlel.ns, 'service-unavailable')),
|
'service-unavailable'),
|
||||||
Res1 = exmpp_stanza:set_sender(ResIQ,
|
Res1 = exmpp_stanza:set_sender(ResIQ,
|
||||||
exmpp_jid:make_bare_jid(undefined,
|
exmpp_jid:make_bare_jid(StateData#state.server)),
|
||||||
StateData#state.server)),
|
|
||||||
Res2 = exmpp_stanza:remove_recipient(Res1),
|
Res2 = exmpp_stanza:remove_recipient(Res1),
|
||||||
send_element(StateData, Res2);
|
send_element(StateData, Res2);
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -291,7 +291,7 @@ do_route(From, To, Packet) ->
|
|||||||
"result" -> ok;
|
"result" -> ok;
|
||||||
_ ->
|
_ ->
|
||||||
Err = exmpp_stanza:reply_with_error(Packet,
|
Err = exmpp_stanza:reply_with_error(Packet,
|
||||||
exmpp_stanza:error('service-unavailable')),
|
'service-unavailable'),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end,
|
end,
|
||||||
false
|
false
|
||||||
|
@ -346,7 +346,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
Conns = ?DICT:store({LFrom, LTo}, wait_for_verification,
|
Conns = ?DICT:store({LFrom, LTo}, wait_for_verification,
|
||||||
StateData#state.connections),
|
StateData#state.connections),
|
||||||
change_shaper(StateData, LTo,
|
change_shaper(StateData, LTo,
|
||||||
exmpp_jid:make_bare_jid(undefined, LFrom)),
|
exmpp_jid:make_bare_jid(LFrom)),
|
||||||
{next_state,
|
{next_state,
|
||||||
stream_established,
|
stream_established,
|
||||||
StateData#state{connections = Conns,
|
StateData#state{connections = Conns,
|
||||||
|
@ -812,8 +812,7 @@ bounce_element(El, Condition) ->
|
|||||||
"error" -> ok;
|
"error" -> ok;
|
||||||
"result" -> ok;
|
"result" -> ok;
|
||||||
_ ->
|
_ ->
|
||||||
Error = exmpp_stanza:error(El#xmlel.ns, Condition),
|
Err = exmpp_stanza:reply_with_error(El, Condition),
|
||||||
Err = exmpp_stanza:reply_with_error(El, Error),
|
|
||||||
From = exmpp_jid:string_to_jid(exmpp_stanza:get_sender(El)),
|
From = exmpp_jid:string_to_jid(exmpp_stanza:get_sender(El)),
|
||||||
To = exmpp_jid:string_to_jid(exmpp_stanza:get_recipient(El)),
|
To = exmpp_jid:string_to_jid(exmpp_stanza:get_recipient(El)),
|
||||||
% No namespace conversion (:server <-> :client) is done.
|
% No namespace conversion (:server <-> :client) is done.
|
||||||
|
Loading…
Reference in New Issue
Block a user