mirror of
https://github.com/processone/ejabberd.git
synced 2024-09-27 14:30:55 +02:00
remove need of extra _odbc in pubsub plugin name
This commit is contained in:
parent
222a94300b
commit
91948729e9
@ -62,11 +62,11 @@
|
|||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
-define(STDTREE, <<"tree_odbc">>).
|
-define(STDTREE, <<"tree">>).
|
||||||
|
|
||||||
-define(STDNODE, <<"flat_odbc">>).
|
-define(STDNODE, <<"flat">>).
|
||||||
|
|
||||||
-define(PEPNODE, <<"pep_odbc">>).
|
-define(PEPNODE, <<"pep">>).
|
||||||
|
|
||||||
%% exports for hooks
|
%% exports for hooks
|
||||||
-export([presence_probe/3, caps_update/3,
|
-export([presence_probe/3, caps_update/3,
|
||||||
@ -126,6 +126,8 @@
|
|||||||
|
|
||||||
-define(TREE_PREFIX, <<"nodetree_">>).
|
-define(TREE_PREFIX, <<"nodetree_">>).
|
||||||
|
|
||||||
|
-define(ODBC_SUFFIX, <<"_odbc">>),
|
||||||
|
|
||||||
%
|
%
|
||||||
-export_type([
|
-export_type([
|
||||||
host/0,
|
host/0,
|
||||||
@ -384,7 +386,8 @@ init_plugins(Host, ServerHost, Opts) ->
|
|||||||
TreePlugin =
|
TreePlugin =
|
||||||
jlib:binary_to_atom(<<(?TREE_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?TREE_PREFIX)/binary,
|
||||||
(gen_mod:get_opt(nodetree, Opts, fun(A) when is_list(A) -> A end,
|
(gen_mod:get_opt(nodetree, Opts, fun(A) when is_list(A) -> A end,
|
||||||
?STDTREE))/binary>>),
|
?STDTREE))/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
?DEBUG("** tree plugin is ~p", [TreePlugin]),
|
?DEBUG("** tree plugin is ~p", [TreePlugin]),
|
||||||
TreePlugin:init(Host, ServerHost, Opts),
|
TreePlugin:init(Host, ServerHost, Opts),
|
||||||
Plugins = gen_mod:get_opt(plugins, Opts,
|
Plugins = gen_mod:get_opt(plugins, Opts,
|
||||||
@ -395,7 +398,8 @@ init_plugins(Host, ServerHost, Opts) ->
|
|||||||
PluginsOK = lists:foldl(fun (Name, Acc) ->
|
PluginsOK = lists:foldl(fun (Name, Acc) ->
|
||||||
Plugin =
|
Plugin =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Name/binary>>),
|
Name/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
case catch apply(Plugin, init,
|
case catch apply(Plugin, init,
|
||||||
[Host, ServerHost, Opts])
|
[Host, ServerHost, Opts])
|
||||||
of
|
of
|
||||||
@ -414,7 +418,8 @@ terminate_plugins(Host, ServerHost, Plugins,
|
|||||||
?DEBUG("** terminate ~s plugin", [Name]),
|
?DEBUG("** terminate ~s plugin", [Name]),
|
||||||
Plugin =
|
Plugin =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Name/binary>>),
|
Name/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
Plugin:terminate(Host, ServerHost)
|
Plugin:terminate(Host, ServerHost)
|
||||||
end,
|
end,
|
||||||
Plugins),
|
Plugins),
|
||||||
@ -4205,12 +4210,14 @@ get_option(Options, Var, Def) ->
|
|||||||
node_options(Type) ->
|
node_options(Type) ->
|
||||||
Module =
|
Module =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Type/binary>>),
|
Type/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
case catch Module:options() of
|
case catch Module:options() of
|
||||||
{'EXIT', {undef, _}} ->
|
{'EXIT', {undef, _}} ->
|
||||||
DefaultModule =
|
DefaultModule =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
(?STDNODE)/binary>>),
|
(?STDNODE)/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
DefaultModule:options();
|
DefaultModule:options();
|
||||||
Result -> Result
|
Result -> Result
|
||||||
end.
|
end.
|
||||||
@ -4681,7 +4688,8 @@ features() ->
|
|||||||
features(Type) ->
|
features(Type) ->
|
||||||
Module =
|
Module =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Type/binary>>),
|
Type/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
features() ++
|
features() ++
|
||||||
case catch Module:features() of
|
case catch Module:features() of
|
||||||
{'EXIT', {undef, _}} -> [];
|
{'EXIT', {undef, _}} -> [];
|
||||||
@ -4739,7 +4747,8 @@ tree_call(Host, Function, Args) ->
|
|||||||
[{nodetree, N}] -> N;
|
[{nodetree, N}] -> N;
|
||||||
_ ->
|
_ ->
|
||||||
jlib:binary_to_atom(<<(?TREE_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?TREE_PREFIX)/binary,
|
||||||
(?STDTREE)/binary>>)
|
(?STDTREE)/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>)
|
||||||
end,
|
end,
|
||||||
catch apply(Module, Function, Args).
|
catch apply(Module, Function, Args).
|
||||||
|
|
||||||
@ -4759,7 +4768,8 @@ node_call(Type, Function, Args) ->
|
|||||||
?DEBUG("node_call ~p ~p ~p", [Type, Function, Args]),
|
?DEBUG("node_call ~p ~p ~p", [Type, Function, Args]),
|
||||||
Module =
|
Module =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Type/binary>>),
|
Type/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
case apply(Module, Function, Args) of
|
case apply(Module, Function, Args) of
|
||||||
{result, Result} -> {result, Result};
|
{result, Result} -> {result, Result};
|
||||||
{error, Error} -> {error, Error};
|
{error, Error} -> {error, Error};
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
-define(PUBSUB, mod_pubsub_odbc).
|
-define(PUBSUB, mod_pubsub_odbc).
|
||||||
|
|
||||||
-define(PLUGIN_PREFIX, <<"node_">>).
|
-define(PLUGIN_PREFIX, <<"node_">>).
|
||||||
|
-define(ODBC_SUFFIX, <<"_odbc">>).
|
||||||
|
|
||||||
-behaviour(gen_pubsub_nodetree).
|
-behaviour(gen_pubsub_nodetree).
|
||||||
|
|
||||||
@ -351,7 +352,8 @@ raw_to_node(Host, [Node, Parent, Type, NodeIdx]) ->
|
|||||||
ROptions),
|
ROptions),
|
||||||
Module =
|
Module =
|
||||||
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
jlib:binary_to_atom(<<(?PLUGIN_PREFIX)/binary,
|
||||||
Type/binary>>),
|
Type/binary,
|
||||||
|
(?ODBC_SUFFIX)/binary>>),
|
||||||
StdOpts = Module:options(),
|
StdOpts = Module:options(),
|
||||||
lists:foldl(fun ({Key, Value}, Acc) ->
|
lists:foldl(fun ({Key, Value}, Acc) ->
|
||||||
lists:keyreplace(Key, 1, Acc,
|
lists:keyreplace(Key, 1, Acc,
|
||||||
|
Loading…
Reference in New Issue
Block a user