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

o Finish conversion to exmpp for mod_caps.

o  In ejabberd_loca, IQ response handler are now always called with
arguments in the new format.

SVN Revision: 1469
This commit is contained in:
Jean-Sébastien Pédron 2008-07-22 14:51:19 +00:00
parent 37b99639d4
commit adaf392156
4 changed files with 16 additions and 21 deletions

View File

@ -2,6 +2,12 @@
* src/mod_disco.erl, src/gen_iq_handler.erl: Convert to exmpp. * src/mod_disco.erl, src/gen_iq_handler.erl: Convert to exmpp.
* src/mod_caps.erl, src/gen_iq_handler.erl: Finish conversion to
exmpp.
* src/ejabberd_local.erl (process_iq_reply): IQ handler are now always
called with arguments in the new format.
2008-07-21 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2008-07-21 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/gen_iq_handler.erl: Prepare gen_iq_handler to pass arguments in * src/gen_iq_handler.erl: Prepare gen_iq_handler to pass arguments in

View File

@ -131,11 +131,7 @@ process_iq_reply(From, To, Packet) ->
end, end,
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, {Module, Function}} -> {atomic, {Module, Function}} ->
% XXX OLD FORMAT: From, To, Packet. Module:Function(From, To, Packet);
FromOld = jlib:to_old_jid(From),
ToOld = jlib:to_old_jid(To),
IQ_Rec = jlib:iq_query_or_response_info(Packet),
Module:Function(FromOld, ToOld, IQ_Rec);
_ -> _ ->
ok ok
end end

View File

@ -59,6 +59,7 @@
% XXX OLD FORMAT: modules not in the following list will receive % XXX OLD FORMAT: modules not in the following list will receive
% old format strudctures. % old format strudctures.
-define(CONVERTED_MODULES, [ -define(CONVERTED_MODULES, [
mod_caps,
mod_disco, mod_disco,
mod_roster, mod_roster,
mod_vcard mod_vcard

View File

@ -62,13 +62,6 @@
disco_requests = ?DICT:new(), disco_requests = ?DICT:new(),
feature_queries = []}). feature_queries = []}).
% XXX OLD FORMAT: Re-include jlib.hrl (after clean-up).
-record(iq, {id = "",
type,
xmlns = "",
lang = "",
sub_el}).
%% read_caps takes a list of XML elements (the child elements of a %% read_caps takes a list of XML elements (the child elements of a
%% <presence/> stanza) and returns an opaque value representing the %% <presence/> stanza) and returns an opaque value representing the
%% Entity Capabilities contained therein, or the atom nothing if no %% Entity Capabilities contained therein, or the atom nothing if no
@ -224,17 +217,16 @@ handle_cast({note_caps, From,
?ERROR_MSG("Transaction failed: ~p", [Error]), ?ERROR_MSG("Transaction failed: ~p", [Error]),
{noreply, State} {noreply, State}
end; end;
handle_cast({disco_response, From, _To, handle_cast({disco_response, From, _To, IQ},
#iq{type = Type, id = ID,
sub_el = SubEls}},
#state{disco_requests = Requests} = State) -> #state{disco_requests = Requests} = State) ->
case {Type, SubEls} of ID = exmpp_stanza:get_id(IQ),
{result, [{xmlelement, "query", _Attrs, Els}]} -> case {exmpp_iq:get_type(IQ), exmpp_iq:get_payload(IQ)} of
{result, #xmlel{name = 'query', children = Els}} ->
case ?DICT:find(ID, Requests) of case ?DICT:find(ID, Requests) of
{ok, {Node, SubNode}} -> {ok, {Node, SubNode}} ->
Features = Features =
lists:flatmap(fun({xmlelement, "feature", FAttrs, _}) -> lists:flatmap(fun(#xmlel{name = 'feature'} = F) ->
[xml:get_attr_s("var", FAttrs)]; [exmpp_xml:get_attribute(F, 'var')];
(_) -> (_) ->
[] []
end, Els), end, Els),
@ -262,9 +254,9 @@ handle_cast({disco_response, From, _To,
?ERROR_MSG("ID '~s' matches no query", [ID]) ?ERROR_MSG("ID '~s' matches no query", [ID])
end; end;
%gen_server:cast(self(), visit_feature_queries), %gen_server:cast(self(), visit_feature_queries),
%?DEBUG("Error IQ reponse from ~s:~n~p", [jlib:jid_to_string(From), SubEls]); %?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:jid_to_string(From), SubEls]);
{result, _} -> {result, _} ->
?DEBUG("Invalid IQ contents from ~s:~n~p", [jlib:jid_to_string(From), SubEls]); ?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_string(From), IQ#xmlel.children]);
_ -> _ ->
%% Can't do anything about errors %% Can't do anything about errors
ok ok