mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Do not use the #iq record anymore internally. However it's still created
and passed to other modules. SVN Revision: 1405
This commit is contained in:
parent
5317dd64d7
commit
48cf5cb84a
@ -39,6 +39,10 @@
|
||||
|
||||
* src/ejabberd_router.erl: Change warning message.
|
||||
|
||||
* src/ejabberd_sm.erl, src/ejabberd_c2s.erl, src/ejabberd_local.erl,
|
||||
src/gen_iq_handler.erl: Do not use the #iq record anymore internally.
|
||||
However it's still created and passed to other modules.
|
||||
|
||||
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||
|
||||
* src/Makefile.in: Remove the -I flag for exmpp includes; the
|
||||
|
@ -124,13 +124,6 @@
|
||||
[?NS_JABBER_CLIENT], [{?NS_XMPP, "stream"}])).
|
||||
-define(ERR_FEATURE_NOT_IMPLEMENTED, ?STANZA_ERROR('feature-not-implemented')).
|
||||
|
||||
% XXX OLD FORMAT: Re-include jlib.hrl (after clean-up).
|
||||
-record(iq, {id = "",
|
||||
type,
|
||||
xmlns = "",
|
||||
lang = "",
|
||||
sub_el}).
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% API
|
||||
%%%----------------------------------------------------------------------
|
||||
@ -546,7 +539,7 @@ wait_for_feature_request({xmlstreamelement, #xmlel{ns = NS, name = Name} = El},
|
||||
certfile, 1, StateData#state.tls_options)]
|
||||
end,
|
||||
Socket = StateData#state.socket,
|
||||
Proceed = exmpp_xml:document_fragment_to_list(
|
||||
Proceed = exmpp_xml:node_to_list(
|
||||
exmpp_server_tls:proceed(), [?DEFAULT_NS], ?PREFIXED_NS),
|
||||
TLSSocket = (StateData#state.sockmod):starttls(
|
||||
Socket, TLSOpts,
|
||||
@ -1825,10 +1818,8 @@ update_priority(Priority, Packet, StateData) ->
|
||||
process_privacy_iq(From, To,
|
||||
El,
|
||||
StateData) ->
|
||||
% XXX OLD FORMAT: IQ is #iq.
|
||||
ElOld = exmpp_xml:xmlel_to_xmlelement(El,
|
||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||
IQOld = jlib:iq_query_info(ElOld),
|
||||
% XXX OLD FORMAT: IQ_Rec is an #iq.
|
||||
IQ_Rec = jlib:iq_query_info(El),
|
||||
% XXX OLD FORMAT: JIDs.
|
||||
FromOld = jlib:to_old_jid(From),
|
||||
ToOld = jlib:to_old_jid(To),
|
||||
@ -1838,13 +1829,13 @@ process_privacy_iq(From, To,
|
||||
R = ejabberd_hooks:run_fold(
|
||||
privacy_iq_get, StateData#state.server,
|
||||
{error, ?ERR_FEATURE_NOT_IMPLEMENTED},
|
||||
[FromOld, ToOld, IQOld, StateData#state.privacy_list]),
|
||||
[FromOld, ToOld, IQ_Rec, StateData#state.privacy_list]),
|
||||
{R, StateData};
|
||||
set ->
|
||||
case ejabberd_hooks:run_fold(
|
||||
privacy_iq_set, StateData#state.server,
|
||||
{error, ?ERR_FEATURE_NOT_IMPLEMENTED},
|
||||
[FromOld, ToOld, IQOld]) of
|
||||
[FromOld, ToOld, IQ_Rec]) of
|
||||
{result, R, NewPrivList} ->
|
||||
{{result, R},
|
||||
StateData#state{privacy_list = NewPrivList}};
|
||||
@ -1930,13 +1921,14 @@ resend_subscription_requests(#state{user = User,
|
||||
PendingSubscriptions).
|
||||
|
||||
process_unauthenticated_stanza(StateData, El) ->
|
||||
ElOld = exmpp_xml:xmlel_to_xmlelement(El, [?DEFAULT_NS], ?PREFIXED_NS),
|
||||
case jlib:iq_query_info(ElOld) of
|
||||
IQ when is_record(IQ, iq) ->
|
||||
case exmpp_iq:get_kind(El) of
|
||||
request ->
|
||||
% XXX OLD FORMAT: IQ_Rec is an #iq.
|
||||
IQ_Rec = jlib:iq_query_info(El),
|
||||
ResOld = ejabberd_hooks:run_fold(c2s_unauthenticated_iq,
|
||||
StateData#state.server,
|
||||
empty,
|
||||
[StateData#state.server, IQ,
|
||||
[StateData#state.server, IQ_Rec,
|
||||
StateData#state.ip]),
|
||||
case ResOld of
|
||||
empty ->
|
||||
|
@ -77,18 +77,14 @@ process_iq(From, To, Packet) ->
|
||||
request ->
|
||||
Host = To#jid.ldomain,
|
||||
Request = exmpp_iq:get_request(Packet),
|
||||
XMLNS = case Request#xmlel.ns of
|
||||
NS when is_atom(NS) -> atom_to_list(NS);
|
||||
NS -> NS
|
||||
end,
|
||||
XMLNS = exmpp_xml:get_ns_as_list(Request),
|
||||
case ets:lookup(?IQTABLE, {XMLNS, Host}) of
|
||||
[{_, Module, Function}] ->
|
||||
% XXX OLD FORMAT: From, To, Packet.
|
||||
% XXX OLD FORMAT: From, To.
|
||||
FromOld = jlib:to_old_jid(From),
|
||||
ToOld = jlib:to_old_jid(To),
|
||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||
IQ_Rec = jlib:iq_query_info(PacketOld),
|
||||
% XXX OLD FORMAT: IQ_Rec is an #iq.
|
||||
IQ_Rec = jlib:iq_query_info(Packet),
|
||||
ResIQ = Module:Function(FromOld, ToOld, IQ_Rec),
|
||||
if
|
||||
ResIQ /= ignore ->
|
||||
|
@ -74,13 +74,6 @@
|
||||
{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}
|
||||
]).
|
||||
|
||||
% XXX OLD FORMAT: Re-include jlib.hrl (after clean-up).
|
||||
-record(iq, {id = "",
|
||||
type,
|
||||
xmlns = "",
|
||||
lang = "",
|
||||
sub_el}).
|
||||
|
||||
%%====================================================================
|
||||
%% API
|
||||
%%====================================================================
|
||||
@ -662,19 +655,19 @@ get_max_user_sessions(LUser, Host) ->
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
process_iq(From, To, Packet) ->
|
||||
% XXX OLD FORMAT: From, To, Packet.
|
||||
FromOld = jlib:to_old_jid(From),
|
||||
ToOld = jlib:to_old_jid(To),
|
||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||
IQ = jlib:iq_query_info(PacketOld),
|
||||
case IQ of
|
||||
#iq{xmlns = XMLNS} ->
|
||||
case exmpp_iq:get_kind(Packet) of
|
||||
request ->
|
||||
Host = To#jid.ldomain,
|
||||
Request = exmpp_iq:get_request(Packet),
|
||||
XMLNS = exmpp_xml:get_ns_as_list(Request),
|
||||
case ets:lookup(sm_iqtable, {XMLNS, Host}) of
|
||||
[{_, Module, Function}] ->
|
||||
% XXX OLD FORMAT: From, To, IQ.
|
||||
ResIQ = Module:Function(FromOld, ToOld, IQ),
|
||||
% XXX OLD FORMAT: From, To.
|
||||
FromOld = jlib:to_old_jid(From),
|
||||
ToOld = jlib:to_old_jid(To),
|
||||
% XXX OLD FORMAT: IQ_Rec is an #iq.
|
||||
IQ_Rec = jlib:iq_query_info(Packet),
|
||||
ResIQ = Module:Function(FromOld, ToOld, IQ_Rec),
|
||||
if
|
||||
ResIQ /= ignore ->
|
||||
% XXX OLD FORMAT: ResIQ.
|
||||
@ -686,14 +679,13 @@ process_iq(From, To, Packet) ->
|
||||
ok
|
||||
end;
|
||||
[{_, Module, Function, Opts}] ->
|
||||
% XXX OLD FORMAT: From, To, IQ.
|
||||
gen_iq_handler:handle(Host, Module, Function, Opts,
|
||||
From, To, Packet);
|
||||
[] ->
|
||||
Err = exmpp_iq:error(Packet, 'service-unavailable'),
|
||||
ejabberd_router:route(To, From, Err)
|
||||
end;
|
||||
reply ->
|
||||
response ->
|
||||
ok;
|
||||
_ ->
|
||||
Err = exmpp_iq:error(Packet, 'bad-request'),
|
||||
|
@ -227,14 +227,6 @@ convert_to_old_structs(From, To, IQ) ->
|
||||
true ->
|
||||
F = jlib:to_old_jid(From),
|
||||
T = jlib:to_old_jid(To),
|
||||
Default_NS = case lists:member({IQ#xmlel.ns, none},
|
||||
IQ#xmlel.declared_ns) of
|
||||
true -> [];
|
||||
false -> [IQ#xmlel.ns]
|
||||
end,
|
||||
IQOld = exmpp_xml:xmlel_to_xmlelement(IQ,
|
||||
Default_NS,
|
||||
[{?NS_XMPP, ?NS_XMPP_pfx}, {?NS_DIALBACK, ?NS_DIALBACK_pfx}]),
|
||||
I = jlib:iq_query_info(IQOld),
|
||||
{F, T, I}
|
||||
I_Rec = jlib:iq_query_info(IQ),
|
||||
{F, T, I_Rec}
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user