Host = gen_mod:get_opt_host(ServerHost, Opts, <<"pubsub.@HOST@">>),
ejabberd_router:register_route(Host, ServerHost),
Access = gen_mod:get_opt(access_createnode, Opts,
- fun(A) when is_atom(A) -> A end, all),
+ fun acl:access_rules_validator/1, all),
PepOffline = gen_mod:get_opt(ignore_pep_from_offline, Opts,
fun(A) when is_boolean(A) -> A end, true),
IQDisc = gen_mod:get_opt(iqdisc, Opts,
fun(A) when is_integer(A) andalso A >= 0 -> A end, ?MAXITEMS),
MaxSubsNode = gen_mod:get_opt(max_subscriptions_node, Opts,
fun(A) when is_integer(A) andalso A >= 0 -> A end, undefined),
- pubsub_index:init(Host, ServerHost, Opts),
+ [pubsub_index:init(Host, ServerHost, Opts) || gen_mod:db_type(ServerHost, ?MODULE)==mnesia],
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
DefaultModule = plugin(Host, hd(Plugins)),
BaseOptions = DefaultModule:options(),
Error
end.
-mod_opt_type(access_createnode) ->
- fun (A) when is_atom(A) -> A end;
+mod_opt_type(access_createnode) -> fun acl:access_rules_validator/1;
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
mod_opt_type(host) -> fun iolist_to_binary/1;
mod_opt_type(ignore_pep_from_offline) ->
path_to_node/1, can_fetch_item/2, is_subscribed/1]).
init(_Host, _ServerHost, _Opts) ->
- %pubsub_subscription:init(),
+ %pubsub_subscription:init(Host, ServerHost, Opts),
mnesia:create_table(pubsub_state,
[{disc_copies, [node()]},
{type, ordered_set},
encode_host_like/1]).
init(_Host, _ServerHost, _Opts) ->
- %%pubsub_subscription_sql:init(),
+ %%pubsub_subscription_sql:init(Host, ServerHost, Opts),
ok.
terminate(_Host, _ServerHost) ->
-author("bjc@kublai.com").
%% API
--export([init/0, subscribe_node/3, unsubscribe_node/3,
+-export([init/3, subscribe_node/3, unsubscribe_node/3,
get_subscription/3, set_subscription/4,
make_subid/0,
get_options_xform/2, parse_options_xform/1]).
%%====================================================================
%% API
%%====================================================================
-init() -> ok = create_table().
+init(_Host, _ServerHost, _Opts) -> ok = create_table().
subscribe_node(JID, NodeId, Options) ->
case catch mnesia:sync_dirty(fun add_subscription/3, [JID, NodeId, Options])
-author("pablo.polvorin@process-one.net").
%% API
--export([init/0, subscribe_node/3, unsubscribe_node/3,
+-export([init/3, subscribe_node/3, unsubscribe_node/3,
get_subscription/3, set_subscription/4,
make_subid/0,
get_options_xform/2, parse_options_xform/1]).
%% API
%%====================================================================
-init() -> ok = create_table().
+init(_Host, _ServerHost, _Opts) -> ok = create_table().
-spec subscribe_node(_JID :: _, _NodeId :: _, Options :: [] | mod_pubsub:subOptions()) ->
{result, mod_pubsub:subId()}.