Use the 'host' option also for static_modules, instead of 'prefix'
This commit is contained in:
parent
c7c59766b2
commit
1a3abf15c0
|
@ -112,11 +112,11 @@
|
||||||
\newcommand{\iqdiscitem}[1]{\titem{\{iqdisc, Discipline\}} \ind{options!iqdisc}This specifies
|
\newcommand{\iqdiscitem}[1]{\titem{\{iqdisc, Discipline\}} \ind{options!iqdisc}This specifies
|
||||||
the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).}
|
the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).}
|
||||||
\newcommand{\hostitem}[1]{
|
\newcommand{\hostitem}[1]{
|
||||||
\titem{\{host, HostName\} or \{prefix, PrefixName\}} \ind{options!host}
|
\titem{\{host, HostName\}} \ind{options!host}
|
||||||
Those options define the Jabber ID of the service.
|
This option defines the Jabber ID of the service.
|
||||||
If no option is specified, the Jabber ID of the service will be the
|
If the option is not specified, the Jabber ID of the service will be the
|
||||||
hostname of the virtual host preceded with `\jid{#1.}'.
|
hostname of the virtual host preceded with `\jid{#1.}'.
|
||||||
For more details see \ref{modhostoption} and \ref{modprefixoption}.
|
For more details see \ref{modhostoption}.
|
||||||
}
|
}
|
||||||
\newcommand{\backend}[1]{\titem{\{backend, mnesia|odbc\}} \ind{options!backend}
|
\newcommand{\backend}[1]{\titem{\{backend, mnesia|odbc\}} \ind{options!backend}
|
||||||
Specify the backend used to store the tables: #1.
|
Specify the backend used to store the tables: #1.
|
||||||
|
@ -2628,7 +2628,7 @@ Examples:
|
||||||
]}.
|
]}.
|
||||||
{static_modules,
|
{static_modules,
|
||||||
[
|
[
|
||||||
{mod_echo, [{prefix, "echostatic"}]}
|
{mod_echo, [{host, "echostatic.@HOST@"}]}
|
||||||
{mod_time, []},
|
{mod_time, []},
|
||||||
{mod_version, []}
|
{mod_version, []}
|
||||||
]}.
|
]}.
|
||||||
|
@ -2768,15 +2768,14 @@ Example:
|
||||||
\makesubsubsection{modhostoption}{\option{host}}
|
\makesubsubsection{modhostoption}{\option{host}}
|
||||||
\ind{options!host}
|
\ind{options!host}
|
||||||
|
|
||||||
This option defines the Jabber ID of a service provided by a dynamic \ejabberd{} module.
|
This option defines the Jabber ID of a service provided by an \ejabberd{} module.
|
||||||
|
|
||||||
The syntax is:
|
The syntax is:
|
||||||
\esyntax{\{host, HostName\}}
|
\esyntax{\{host, HostName\}}
|
||||||
|
|
||||||
If you include the keyword "@HOST@" in the HostName,
|
If you include the keyword "@HOST@" in the HostName,
|
||||||
it is replaced at start time with the real virtual host string.
|
it is replaced at start time with the real virtual host string.
|
||||||
|
If you configure the module to be started statically, then the keyword @HOST@ is mandatory.
|
||||||
If the module is started statically, use the option \term{prefix} instead (see~\ref{modprefixoption}).
|
|
||||||
|
|
||||||
This example configures
|
This example configures
|
||||||
the \ind{modules!\modecho{}}echo module to provide its echoing service
|
the \ind{modules!\modecho{}}echo module to provide its echoing service
|
||||||
|
@ -2801,16 +2800,6 @@ the "@HOST@" keyword must be used:
|
||||||
]}.
|
]}.
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
\makesubsubsection{modprefixoption}{\option{prefix}}
|
|
||||||
\ind{options!prefix}
|
|
||||||
|
|
||||||
This option defines the prefix that will be used to build the Jabber ID of a service provided by a static \ejabberd{} module.
|
|
||||||
|
|
||||||
The syntax is:
|
|
||||||
\esyntax{\{prefix, PrefixName\}}
|
|
||||||
|
|
||||||
If the module is started dynamically, use the option \term{host} instead (see~\ref{modhostoption}).
|
|
||||||
|
|
||||||
This example configures
|
This example configures
|
||||||
the \ind{modules!\modecho{}}echo module to provide its echoing service
|
the \ind{modules!\modecho{}}echo module to provide its echoing service
|
||||||
in Jabber IDs like
|
in Jabber IDs like
|
||||||
|
@ -2820,7 +2809,7 @@ in Jabber IDs like
|
||||||
{static_modules,
|
{static_modules,
|
||||||
[
|
[
|
||||||
...
|
...
|
||||||
{mod_echo, [{prefix, "mirror"}]},
|
{mod_echo, [{host, "mirror.@HOST@"}]},
|
||||||
...
|
...
|
||||||
]}.
|
]}.
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
get_hosts/2,
|
get_hosts/2,
|
||||||
get_module_proc/2,
|
get_module_proc/2,
|
||||||
get_module_proc_existing/2,
|
get_module_proc_existing/2,
|
||||||
expand_host_name/3,
|
|
||||||
is_loaded/2]).
|
is_loaded/2]).
|
||||||
|
|
||||||
-export([behaviour_info/1]).
|
-export([behaviour_info/1]).
|
||||||
|
@ -211,8 +210,14 @@ get_module_opt_host(Host, Module, Default) ->
|
||||||
re:replace(Val, "@HOST@", Host, [global,{return,list}]).
|
re:replace(Val, "@HOST@", Host, [global,{return,list}]).
|
||||||
|
|
||||||
get_opt_host(Host, Opts, Default) ->
|
get_opt_host(Host, Opts, Default) ->
|
||||||
Val = get_opt(host, Opts, Default),
|
case Host of
|
||||||
re:replace(Val, "@HOST@", Host, [global,{return,list}]).
|
global ->
|
||||||
|
Val = get_opt(host, Opts, Default),
|
||||||
|
{global, re:replace(Val, ".@HOST@", "", [global,{return,list}])};
|
||||||
|
Host ->
|
||||||
|
Val = get_opt(host, Opts, Default),
|
||||||
|
re:replace(Val, "@HOST@", Host, [global,{return,list}])
|
||||||
|
end.
|
||||||
|
|
||||||
loaded_modules(Host) ->
|
loaded_modules(Host) ->
|
||||||
ets:select(ejabberd_modules,
|
ets:select(ejabberd_modules,
|
||||||
|
@ -290,12 +295,3 @@ get_module_proc(Host, Base) ->
|
||||||
is_loaded(Host, Module) ->
|
is_loaded(Host, Module) ->
|
||||||
ets:member(ejabberd_modules, {Module, Host})
|
ets:member(ejabberd_modules, {Module, Host})
|
||||||
orelse ets:member(ejabberd_modules, {Module, global}).
|
orelse ets:member(ejabberd_modules, {Module, global}).
|
||||||
|
|
||||||
expand_host_name(Host, Opts, DefaultPrefix) ->
|
|
||||||
case Host of
|
|
||||||
global ->
|
|
||||||
{global, gen_mod:get_opt(prefix, Opts, DefaultPrefix)};
|
|
||||||
_ ->
|
|
||||||
gen_mod:get_opt_host(Host, Opts, DefaultPrefix ++ ".@HOST@")
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ stop(Host) ->
|
||||||
%% Description: Initiates the server
|
%% Description: Initiates the server
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
init([Host, Opts]) ->
|
init([Host, Opts]) ->
|
||||||
MyHost = gen_mod:expand_host_name(Host, Opts, "echo"),
|
MyHost = gen_mod:get_opt_host(Host, Opts, "echo.@HOST@"),
|
||||||
ClientVersion = gen_mod:get_opt(client_version, Opts, false),
|
ClientVersion = gen_mod:get_opt(client_version, Opts, false),
|
||||||
ejabberd_router:register_route(MyHost),
|
ejabberd_router:register_route(MyHost),
|
||||||
{ok, #state{host = MyHost, client_version = ClientVersion}}.
|
{ok, #state{host = MyHost, client_version = ClientVersion}}.
|
||||||
|
|
|
@ -321,7 +321,7 @@ remove_host(MyHostB) when is_binary(MyHostB) ->
|
||||||
%% Description: Initiates the server
|
%% Description: Initiates the server
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
init([Host, Opts]) ->
|
init([Host, Opts]) ->
|
||||||
MyHostStr = gen_mod:expand_host_name(Host, Opts, "conference"),
|
MyHostStr = gen_mod:get_opt_host(Host, Opts, "conference.@HOST@"),
|
||||||
MyHost = l2b(MyHostStr),
|
MyHost = l2b(MyHostStr),
|
||||||
Backend = gen_mod:get_opt(backend, Opts, mnesia),
|
Backend = gen_mod:get_opt(backend, Opts, mnesia),
|
||||||
gen_storage:create_table(Backend, MyHost, muc_room_opt,
|
gen_storage:create_table(Backend, MyHost, muc_room_opt,
|
||||||
|
|
|
@ -222,7 +222,7 @@ iq_vcard(Lang) ->
|
||||||
"\nCopyright (c) 2003-2011 ProcessOne")}]}].
|
"\nCopyright (c) 2003-2011 ProcessOne")}]}].
|
||||||
|
|
||||||
parse_options(ServerHost, Opts) ->
|
parse_options(ServerHost, Opts) ->
|
||||||
MyHost = gen_mod:expand_host_name(ServerHost, Opts, "proxy"),
|
MyHost = gen_mod:get_opt_host(ServerHost, Opts, "proxy.@HOST@"),
|
||||||
Port = gen_mod:get_opt(port, Opts, 7777),
|
Port = gen_mod:get_opt(port, Opts, 7777),
|
||||||
ACL = gen_mod:get_opt(access, Opts, all),
|
ACL = gen_mod:get_opt(access, Opts, all),
|
||||||
Name = gen_mod:get_opt(name, Opts, "SOCKS5 Bytestreams"),
|
Name = gen_mod:get_opt(name, Opts, "SOCKS5 Bytestreams"),
|
||||||
|
|
|
@ -203,7 +203,7 @@ stop(Host) ->
|
||||||
|
|
||||||
init([ServerHost, Opts]) ->
|
init([ServerHost, Opts]) ->
|
||||||
?DEBUG("pubsub init ~p ~p",[ServerHost,Opts]),
|
?DEBUG("pubsub init ~p ~p",[ServerHost,Opts]),
|
||||||
Host = gen_mod:expand_host_name(ServerHost, Opts, "pubsub"),
|
Host = gen_mod:get_opt_host(ServerHost, Opts, "pubsub.@HOST@"),
|
||||||
Access = gen_mod:get_opt('access_createnode', Opts, 'all'),
|
Access = gen_mod:get_opt('access_createnode', Opts, 'all'),
|
||||||
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
|
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
|
||||||
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
|
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
|
||||||
|
|
|
@ -203,7 +203,7 @@ stop(Host) ->
|
||||||
|
|
||||||
init([ServerHost, Opts]) ->
|
init([ServerHost, Opts]) ->
|
||||||
?DEBUG("pubsub init ~p ~p",[ServerHost,Opts]),
|
?DEBUG("pubsub init ~p ~p",[ServerHost,Opts]),
|
||||||
Host = gen_mod:expand_host_name(ServerHost, Opts, "pubsub"),
|
Host = gen_mod:get_opt_host(ServerHost, Opts, "pubsub.@HOST@"),
|
||||||
Access = gen_mod:get_opt('access_createnode', Opts, 'all'),
|
Access = gen_mod:get_opt('access_createnode', Opts, 'all'),
|
||||||
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
|
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
|
||||||
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
|
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
|
||||||
|
|
|
@ -148,7 +148,7 @@ start(HostB, Opts) ->
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD,
|
gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD,
|
||||||
?MODULE, process_sm_iq, IQDisc),
|
?MODULE, process_sm_iq, IQDisc),
|
||||||
ejabberd_hooks:add(disco_sm_features, HostB, ?MODULE, get_sm_features, 50),
|
ejabberd_hooks:add(disco_sm_features, HostB, ?MODULE, get_sm_features, 50),
|
||||||
MyHost = gen_mod:expand_host_name(HostB, Opts, "vjud"),
|
MyHost = gen_mod:get_opt_host(HostB, Opts, "vjud.@HOST@"),
|
||||||
Search = gen_mod:get_opt(search, Opts, true),
|
Search = gen_mod:get_opt(search, Opts, true),
|
||||||
register(gen_mod:get_module_proc(HostB, ?PROCNAME),
|
register(gen_mod:get_module_proc(HostB, ?PROCNAME),
|
||||||
spawn(?MODULE, init, [MyHost, HostB, Search])).
|
spawn(?MODULE, init, [MyHost, HostB, Search])).
|
||||||
|
@ -444,9 +444,8 @@ do_route(ServerHost, From, To, Packet) ->
|
||||||
Err = exmpp_iq:error(Packet, 'not-allowed'),
|
Err = exmpp_iq:error(Packet, 'not-allowed'),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
{get, ?NS_DISCO_INFO} ->
|
{get, ?NS_DISCO_INFO} ->
|
||||||
ServerHostB = list_to_binary(ServerHost),
|
|
||||||
Info = ejabberd_hooks:run_fold(
|
Info = ejabberd_hooks:run_fold(
|
||||||
disco_info, ServerHostB, [],
|
disco_info, ServerHost, [],
|
||||||
[ServerHost, ?MODULE, <<>>, ""]),
|
[ServerHost, ?MODULE, <<>>, ""]),
|
||||||
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
||||||
children = Info ++ [
|
children = Info ++ [
|
||||||
|
|
|
@ -650,7 +650,7 @@ find_xdata_el1([_ | Els]) ->
|
||||||
find_xdata_el1(Els).
|
find_xdata_el1(Els).
|
||||||
|
|
||||||
parse_options(Host, Opts) ->
|
parse_options(Host, Opts) ->
|
||||||
MyHost = gen_mod:expand_host_name(Host, Opts, "vjud"),
|
MyHost = gen_mod:get_opt_host(Host, Opts, "vjud.@HOST@"),
|
||||||
Search = gen_mod:get_opt(search, Opts, true),
|
Search = gen_mod:get_opt(search, Opts, true),
|
||||||
Matches = case gen_mod:get_opt(matches, Opts, 30) of
|
Matches = case gen_mod:get_opt(matches, Opts, 30) of
|
||||||
infinity -> 0;
|
infinity -> 0;
|
||||||
|
|
Loading…
Reference in New Issue