24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-24 22:25:47 +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_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>
* 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,
case mnesia:transaction(F) of
{atomic, {Module, Function}} ->
% XXX OLD FORMAT: 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);
Module:Function(From, To, Packet);
_ ->
ok
end

View File

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

View File

@ -62,13 +62,6 @@
disco_requests = ?DICT:new(),
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
%% <presence/> stanza) and returns an opaque value representing the
%% 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]),
{noreply, State}
end;
handle_cast({disco_response, From, _To,
#iq{type = Type, id = ID,
sub_el = SubEls}},
handle_cast({disco_response, From, _To, IQ},
#state{disco_requests = Requests} = State) ->
case {Type, SubEls} of
{result, [{xmlelement, "query", _Attrs, Els}]} ->
ID = exmpp_stanza:get_id(IQ),
case {exmpp_iq:get_type(IQ), exmpp_iq:get_payload(IQ)} of
{result, #xmlel{name = 'query', children = Els}} ->
case ?DICT:find(ID, Requests) of
{ok, {Node, SubNode}} ->
Features =
lists:flatmap(fun({xmlelement, "feature", FAttrs, _}) ->
[xml:get_attr_s("var", FAttrs)];
lists:flatmap(fun(#xmlel{name = 'feature'} = F) ->
[exmpp_xml:get_attribute(F, 'var')];
(_) ->
[]
end, Els),
@ -262,9 +254,9 @@ handle_cast({disco_response, From, _To,
?ERROR_MSG("ID '~s' matches no query", [ID])
end;
%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, _} ->
?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
ok