mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
o Use a macro in ?DEFAULT_NS instead of the namespace atom directly.
o Comment DBGFSM our again. o Remove macro ERR_SERVICE_UNAVAILABLE. o In wait_for_auth and is_auth_packet, an empty resource is returned as 'undefined', not the empty string in the {auth, ...} tuple. o In handle_sync_event, remove a debugging printf. o In handle_info({route, ...}), use macro IS_PRESENCE & friends instead of direct matching with NS_JABBER_CLIENT and name. This way, the S2S doesn't have to change the namespace of all its incoming stanzas to NS_JABBER_CLIENT. o In send_element, for stanzas under the NS_JABBER_SERVER namespace, lie to exmpp_xml by telling it that this namespace is the default one. SVN Revision: 1382
This commit is contained in:
parent
999f3233bb
commit
1a311a30b5
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2008-06-26 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
|
* src/ejabberd_c2s.erl: Use a macro in ?DEFAULT_NS instead of the
|
||||||
|
namespace atom directly. Comment DBGFSM our again. Remove macro
|
||||||
|
ERR_SERVICE_UNAVAILABLE.
|
||||||
|
(wait_for_auth, is_auth_packet): An empty resource is returned as
|
||||||
|
'undefined', not the empty string in the {auth, ...} tuple.
|
||||||
|
(handle_sync_event): Remove a debugging printf.
|
||||||
|
(handle_info/{route, ...}): Use macro IS_PRESENCE & friends instead of
|
||||||
|
direct matching with NS_JABBER_CLIENT and name. This way, the S2S
|
||||||
|
doesn't have to change the namespace of all its incoming stanzas to
|
||||||
|
NS_JABBER_CLIENT.
|
||||||
|
(send_element): For stanzas under the NS_JABBER_SERVER namespace, lie
|
||||||
|
to exmpp_xml by telling it that this namespace is the default one.
|
||||||
|
|
||||||
2008-06-25 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-06-25 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl: Finish ejabberd_c2s conversion with the
|
* src/ejabberd_c2s.erl: Finish ejabberd_c2s conversion with the
|
||||||
|
@ -94,11 +94,11 @@
|
|||||||
|
|
||||||
%-define(DBGFSM, true).
|
%-define(DBGFSM, true).
|
||||||
|
|
||||||
%-ifdef(DBGFSM).
|
-ifdef(DBGFSM).
|
||||||
-define(FSMOPTS, [{debug, [trace]}]).
|
-define(FSMOPTS, [{debug, [trace]}]).
|
||||||
%-else.
|
-else.
|
||||||
%-define(FSMOPTS, []).
|
-define(FSMOPTS, []).
|
||||||
%-endif.
|
-endif.
|
||||||
|
|
||||||
%% Module start with or without supervisor:
|
%% Module start with or without supervisor:
|
||||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
||||||
@ -116,7 +116,7 @@
|
|||||||
|
|
||||||
% These are the namespace already declared by the stream opening. This is
|
% These are the namespace already declared by the stream opening. This is
|
||||||
% used at serialization time.
|
% used at serialization time.
|
||||||
-define(DEFAULT_NS, ['jabber:client']).
|
-define(DEFAULT_NS, [?NS_JABBER_CLIENT]).
|
||||||
-define(PREFIXED_NS, [{?NS_XMPP, "stream"}]).
|
-define(PREFIXED_NS, [{?NS_XMPP, "stream"}]).
|
||||||
|
|
||||||
% XXX OLD FORMAT
|
% XXX OLD FORMAT
|
||||||
@ -126,7 +126,6 @@
|
|||||||
exmpp_xml:xmlel_to_xmlelement(exmpp_stanza:error(Condition),
|
exmpp_xml:xmlel_to_xmlelement(exmpp_stanza:error(Condition),
|
||||||
[?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')).
|
||||||
-define(ERR_SERVICE_UNAVAILABLE, ?STANZA_ERROR('service-unavialable')).
|
|
||||||
|
|
||||||
-record(iq, {id = "",
|
-record(iq, {id = "",
|
||||||
type,
|
type,
|
||||||
@ -387,7 +386,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
send_element(StateData,
|
send_element(StateData,
|
||||||
exmpp_server_legacy_auth:fields(El, Fields)),
|
exmpp_server_legacy_auth:fields(El, Fields)),
|
||||||
fsm_next_state(wait_for_auth, StateData);
|
fsm_next_state(wait_for_auth, StateData);
|
||||||
{auth, _ID, set, {_U, _P, _D, ""}} ->
|
{auth, _ID, set, {_U, _P, _D, undefined}} ->
|
||||||
Err = exmpp_stanza:error('not-acceptable',
|
Err = exmpp_stanza:error('not-acceptable',
|
||||||
{"en", "No resource provided"}),
|
{"en", "No resource provided"}),
|
||||||
send_element(StateData, exmpp_iq:error(El, Err)),
|
send_element(StateData, exmpp_iq:error(El, Err)),
|
||||||
@ -988,7 +987,6 @@ handle_sync_event(get_subscribed_and_online, _From, StateName, StateData) ->
|
|||||||
?SETS:is_element(User, Subscribed)
|
?SETS:is_element(User, Subscribed)
|
||||||
end,
|
end,
|
||||||
SubscribedAndOnline = ?DICT:filter(Pred, Online),
|
SubscribedAndOnline = ?DICT:filter(Pred, Online),
|
||||||
io:format("===== SubscribedAndOnline = ~p~n", [SubscribedAndOnline]),
|
|
||||||
{reply, ?DICT:to_list(SubscribedAndOnline), StateName, StateData};
|
{reply, ?DICT:to_list(SubscribedAndOnline), StateName, StateData};
|
||||||
|
|
||||||
handle_sync_event(_Event, _From, StateName, StateData) ->
|
handle_sync_event(_Event, _From, StateName, StateData) ->
|
||||||
@ -1021,7 +1019,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
||||||
{Pass, NewAttrs, NewState} =
|
{Pass, NewAttrs, NewState} =
|
||||||
case Packet of
|
case Packet of
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'presence', attrs = Attrs} ->
|
#xmlel{attrs = Attrs} when ?IS_PRESENCE(Packet) ->
|
||||||
case exmpp_presence:get_type(Packet) of
|
case exmpp_presence:get_type(Packet) of
|
||||||
'probe' ->
|
'probe' ->
|
||||||
% XXX OLD FORMAT: LFrom and LBFrom.
|
% XXX OLD FORMAT: LFrom and LBFrom.
|
||||||
@ -1172,7 +1170,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
{false, Attrs, StateData}
|
{false, Attrs, StateData}
|
||||||
end;
|
end;
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'iq', attrs = Attrs} ->
|
#xmlel{attrs = Attrs} when ?IS_IQ(Packet) ->
|
||||||
case exmpp_iq:is_request(Packet) of
|
case exmpp_iq:is_request(Packet) of
|
||||||
true ->
|
true ->
|
||||||
case exmpp_iq:get_request(Packet) of
|
case exmpp_iq:get_request(Packet) of
|
||||||
@ -1224,7 +1222,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
false ->
|
false ->
|
||||||
{true, Attrs, StateData}
|
{true, Attrs, StateData}
|
||||||
end;
|
end;
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', attrs = Attrs} ->
|
#xmlel{attrs = Attrs} when ?IS_MESSAGE(Packet) ->
|
||||||
% XXX OLD FORMAT: From, To and Packet.
|
% XXX OLD FORMAT: From, To and Packet.
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
privacy_check_packet, StateData#state.server,
|
privacy_check_packet, StateData#state.server,
|
||||||
@ -1350,8 +1348,14 @@ send_text(StateData, Text) ->
|
|||||||
?DEBUG("Send XML on stream = ~p", [lists:flatten(Text)]),
|
?DEBUG("Send XML on stream = ~p", [lists:flatten(Text)]),
|
||||||
(StateData#state.sockmod):send(StateData#state.socket, Text).
|
(StateData#state.sockmod):send(StateData#state.socket, Text).
|
||||||
|
|
||||||
|
send_element(StateData, #xmlel{ns = ?NS_XMPP, name = 'stream'} = El) ->
|
||||||
|
send_text(StateData, exmpp_xml:document_to_list(El));
|
||||||
|
send_element(StateData, #xmlel{ns = ?NS_JABBER_SERVER} = El) ->
|
||||||
|
send_text(StateData, exmpp_xml:document_fragment_to_list(El,
|
||||||
|
[?NS_JABBER_SERVER], ?PREFIXED_NS));
|
||||||
send_element(StateData, El) ->
|
send_element(StateData, El) ->
|
||||||
send_text(StateData, xml:element_to_string(El)).
|
send_text(StateData, exmpp_xml:document_fragment_to_list(El,
|
||||||
|
?DEFAULT_NS, ?PREFIXED_NS)).
|
||||||
|
|
||||||
|
|
||||||
new_id() ->
|
new_id() ->
|
||||||
@ -1366,7 +1370,7 @@ is_auth_packet(El) ->
|
|||||||
#iq{id = ID, type = Type, xmlns = ?NS_AUTH, sub_el = SubEl} ->
|
#iq{id = ID, type = Type, xmlns = ?NS_AUTH, sub_el = SubEl} ->
|
||||||
{xmlelement, _, _, Els} = SubEl,
|
{xmlelement, _, _, Els} = SubEl,
|
||||||
{auth, ID, Type,
|
{auth, ID, Type,
|
||||||
get_auth_tags(Els, "", "", "", "")};
|
get_auth_tags(Els, "", "", "", undefined)};
|
||||||
_ ->
|
_ ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user