From d327119cf7d60427a52a58ce3f6f78a389be37e8 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sun, 25 Sep 2016 10:17:03 +0300 Subject: [PATCH] Text legacy IQ handler support --- test/ejabberd_SUITE.erl | 9 ++++++++ test/ejabberd_SUITE_data/ejabberd.yml | 1 + test/mod_legacy.erl | 32 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 test/mod_legacy.erl diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl index 4e02389d4..81e35d52a 100644 --- a/test/ejabberd_SUITE.erl +++ b/test/ejabberd_SUITE.erl @@ -303,6 +303,7 @@ no_db_tests() -> unsupported_query, bad_nonza, invalid_from, + legacy_iq, ping, version, time, @@ -895,6 +896,14 @@ presence_broadcast(Config) -> end, [], [0, 100, 200, 2000, 5000, 10000]), 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) -> true = is_feature_advertised(Config, ?NS_PING), #iq{type = result, sub_els = []} = diff --git a/test/ejabberd_SUITE_data/ejabberd.yml b/test/ejabberd_SUITE_data/ejabberd.yml index c9ea5fd7a..2d2e098de 100644 --- a/test/ejabberd_SUITE_data/ejabberd.yml +++ b/test/ejabberd_SUITE_data/ejabberd.yml @@ -442,6 +442,7 @@ modules: mod_disco: [] mod_ping: [] mod_proxy65: [] + mod_legacy: [] mod_register: welcome_message: subject: "Welcome!" diff --git a/test/mod_legacy.erl b/test/mod_legacy.erl new file mode 100644 index 000000000..6024acfeb --- /dev/null +++ b/test/mod_legacy.erl @@ -0,0 +1,32 @@ +%%%------------------------------------------------------------------- +%%% @author Evgeny Khramtsov +%%% @copyright (C) 2016, Evgeny Khramtsov +%%% @doc +%%% +%%% @end +%%% Created : 25 Sep 2016 by Evgeny Khramtsov +%%%------------------------------------------------------------------- +-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 = []}. -- 2.40.0