mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Minor cosmetic changes on pubsub code
This commit is contained in:
parent
4d4ad922a2
commit
2929f5b5bc
@ -251,7 +251,7 @@ init([ServerHost, Opts]) ->
|
|||||||
Host = gen_mod:get_opt_host(ServerHost, Opts, <<"pubsub.@HOST@">>),
|
Host = gen_mod:get_opt_host(ServerHost, Opts, <<"pubsub.@HOST@">>),
|
||||||
ejabberd_router:register_route(Host, ServerHost),
|
ejabberd_router:register_route(Host, ServerHost),
|
||||||
Access = gen_mod:get_opt(access_createnode, Opts,
|
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,
|
PepOffline = gen_mod:get_opt(ignore_pep_from_offline, Opts,
|
||||||
fun(A) when is_boolean(A) -> A end, true),
|
fun(A) when is_boolean(A) -> A end, true),
|
||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts,
|
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),
|
fun(A) when is_integer(A) andalso A >= 0 -> A end, ?MAXITEMS),
|
||||||
MaxSubsNode = gen_mod:get_opt(max_subscriptions_node, Opts,
|
MaxSubsNode = gen_mod:get_opt(max_subscriptions_node, Opts,
|
||||||
fun(A) when is_integer(A) andalso A >= 0 -> A end, undefined),
|
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),
|
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
|
||||||
DefaultModule = plugin(Host, hd(Plugins)),
|
DefaultModule = plugin(Host, hd(Plugins)),
|
||||||
BaseOptions = DefaultModule:options(),
|
BaseOptions = DefaultModule:options(),
|
||||||
@ -3899,8 +3899,7 @@ purge_offline(Host, LJID, Node) ->
|
|||||||
Error
|
Error
|
||||||
end.
|
end.
|
||||||
|
|
||||||
mod_opt_type(access_createnode) ->
|
mod_opt_type(access_createnode) -> fun acl:access_rules_validator/1;
|
||||||
fun (A) when is_atom(A) -> A end;
|
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
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(host) -> fun iolist_to_binary/1;
|
||||||
mod_opt_type(ignore_pep_from_offline) ->
|
mod_opt_type(ignore_pep_from_offline) ->
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
path_to_node/1, can_fetch_item/2, is_subscribed/1]).
|
path_to_node/1, can_fetch_item/2, is_subscribed/1]).
|
||||||
|
|
||||||
init(_Host, _ServerHost, _Opts) ->
|
init(_Host, _ServerHost, _Opts) ->
|
||||||
%pubsub_subscription:init(),
|
%pubsub_subscription:init(Host, ServerHost, Opts),
|
||||||
mnesia:create_table(pubsub_state,
|
mnesia:create_table(pubsub_state,
|
||||||
[{disc_copies, [node()]},
|
[{disc_copies, [node()]},
|
||||||
{type, ordered_set},
|
{type, ordered_set},
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
encode_host_like/1]).
|
encode_host_like/1]).
|
||||||
|
|
||||||
init(_Host, _ServerHost, _Opts) ->
|
init(_Host, _ServerHost, _Opts) ->
|
||||||
%%pubsub_subscription_sql:init(),
|
%%pubsub_subscription_sql:init(Host, ServerHost, Opts),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
terminate(_Host, _ServerHost) ->
|
terminate(_Host, _ServerHost) ->
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
-author("bjc@kublai.com").
|
-author("bjc@kublai.com").
|
||||||
|
|
||||||
%% API
|
%% 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,
|
get_subscription/3, set_subscription/4,
|
||||||
make_subid/0,
|
make_subid/0,
|
||||||
get_options_xform/2, parse_options_xform/1]).
|
get_options_xform/2, parse_options_xform/1]).
|
||||||
@ -73,7 +73,7 @@
|
|||||||
%%====================================================================
|
%%====================================================================
|
||||||
%% API
|
%% API
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
init() -> ok = create_table().
|
init(_Host, _ServerHost, _Opts) -> ok = create_table().
|
||||||
|
|
||||||
subscribe_node(JID, NodeId, Options) ->
|
subscribe_node(JID, NodeId, Options) ->
|
||||||
case catch mnesia:sync_dirty(fun add_subscription/3, [JID, NodeId, Options])
|
case catch mnesia:sync_dirty(fun add_subscription/3, [JID, NodeId, Options])
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
-author("pablo.polvorin@process-one.net").
|
-author("pablo.polvorin@process-one.net").
|
||||||
|
|
||||||
%% API
|
%% 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,
|
get_subscription/3, set_subscription/4,
|
||||||
make_subid/0,
|
make_subid/0,
|
||||||
get_options_xform/2, parse_options_xform/1]).
|
get_options_xform/2, parse_options_xform/1]).
|
||||||
@ -71,7 +71,7 @@
|
|||||||
%% API
|
%% API
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
|
|
||||||
init() -> ok = create_table().
|
init(_Host, _ServerHost, _Opts) -> ok = create_table().
|
||||||
|
|
||||||
-spec subscribe_node(_JID :: _, _NodeId :: _, Options :: [] | mod_pubsub:subOptions()) ->
|
-spec subscribe_node(_JID :: _, _NodeId :: _, Options :: [] | mod_pubsub:subOptions()) ->
|
||||||
{result, mod_pubsub:subId()}.
|
{result, mod_pubsub:subId()}.
|
||||||
|
Loading…
Reference in New Issue
Block a user