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:
parent
3112a7187f
commit
d327119cf7
@ -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 = []} =
|
||||
|
@ -442,6 +442,7 @@ modules:
|
||||
mod_disco: []
|
||||
mod_ping: []
|
||||
mod_proxy65: []
|
||||
mod_legacy: []
|
||||
mod_register:
|
||||
welcome_message:
|
||||
subject: "Welcome!"
|
||||
|
32
test/mod_legacy.erl
Normal file
32
test/mod_legacy.erl
Normal 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 = []}.
|
Loading…
Reference in New Issue
Block a user