%% Deprecated functions
-export([get_opt/3, get_opt/4, get_module_opt/4, get_module_opt/5,
get_opt_host/3, get_opt_hosts/3, db_type/2, db_type/3,
- ram_db_type/2, ram_db_type/3]).
+ ram_db_type/2, ram_db_type/3, update_module_opts/3]).
-deprecated([{get_opt, 3},
{get_opt, 4},
{get_opt_host, 3},
#ejabberd_module{module_host = {Module, Host},
opts = Opts, order = Order}).
+-spec update_module_opts(binary(), module(), opts()) -> ok | {ok, pid()} | error.
+update_module_opts(Host, Module, NewValues) ->
+ case ets:lookup(ejabberd_modules, {Module, Host}) of
+ #ejabberd_module{opts = Opts, order = Order} ->
+ NewOpts = lists:foldl(
+ fun({K, _} = KV, Acc) ->
+ lists:keystore(K, 1, Acc, KV)
+ end, Opts, NewValues),
+ reload_module(Host, Module, NewOpts, Opts, Order);
+ _ ->
+ error
+ end.
+
maybe_halt_ejabberd() ->
case is_app_running(ejabberd) of
false ->
master_slave_cases() ->
{offline_master_slave, [sequence],
[master_slave_test(flex),
- master_slave_test(send_all)]}.
+ master_slave_test(send_all),
+ master_slave_test(from_mam)]}.
flex_master(Config) ->
send_messages(Config, 5),
0 = get_number(Config),
clean(disconnect(Config)).
+offline_from_mam_master(Config) ->
+ Server = ?config(server, Config),
+ gen_mod:update_module_opts(Server, mod_offline, [{use_mam_for_storage, true}]),
+ send_all_master(Config),
+ gen_mod:update_module_opts(Server, mod_offline, [{use_mam_for_storage, false}]),
+ wait_for_slave(Config).
+
+offline_from_mam_slave(Config) ->
+ send_all_slave(Config),
+ wait_for_master(Config).
+
send_all_master(Config) ->
wait_for_slave(Config),
Peer = ?config(peer, Config),
MyBareJID = jid:remove_resource(MyJID),
Peer = ?config(peer, Config),
Peer_s = jid:encode(Peer),
- ct:comment("Getting headers"),
+ ct:comment("Getting headers"),
#iq{type = result,
sub_els = [#disco_items{
node = ?NS_FLEX_OFFLINE,