25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Minor cosmetic changes on pubsub code

This commit is contained in:
Christophe Romain 2016-11-15 18:35:20 +01:00
parent 4d4ad922a2
commit 2929f5b5bc
5 changed files with 9 additions and 10 deletions

View File

@ -251,7 +251,7 @@ init([ServerHost, Opts]) ->
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,
@ -262,7 +262,7 @@ init([ServerHost, 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(),
@ -3899,8 +3899,7 @@ purge_offline(Host, LJID, Node) ->
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) ->

View File

@ -50,7 +50,7 @@
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},

View File

@ -61,7 +61,7 @@
encode_host_like/1]).
init(_Host, _ServerHost, _Opts) ->
%%pubsub_subscription_sql:init(),
%%pubsub_subscription_sql:init(Host, ServerHost, Opts),
ok.
terminate(_Host, _ServerHost) ->

View File

@ -28,7 +28,7 @@
-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]).
@ -73,7 +73,7 @@
%%====================================================================
%% 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])

View File

@ -28,7 +28,7 @@
-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]).
@ -71,7 +71,7 @@
%% 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()}.