25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Text legacy IQ handler support

This commit is contained in:
Evgeniy Khramtsov 2016-09-25 10:17:03 +03:00
parent 3112a7187f
commit d327119cf7
3 changed files with 42 additions and 0 deletions

View File

@ -303,6 +303,7 @@ no_db_tests() ->
unsupported_query, unsupported_query,
bad_nonza, bad_nonza,
invalid_from, invalid_from,
legacy_iq,
ping, ping,
version, version,
time, time,
@ -895,6 +896,14 @@ presence_broadcast(Config) ->
end, [], [0, 100, 200, 2000, 5000, 10000]), end, [], [0, 100, 200, 2000, 5000, 10000]),
disconnect(Config). disconnect(Config).
legacy_iq(Config) ->
true = is_feature_advertised(Config, ?NS_EVENT),
ServerJID = server_jid(Config),
#iq{type = result, sub_els = []} =
send_recv(Config, #iq{to = ServerJID, type = get,
sub_els = [#xevent{}]}),
disconnect(Config).
ping(Config) -> ping(Config) ->
true = is_feature_advertised(Config, ?NS_PING), true = is_feature_advertised(Config, ?NS_PING),
#iq{type = result, sub_els = []} = #iq{type = result, sub_els = []} =

View File

@ -442,6 +442,7 @@ modules:
mod_disco: [] mod_disco: []
mod_ping: [] mod_ping: []
mod_proxy65: [] mod_proxy65: []
mod_legacy: []
mod_register: mod_register:
welcome_message: welcome_message:
subject: "Welcome!" subject: "Welcome!"

32
test/mod_legacy.erl Normal file
View File

@ -0,0 +1,32 @@
%%%-------------------------------------------------------------------
%%% @author Evgeny Khramtsov <ekhramtsov@process-one.net>
%%% @copyright (C) 2016, Evgeny Khramtsov
%%% @doc
%%%
%%% @end
%%% Created : 25 Sep 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net>
%%%-------------------------------------------------------------------
-module(mod_legacy).
-behaviour(gen_mod).
%% API
-export([start/2, stop/1, process_iq/3]).
-include("jlib.hrl").
%%%===================================================================
%%% API
%%%===================================================================
start(Host, Opts) ->
IQDisc = gen_mod:get_opt(iqdisc, Opts, fun gen_iq_handler:check_type/1,
one_queue),
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_EVENT,
?MODULE, process_iq, IQDisc).
stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?MODULE).
%%%===================================================================
%%% Internal functions
%%%===================================================================
process_iq(_From, _To, IQ) ->
IQ#iq{type = result, sub_el = []}.