\newcommand{\iqdiscitem}[1]{\titem{\{iqdisc, Discipline\}} \ind{options!iqdisc}This specifies
the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).}
\newcommand{\hostitem}[1]{
- \titem{\{host, HostName\} or \{prefix, PrefixName\}} \ind{options!host}
- Those options define the Jabber ID of the service.
- If no option is specified, the Jabber ID of the service will be the
+ \titem{\{host, HostName\}} \ind{options!host}
+ This option defines the Jabber ID of the service.
+ If the option is not specified, the Jabber ID of the service will be the
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}
Specify the backend used to store the tables: #1.
]}.
{static_modules,
[
- {mod_echo, [{prefix, "echostatic"}]}
+ {mod_echo, [{host, "echostatic.@HOST@"}]}
{mod_time, []},
{mod_version, []}
]}.
\makesubsubsection{modhostoption}{\option{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:
\esyntax{\{host, HostName\}}
If you include the keyword "@HOST@" in the HostName,
it is replaced at start time with the real virtual host string.
-
-If the module is started statically, use the option \term{prefix} instead (see~\ref{modprefixoption}).
+If you configure the module to be started statically, then the keyword @HOST@ is mandatory.
This example configures
the \ind{modules!\modecho{}}echo module to provide its echoing service
]}.
\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
the \ind{modules!\modecho{}}echo module to provide its echoing service
in Jabber IDs like
{static_modules,
[
...
- {mod_echo, [{prefix, "mirror"}]},
+ {mod_echo, [{host, "mirror.@HOST@"}]},
...
]}.
\end{verbatim}
get_hosts/2,
get_module_proc/2,
get_module_proc_existing/2,
- expand_host_name/3,
is_loaded/2]).
-export([behaviour_info/1]).
re:replace(Val, "@HOST@", Host, [global,{return,list}]).
get_opt_host(Host, Opts, Default) ->
- Val = get_opt(host, Opts, Default),
- re:replace(Val, "@HOST@", Host, [global,{return,list}]).
+ case Host of
+ 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) ->
ets:select(ejabberd_modules,
is_loaded(Host, Module) ->
ets:member(ejabberd_modules, {Module, Host})
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.
-
%% Description: Initiates the server
%%--------------------------------------------------------------------
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),
ejabberd_router:register_route(MyHost),
{ok, #state{host = MyHost, client_version = ClientVersion}}.
%% Description: Initiates the server
%%--------------------------------------------------------------------
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),
Backend = gen_mod:get_opt(backend, Opts, mnesia),
gen_storage:create_table(Backend, MyHost, muc_room_opt,
"\nCopyright (c) 2003-2011 ProcessOne")}]}].
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),
ACL = gen_mod:get_opt(access, Opts, all),
Name = gen_mod:get_opt(name, Opts, "SOCKS5 Bytestreams"),
init([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'),
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
init([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'),
PepOffline = gen_mod:get_opt('ignore_pep_from_offline', Opts, true),
IQDisc = gen_mod:get_opt('iqdisc', Opts, 'one_queue'),
gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD,
?MODULE, process_sm_iq, IQDisc),
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),
register(gen_mod:get_module_proc(HostB, ?PROCNAME),
spawn(?MODULE, init, [MyHost, HostB, Search])).
Err = exmpp_iq:error(Packet, 'not-allowed'),
ejabberd_router:route(To, From, Err);
{get, ?NS_DISCO_INFO} ->
- ServerHostB = list_to_binary(ServerHost),
Info = ejabberd_hooks:run_fold(
- disco_info, ServerHostB, [],
+ disco_info, ServerHost, [],
[ServerHost, ?MODULE, <<>>, ""]),
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
children = Info ++ [
find_xdata_el1(Els).
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),
Matches = case gen_mod:get_opt(matches, Opts, 30) of
infinity -> 0;