mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse. Some stuff is moved into scram.hrl and type_compat.hrl. All macros have been replaced with the corresponding function calls. TODO: probably type_compat.hrl is not even needed anymore since we support only Erlang >= OTP 17.5
This commit is contained in:
parent
c3c75affa9
commit
fd8e07af47
@ -42,3 +42,6 @@
|
|||||||
false -> ok;
|
false -> ok;
|
||||||
_ -> 'Elixir.Logger':bare_log(error, io_lib:format(Format, Args), [?MODULE])
|
_ -> 'Elixir.Logger':bare_log(error, io_lib:format(Format, Args), [?MODULE])
|
||||||
end).
|
end).
|
||||||
|
|
||||||
|
%% Uncomment if you want to debug p1_fsm/gen_fsm
|
||||||
|
%%-define(DBGFSM, true).
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
%%%
|
%%%
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("type_compat.hrl").
|
||||||
|
|
||||||
-define(MAX_USERS_DEFAULT, 200).
|
-define(MAX_USERS_DEFAULT, 200).
|
||||||
|
|
||||||
@ -67,7 +67,7 @@
|
|||||||
captcha_whitelist = (?SETS):empty() :: ?TGB_SET,
|
captcha_whitelist = (?SETS):empty() :: ?TGB_SET,
|
||||||
mam = false :: boolean(),
|
mam = false :: boolean(),
|
||||||
pubsub = <<"">> :: binary(),
|
pubsub = <<"">> :: binary(),
|
||||||
lang = ?MYLANG :: binary()
|
lang = ejabberd_config:get_mylang() :: binary()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-type config() :: #config{}.
|
-type config() :: #config{}.
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
%%%
|
%%%
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
|
|
||||||
%% -------------------------------
|
%% -------------------------------
|
||||||
%% Pubsub constants
|
%% Pubsub constants
|
||||||
-define(ERR_EXTENDED(E, C), mod_pubsub:extended_error(E, C)).
|
-define(ERR_EXTENDED(E, C), mod_pubsub:extended_error(E, C)).
|
||||||
|
28
include/scram.hrl
Normal file
28
include/scram.hrl
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
%%%----------------------------------------------------------------------
|
||||||
|
%%%
|
||||||
|
%%% ejabberd, Copyright (C) 2002-2018 ProcessOne
|
||||||
|
%%%
|
||||||
|
%%% This program is free software; you can redistribute it and/or
|
||||||
|
%%% modify it under the terms of the GNU General Public License as
|
||||||
|
%%% published by the Free Software Foundation; either version 2 of the
|
||||||
|
%%% License, or (at your option) any later version.
|
||||||
|
%%%
|
||||||
|
%%% This program is distributed in the hope that it will be useful,
|
||||||
|
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
%%% General Public License for more details.
|
||||||
|
%%%
|
||||||
|
%%% You should have received a copy of the GNU General Public License along
|
||||||
|
%%% with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
%%%
|
||||||
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-record(scram, {storedkey = <<"">> :: binary(),
|
||||||
|
serverkey = <<"">> :: binary(),
|
||||||
|
salt = <<"">> :: binary(),
|
||||||
|
iterationcount = 0 :: integer()}).
|
||||||
|
|
||||||
|
-type scram() :: #scram{}.
|
||||||
|
|
||||||
|
-define(SCRAM_DEFAULT_ITERATION_COUNT, 4096).
|
@ -18,41 +18,6 @@
|
|||||||
%%%
|
%%%
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
-ifndef(EJABBERD_HRL).
|
|
||||||
-define(EJABBERD_HRL, true).
|
|
||||||
|
|
||||||
-define(VERSION, ejabberd_config:get_version()).
|
|
||||||
|
|
||||||
-define(MYHOSTS, ejabberd_config:get_myhosts()).
|
|
||||||
|
|
||||||
-define(MYNAME, hd(ejabberd_config:get_myhosts())).
|
|
||||||
|
|
||||||
-define(MYLANG, ejabberd_config:get_mylang()).
|
|
||||||
|
|
||||||
-define(MSGS_DIR, filename:join(["priv", "msgs"])).
|
|
||||||
|
|
||||||
-define(SQL_DIR, filename:join(["priv", "sql"])).
|
|
||||||
|
|
||||||
-define(CONFIG_PATH, <<"ejabberd.yml">>).
|
|
||||||
|
|
||||||
-define(LOG_PATH, "ejabberd.log").
|
|
||||||
|
|
||||||
-define(EJABBERD_URI, <<"http://www.process-one.net/en/ejabberd/">>).
|
|
||||||
|
|
||||||
-define(COPYRIGHT, "Copyright (c) ProcessOne").
|
|
||||||
|
|
||||||
%%-define(DBGFSM, true).
|
|
||||||
|
|
||||||
-record(scram,
|
|
||||||
{storedkey = <<"">>,
|
|
||||||
serverkey = <<"">>,
|
|
||||||
salt = <<"">>,
|
|
||||||
iterationcount = 0 :: integer()}).
|
|
||||||
|
|
||||||
-type scram() :: #scram{}.
|
|
||||||
|
|
||||||
-define(SCRAM_DEFAULT_ITERATION_COUNT, 4096).
|
|
||||||
|
|
||||||
-ifdef(ERL_DEPRECATED_TYPES).
|
-ifdef(ERL_DEPRECATED_TYPES).
|
||||||
|
|
||||||
-define(TDICT, dict()).
|
-define(TDICT, dict()).
|
||||||
@ -68,5 +33,3 @@
|
|||||||
-define(TQUEUE, queue:queue()).
|
-define(TQUEUE, queue:queue()).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
-endif.
|
|
@ -43,7 +43,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("jid.hrl").
|
-include("jid.hrl").
|
||||||
|
|
||||||
@ -195,7 +194,7 @@ add_access(Host, Access, Rules) ->
|
|||||||
-spec load_from_config() -> ok.
|
-spec load_from_config() -> ok.
|
||||||
|
|
||||||
load_from_config() ->
|
load_from_config() ->
|
||||||
Hosts = [global|?MYHOSTS],
|
Hosts = [global|ejabberd_config:get_myhosts()],
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
ACLs = ejabberd_config:get_option(
|
ACLs = ejabberd_config:get_option(
|
||||||
@ -453,7 +452,7 @@ acl_rule_matches({ip, {Net, Mask}}, #{ip := IP}, _Host) ->
|
|||||||
acl_rule_matches({user, {U, S}}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user, {U, S}}, #{usr := {U, S, _}}, _Host) ->
|
||||||
true;
|
true;
|
||||||
acl_rule_matches({user, U}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user, U}, #{usr := {U, S, _}}, _Host) ->
|
||||||
lists:member(S, ?MYHOSTS);
|
lists:member(S, ejabberd_config:get_myhosts());
|
||||||
acl_rule_matches({server, S}, #{usr := {_, S, _}}, _Host) ->
|
acl_rule_matches({server, S}, #{usr := {_, S, _}}, _Host) ->
|
||||||
true;
|
true;
|
||||||
acl_rule_matches({resource, R}, #{usr := {_, _, R}}, _Host) ->
|
acl_rule_matches({resource, R}, #{usr := {_, _, R}}, _Host) ->
|
||||||
@ -467,7 +466,7 @@ acl_rule_matches({shared_group, G}, #{usr := {U, S, _}}, Host) ->
|
|||||||
acl_rule_matches({user_regexp, {UR, S}}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user_regexp, {UR, S}}, #{usr := {U, S, _}}, _Host) ->
|
||||||
is_regexp_match(U, UR);
|
is_regexp_match(U, UR);
|
||||||
acl_rule_matches({user_regexp, UR}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user_regexp, UR}, #{usr := {U, S, _}}, _Host) ->
|
||||||
lists:member(S, ?MYHOSTS) andalso is_regexp_match(U, UR);
|
lists:member(S, ejabberd_config:get_myhosts()) andalso is_regexp_match(U, UR);
|
||||||
acl_rule_matches({server_regexp, SR}, #{usr := {_, S, _}}, _Host) ->
|
acl_rule_matches({server_regexp, SR}, #{usr := {_, S, _}}, _Host) ->
|
||||||
is_regexp_match(S, SR);
|
is_regexp_match(S, SR);
|
||||||
acl_rule_matches({resource_regexp, RR}, #{usr := {_, _, R}}, _Host) ->
|
acl_rule_matches({resource_regexp, RR}, #{usr := {_, _, R}}, _Host) ->
|
||||||
@ -477,7 +476,7 @@ acl_rule_matches({node_regexp, {UR, SR}}, #{usr := {U, S, _}}, _Host) ->
|
|||||||
acl_rule_matches({user_glob, {UR, S}}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user_glob, {UR, S}}, #{usr := {U, S, _}}, _Host) ->
|
||||||
is_glob_match(U, UR);
|
is_glob_match(U, UR);
|
||||||
acl_rule_matches({user_glob, UR}, #{usr := {U, S, _}}, _Host) ->
|
acl_rule_matches({user_glob, UR}, #{usr := {U, S, _}}, _Host) ->
|
||||||
lists:member(S, ?MYHOSTS) andalso is_glob_match(U, UR);
|
lists:member(S, ejabberd_config:get_myhosts()) andalso is_glob_match(U, UR);
|
||||||
acl_rule_matches({server_glob, SR}, #{usr := {_, S, _}}, _Host) ->
|
acl_rule_matches({server_glob, SR}, #{usr := {_, S, _}}, _Host) ->
|
||||||
is_glob_match(S, SR);
|
is_glob_match(S, SR);
|
||||||
acl_rule_matches({resource_glob, RR}, #{usr := {_, _, R}}, _Host) ->
|
acl_rule_matches({resource_glob, RR}, #{usr := {_, _, R}}, _Host) ->
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
%% 3. tls-sni-01: https://tools.ietf.org/html/draft-ietf-acme-acme-05#section-7.4
|
%% 3. tls-sni-01: https://tools.ietf.org/html/draft-ietf-acme-acme-05#section-7.4
|
||||||
%% 4. (?) oob-01: https://tools.ietf.org/html/draft-ietf-acme-acme-05#section-7.5
|
%% 4. (?) oob-01: https://tools.ietf.org/html/draft-ietf-acme-acme-05#section-7.5
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
-export([start/1, stop/0, mech_new/4, mech_step/2,
|
-export([start/1, stop/0, mech_new/4, mech_step/2,
|
||||||
parse/1, format_error/1, opt_type/1]).
|
parse/1, format_error/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-behaviour(cyrsasl).
|
-behaviour(cyrsasl).
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
-export([start/1, stop/0, mech_new/4, mech_step/2, format_error/1]).
|
-export([start/1, stop/0, mech_new/4, mech_step/2, format_error/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("scram.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-behaviour(cyrsasl).
|
-behaviour(cyrsasl).
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
-export([start_link/0, opt_type/1, register_certfiles/0]).
|
-export([start_link/0, opt_type/1, register_certfiles/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
%% delete_authz/3
|
%% delete_authz/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
|
|
||||||
@ -412,7 +411,7 @@ stop_kindly(DelaySeconds, AnnouncementTextString) ->
|
|||||||
ejabberd_listener, stop_listeners, []},
|
ejabberd_listener, stop_listeners, []},
|
||||||
{"Sending announcement to connected users",
|
{"Sending announcement to connected users",
|
||||||
mod_announce, send_announcement_to_all,
|
mod_announce, send_announcement_to_all,
|
||||||
[?MYNAME, Subject, AnnouncementText]},
|
[ejabberd_config:get_myname(), Subject, AnnouncementText]},
|
||||||
{"Sending service message to MUC rooms",
|
{"Sending service message to MUC rooms",
|
||||||
ejabberd_admin, send_service_message_all_mucs,
|
ejabberd_admin, send_service_message_all_mucs,
|
||||||
[Subject, AnnouncementText]},
|
[Subject, AnnouncementText]},
|
||||||
@ -446,7 +445,7 @@ send_service_message_all_mucs(Subject, AnnouncementText) ->
|
|||||||
ServerHost, mod_muc, <<"conference.@HOST@">>),
|
ServerHost, mod_muc, <<"conference.@HOST@">>),
|
||||||
mod_muc:broadcast_service_message(ServerHost, MUCHost, Message)
|
mod_muc:broadcast_service_message(ServerHost, MUCHost, Message)
|
||||||
end,
|
end,
|
||||||
?MYHOSTS).
|
ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
%%% ejabberd_update
|
%%% ejabberd_update
|
||||||
@ -499,7 +498,7 @@ registered_users(Host) ->
|
|||||||
lists:map(fun({U, _S}) -> U end, SUsers).
|
lists:map(fun({U, _S}) -> U end, SUsers).
|
||||||
|
|
||||||
registered_vhosts() ->
|
registered_vhosts() ->
|
||||||
?MYHOSTS.
|
ejabberd_config:get_myhosts().
|
||||||
|
|
||||||
reload_config() ->
|
reload_config() ->
|
||||||
ejabberd_config:reload_file().
|
ejabberd_config:reload_file().
|
||||||
@ -549,13 +548,13 @@ delete_expired_messages() ->
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
{atomic, ok} = mod_offline:remove_expired_messages(Host)
|
{atomic, ok} = mod_offline:remove_expired_messages(Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
delete_old_messages(Days) ->
|
delete_old_messages(Days) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
{atomic, _} = mod_offline:remove_old_messages(Days, Host)
|
{atomic, _} = mod_offline:remove_old_messages(Days, Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
%%% Mnesia management
|
%%% Mnesia management
|
||||||
@ -622,7 +621,7 @@ keep_tables() ->
|
|||||||
%% loaded modules
|
%% loaded modules
|
||||||
keep_modules_tables() ->
|
keep_modules_tables() ->
|
||||||
lists:map(fun(Module) -> module_tables(Module) end,
|
lists:map(fun(Module) -> module_tables(Module) end,
|
||||||
gen_mod:loaded_modules(?MYNAME)).
|
gen_mod:loaded_modules(ejabberd_config:get_myname())).
|
||||||
|
|
||||||
%% TODO: This mapping should probably be moved to a callback function in each
|
%% TODO: This mapping should probably be moved to a callback function in each
|
||||||
%% module.
|
%% module.
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
-export([start/2, prep_stop/1, stop/1]).
|
-export([start/2, prep_stop/1, stop/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
@ -58,7 +57,8 @@ start(normal, _Args) ->
|
|||||||
ejabberd_cluster:wait_for_sync(infinity),
|
ejabberd_cluster:wait_for_sync(infinity),
|
||||||
{T2, _} = statistics(wall_clock),
|
{T2, _} = statistics(wall_clock),
|
||||||
?INFO_MSG("ejabberd ~s is started in the node ~p in ~.2fs",
|
?INFO_MSG("ejabberd ~s is started in the node ~p in ~.2fs",
|
||||||
[?VERSION, node(), (T2-T1)/1000]),
|
[ejabberd_config:get_version(),
|
||||||
|
node(), (T2-T1)/1000]),
|
||||||
lists:foreach(fun erlang:garbage_collect/1, processes()),
|
lists:foreach(fun erlang:garbage_collect/1, processes()),
|
||||||
{ok, SupPid};
|
{ok, SupPid};
|
||||||
Err ->
|
Err ->
|
||||||
@ -83,7 +83,8 @@ prep_stop(State) ->
|
|||||||
|
|
||||||
%% All the processes were killed when this function is called
|
%% All the processes were killed when this function is called
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
?INFO_MSG("ejabberd ~s is stopped in the node ~p", [?VERSION, node()]),
|
?INFO_MSG("ejabberd ~s is stopped in the node ~p",
|
||||||
|
[ejabberd_config:get_version(), node()]),
|
||||||
delete_pid_file(),
|
delete_pid_file(),
|
||||||
%%ejabberd_debug:stop(),
|
%%ejabberd_debug:stop(),
|
||||||
ok.
|
ok.
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
-export([auth_modules/1, opt_type/1]).
|
-export([auth_modules/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("scram.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(AUTH_CACHE, auth_cache).
|
-define(AUTH_CACHE, auth_cache).
|
||||||
@ -107,7 +107,7 @@ init([]) ->
|
|||||||
fun(Host, Acc) ->
|
fun(Host, Acc) ->
|
||||||
Modules = auth_modules(Host),
|
Modules = auth_modules(Host),
|
||||||
maps:put(Host, Modules, Acc)
|
maps:put(Host, Modules, Acc)
|
||||||
end, #{}, ?MYHOSTS),
|
end, #{}, ejabberd_config:get_myhosts()),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({Host, Modules}) ->
|
fun({Host, Modules}) ->
|
||||||
start(Host, Modules)
|
start(Host, Modules)
|
||||||
@ -141,7 +141,7 @@ handle_cast(config_reloaded, #state{host_modules = HostModules} = State) ->
|
|||||||
stop(Host, OldModules -- NewModules),
|
stop(Host, OldModules -- NewModules),
|
||||||
reload(Host, lists_intersection(OldModules, NewModules)),
|
reload(Host, lists_intersection(OldModules, NewModules)),
|
||||||
maps:put(Host, NewModules, Acc)
|
maps:put(Host, NewModules, Acc)
|
||||||
end, HostModules, ?MYHOSTS),
|
end, HostModules, ejabberd_config:get_myhosts()),
|
||||||
init_cache(NewHostModules),
|
init_cache(NewHostModules),
|
||||||
{noreply, State#state{host_modules = NewHostModules}};
|
{noreply, State#state{host_modules = NewHostModules}};
|
||||||
handle_cast(Msg, State) ->
|
handle_cast(Msg, State) ->
|
||||||
@ -764,7 +764,7 @@ auth_modules() ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
[{Host, Mod} || Mod <- auth_modules(Host)]
|
[{Host, Mod} || Mod <- auth_modules(Host)]
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec auth_modules(binary()) -> [module()].
|
-spec auth_modules(binary()) -> [module()].
|
||||||
auth_modules(Server) ->
|
auth_modules(Server) ->
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
get_users/2, count_users/2, store_type/1,
|
get_users/2, count_users/2, store_type/1,
|
||||||
plain_password_required/1, opt_type/1]).
|
plain_password_required/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("jid.hrl").
|
-include("jid.hrl").
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
try_register/3, user_exists/2, remove_user/2,
|
try_register/3, user_exists/2, remove_user/2,
|
||||||
store_type/1, plain_password_required/1, opt_type/1]).
|
store_type/1, plain_password_required/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
store_type/1, plain_password_required/1,
|
store_type/1, plain_password_required/1,
|
||||||
opt_type/1]).
|
opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("eldap.hrl").
|
-include("eldap.hrl").
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
plain_password_required/1, use_cache/1]).
|
plain_password_required/1, use_cache/1]).
|
||||||
-export([need_transform/1, transform/1]).
|
-export([need_transform/1, transform/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
-include("scram.hrl").
|
||||||
-include("ejabberd_auth.hrl").
|
-include("ejabberd_auth.hrl").
|
||||||
|
|
||||||
-record(reg_users_counter, {vhost = <<"">> :: binary(),
|
-record(reg_users_counter, {vhost = <<"">> :: binary(),
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
plain_password_required/1]).
|
plain_password_required/1]).
|
||||||
-export([passwd_schema/0]).
|
-export([passwd_schema/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
|
-include("scram.hrl").
|
||||||
-include("ejabberd_auth.hrl").
|
-include("ejabberd_auth.hrl").
|
||||||
|
|
||||||
start(_Host) ->
|
start(_Host) ->
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
remove_user/2, store_type/1, plain_password_required/1,
|
remove_user/2, store_type/1, plain_password_required/1,
|
||||||
convert_to_scram/1, opt_type/1, export/1]).
|
convert_to_scram/1, opt_type/1, export/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("scram.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
-include("ejabberd_auth.hrl").
|
-include("ejabberd_auth.hrl").
|
||||||
|
@ -44,13 +44,10 @@
|
|||||||
handle_sync_event/4, handle_info/3, terminate/3,
|
handle_sync_event/4, handle_info/3, terminate/3,
|
||||||
code_change/4]).
|
code_change/4]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("type_compat.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
|
|
||||||
-include("bosh.hrl").
|
-include("bosh.hrl").
|
||||||
|
|
||||||
%%-define(DBGFSM, true).
|
%%-define(DBGFSM, true).
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
reply/2, copy_state/2, set_timeout/2, route/2,
|
reply/2, copy_state/2, set_timeout/2, route/2,
|
||||||
host_up/1, host_down/1]).
|
host_up/1, host_down/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("mod_roster.hrl").
|
-include("mod_roster.hrl").
|
||||||
@ -415,7 +414,7 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
|
|||||||
handle_stream_start(StreamStart, #{lserver := LServer} = State) ->
|
handle_stream_start(StreamStart, #{lserver := LServer} = State) ->
|
||||||
case ejabberd_router:is_my_host(LServer) of
|
case ejabberd_router:is_my_host(LServer) of
|
||||||
false ->
|
false ->
|
||||||
send(State#{lserver => ?MYNAME}, xmpp:serr_host_unknown());
|
send(State#{lserver => ejabberd_config:get_myname()}, xmpp:serr_host_unknown());
|
||||||
true ->
|
true ->
|
||||||
State1 = change_shaper(State),
|
State1 = change_shaper(State),
|
||||||
Opts = ejabberd_config:codec_options(LServer),
|
Opts = ejabberd_config:codec_options(LServer),
|
||||||
@ -526,9 +525,9 @@ init([State, Opts]) ->
|
|||||||
tls_verify => TLSVerify,
|
tls_verify => TLSVerify,
|
||||||
pres_a => ?SETS:new(),
|
pres_a => ?SETS:new(),
|
||||||
zlib => Zlib,
|
zlib => Zlib,
|
||||||
lang => ?MYLANG,
|
lang => ejabberd_config:get_mylang(),
|
||||||
server => ?MYNAME,
|
server => ejabberd_config:get_myname(),
|
||||||
lserver => ?MYNAME,
|
lserver => ejabberd_config:get_myname(),
|
||||||
access => Access,
|
access => Access,
|
||||||
shaper => Shaper},
|
shaper => Shaper},
|
||||||
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
||||||
@ -1041,7 +1040,7 @@ listen_opt_type(backlog) ->
|
|||||||
listen_opt_type(accept_interval) ->
|
listen_opt_type(accept_interval) ->
|
||||||
fun(I) when is_integer(I), I>=0 -> I end;
|
fun(I) when is_integer(I), I>=0 -> I end;
|
||||||
listen_opt_type(O) ->
|
listen_opt_type(O) ->
|
||||||
StreamOpts = mod_stream_mgmt:mod_options(?MYNAME),
|
StreamOpts = mod_stream_mgmt:mod_options(ejabberd_config:get_myname()),
|
||||||
case lists:keyfind(O, 1, StreamOpts) of
|
case lists:keyfind(O, 1, StreamOpts) of
|
||||||
false ->
|
false ->
|
||||||
[access, shaper, certfile, ciphers, dhfile, cafile,
|
[access, shaper, certfile, ciphers, dhfile, cafile,
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
config_reloaded/0, process_iq/1]).
|
config_reloaded/0, process_iq/1]).
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
|
|
||||||
@ -365,12 +364,12 @@ terminate(_Reason, #state{enabled = Enabled}) ->
|
|||||||
register_handlers() ->
|
register_handlers() ->
|
||||||
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:add(host_down, ?MODULE, host_down, 50),
|
ejabberd_hooks:add(host_down, ?MODULE, host_down, 50),
|
||||||
lists:foreach(fun host_up/1, ?MYHOSTS).
|
lists:foreach(fun host_up/1, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
unregister_handlers() ->
|
unregister_handlers() ->
|
||||||
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 50),
|
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 50),
|
||||||
lists:foreach(fun host_down/1, ?MYHOSTS).
|
lists:foreach(fun host_down/1, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
||||||
|
|
||||||
@ -445,7 +444,7 @@ get_url(Str) ->
|
|||||||
<<TransferProt/binary, ":", Host/binary, ":",
|
<<TransferProt/binary, ":", Host/binary, ":",
|
||||||
PortString/binary, "/captcha/", Str/binary>>;
|
PortString/binary, "/captcha/", Str/binary>>;
|
||||||
_ ->
|
_ ->
|
||||||
<<"http://", (?MYNAME)/binary, "/captcha/", Str/binary>>
|
<<"http://", (ejabberd_config:get_myname())/binary, "/captcha/", Str/binary>>
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_transfer_protocol(PortString) ->
|
get_transfer_protocol(PortString) ->
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
get_known_nodes/0, node_id/0, get_node_by_id/1,
|
get_known_nodes/0, node_id/0, get_node_by_id/1,
|
||||||
send/2, wait_for_sync/1, subscribe/1]).
|
send/2, wait_for_sync/1, subscribe/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-spec init() -> ok.
|
-spec init() -> ok.
|
||||||
|
@ -240,7 +240,6 @@
|
|||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
-export([generate_md_output/3]).
|
-export([generate_md_output/3]).
|
||||||
|
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
|
|
||||||
-define(RAW(V), if HTMLOutput -> fxml:crypt(iolist_to_binary(V)); true -> iolist_to_binary(V) end).
|
-define(RAW(V), if HTMLOutput -> fxml:crypt(iolist_to_binary(V)); true -> iolist_to_binary(V) end).
|
||||||
-define(TAG(N), if HTMLOutput -> [<<"<", ??N, "/>">>]; true -> md_tag(N, <<"">>) end).
|
-define(TAG(N), if HTMLOutput -> [<<"<", ??N, "/>">>]; true -> md_tag(N, <<"">>) end).
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
-export([start/0, load_file/1, reload_file/0, read_file/1,
|
-export([start/0, load_file/1, reload_file/0, read_file/1,
|
||||||
get_option/1, get_option/2, add_option/2, has_option/1,
|
get_option/1, get_option/2, add_option/2, has_option/1,
|
||||||
get_version/0, get_myhosts/0, get_mylang/0, get_lang/1,
|
get_version/0, get_myhosts/0, get_myname/0,
|
||||||
|
get_mylang/0, get_lang/1, get_uri/0, get_copyright/0,
|
||||||
get_ejabberd_config_path/0, is_using_elixir_config/0,
|
get_ejabberd_config_path/0, is_using_elixir_config/0,
|
||||||
prepare_opt_val/4, transform_options/1, collect_options/1,
|
prepare_opt_val/4, transform_options/1, collect_options/1,
|
||||||
convert_to_yaml/1, convert_to_yaml/2, v_db/2,
|
convert_to_yaml/1, convert_to_yaml/2, v_db/2,
|
||||||
@ -53,7 +54,6 @@
|
|||||||
{get_global_option, 3}, {get_local_option, 3},
|
{get_global_option, 3}, {get_local_option, 3},
|
||||||
{get_option, 3}, {is_file_readable, 1}]).
|
{get_option, 3}, {is_file_readable, 1}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_config.hrl").
|
-include("ejabberd_config.hrl").
|
||||||
-include_lib("kernel/include/file.hrl").
|
-include_lib("kernel/include/file.hrl").
|
||||||
@ -136,7 +136,7 @@ get_ejabberd_config_path() ->
|
|||||||
undefined ->
|
undefined ->
|
||||||
case os:getenv("EJABBERD_CONFIG_PATH") of
|
case os:getenv("EJABBERD_CONFIG_PATH") of
|
||||||
false ->
|
false ->
|
||||||
?CONFIG_PATH;
|
"ejabberd.yml";
|
||||||
Path ->
|
Path ->
|
||||||
Path
|
Path
|
||||||
end
|
end
|
||||||
@ -1087,6 +1087,11 @@ get_version() ->
|
|||||||
get_myhosts() ->
|
get_myhosts() ->
|
||||||
get_option(hosts).
|
get_option(hosts).
|
||||||
|
|
||||||
|
-spec get_myname() -> binary().
|
||||||
|
|
||||||
|
get_myname() ->
|
||||||
|
hd(get_myhosts()).
|
||||||
|
|
||||||
-spec get_mylang() -> binary().
|
-spec get_mylang() -> binary().
|
||||||
|
|
||||||
get_mylang() ->
|
get_mylang() ->
|
||||||
@ -1096,6 +1101,14 @@ get_mylang() ->
|
|||||||
get_lang(Host) ->
|
get_lang(Host) ->
|
||||||
get_option({language, Host}, <<"en">>).
|
get_option({language, Host}, <<"en">>).
|
||||||
|
|
||||||
|
-spec get_uri() -> binary().
|
||||||
|
get_uri() ->
|
||||||
|
<<"http://www.process-one.net/en/ejabberd/">>.
|
||||||
|
|
||||||
|
-spec get_copyright() -> binary().
|
||||||
|
get_copyright() ->
|
||||||
|
<<"Copyright (c) ProcessOne">>.
|
||||||
|
|
||||||
replace_module(mod_announce_odbc) -> {mod_announce, sql};
|
replace_module(mod_announce_odbc) -> {mod_announce, sql};
|
||||||
replace_module(mod_blocking_odbc) -> {mod_blocking, sql};
|
replace_module(mod_blocking_odbc) -> {mod_blocking, sql};
|
||||||
replace_module(mod_caps_odbc) -> {mod_caps, sql};
|
replace_module(mod_caps_odbc) -> {mod_caps, sql};
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
-include("ejabberd_ctl.hrl").
|
-include("ejabberd_ctl.hrl").
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(DEFAULT_VERSION, 1000000).
|
-define(DEFAULT_VERSION, 1000000).
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
-export([init/2, opt_type/1]).
|
-export([init/2, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
@ -787,7 +786,8 @@ rest_dir(N, Path, <<_H, T/binary>>) -> rest_dir(N, Path, T).
|
|||||||
|
|
||||||
expand_custom_headers(Headers) ->
|
expand_custom_headers(Headers) ->
|
||||||
lists:map(fun({K, V}) ->
|
lists:map(fun({K, V}) ->
|
||||||
{K, misc:expand_keyword(<<"@VERSION@">>, V, ?VERSION)}
|
{K, misc:expand_keyword(<<"@VERSION@">>, V,
|
||||||
|
ejabberd_config:get_version())}
|
||||||
end, Headers).
|
end, Headers).
|
||||||
|
|
||||||
code_to_phrase(100) -> <<"Continue">>;
|
code_to_phrase(100) -> <<"Continue">>;
|
||||||
@ -917,11 +917,11 @@ get_certfile(Opts) ->
|
|||||||
{_, CertFile} ->
|
{_, CertFile} ->
|
||||||
CertFile;
|
CertFile;
|
||||||
false ->
|
false ->
|
||||||
case ejabberd_pkix:get_certfile(?MYNAME) of
|
case ejabberd_pkix:get_certfile(ejabberd_config:get_myname()) of
|
||||||
{ok, CertFile} ->
|
{ok, CertFile} ->
|
||||||
CertFile;
|
CertFile;
|
||||||
error ->
|
error ->
|
||||||
ejabberd_config:get_option({domain_certfile, ?MYNAME})
|
ejabberd_config:get_option({domain_certfile, ejabberd_config:get_myname()})
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
monitor/1, reset_stream/1, close/1, change_shaper/2,
|
monitor/1, reset_stream/1, close/1, change_shaper/2,
|
||||||
socket_handoff/3, opt_type/1]).
|
socket_handoff/3, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -138,10 +137,10 @@ init([{#ws{ip = IP, http_opts = HOpts}, _} = WS]) ->
|
|||||||
end, HOpts),
|
end, HOpts),
|
||||||
Opts = ejabberd_c2s_config:get_c2s_limits() ++ SOpts,
|
Opts = ejabberd_c2s_config:get_c2s_limits() ++ SOpts,
|
||||||
PingInterval = ejabberd_config:get_option(
|
PingInterval = ejabberd_config:get_option(
|
||||||
{websocket_ping_interval, ?MYNAME},
|
{websocket_ping_interval, ejabberd_config:get_myname()},
|
||||||
?PING_INTERVAL) * 1000,
|
?PING_INTERVAL) * 1000,
|
||||||
WSTimeout = ejabberd_config:get_option(
|
WSTimeout = ejabberd_config:get_option(
|
||||||
{websocket_timeout, ?MYNAME},
|
{websocket_timeout, ejabberd_config:get_myname()},
|
||||||
?WEBSOCKET_TIMEOUT) * 1000,
|
?WEBSOCKET_TIMEOUT) * 1000,
|
||||||
Socket = {http_ws, self(), IP},
|
Socket = {http_ws, self(), IP},
|
||||||
?DEBUG("Client connected through websocket ~p",
|
?DEBUG("Client connected through websocket ~p",
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
add_listener/3, delete_listener/2, transform_options/1,
|
add_listener/3, delete_listener/2, transform_options/1,
|
||||||
validate_cfg/1, opt_type/1, config_reloaded/0]).
|
validate_cfg/1, opt_type/1, config_reloaded/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%% We do not block on send anymore.
|
%% We do not block on send anymore.
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
-export([route_iq/2, route_iq/3]).
|
-export([route_iq/2, route_iq/3]).
|
||||||
-deprecated([{route_iq, 2}, {route_iq, 3}]).
|
-deprecated([{route_iq, 2}, {route_iq, 3}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -106,7 +105,7 @@ get_features(Host) ->
|
|||||||
|
|
||||||
init([]) ->
|
init([]) ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
lists:foreach(fun host_up/1, ?MYHOSTS),
|
lists:foreach(fun host_up/1, ejabberd_config:get_myhosts()),
|
||||||
ejabberd_hooks:add(host_up, ?MODULE, host_up, 10),
|
ejabberd_hooks:add(host_up, ?MODULE, host_up, 10),
|
||||||
ejabberd_hooks:add(host_down, ?MODULE, host_down, 100),
|
ejabberd_hooks:add(host_down, ?MODULE, host_down, 100),
|
||||||
gen_iq_handler:start(?MODULE),
|
gen_iq_handler:start(?MODULE),
|
||||||
@ -126,7 +125,7 @@ handle_info(Info, State) ->
|
|||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
terminate(_Reason, _State) ->
|
terminate(_Reason, _State) ->
|
||||||
lists:foreach(fun host_down/1, ?MYHOSTS),
|
lists:foreach(fun host_down/1, ejabberd_config:get_myhosts()),
|
||||||
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 10),
|
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 10),
|
||||||
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 100),
|
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 100),
|
||||||
ok.
|
ok.
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
-export([start/0, restart/0, reopen_log/0, rotate_log/0, get/0, set/1,
|
-export([start/0, restart/0, reopen_log/0, rotate_log/0, get/0, set/1,
|
||||||
get_log_path/0, opt_type/1]).
|
get_log_path/0, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
|
|
||||||
-type loglevel() :: 0 | 1 | 2 | 3 | 4 | 5.
|
-type loglevel() :: 0 | 1 | 2 | 3 | 4 | 5.
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ get_log_path() ->
|
|||||||
undefined ->
|
undefined ->
|
||||||
case os:getenv("EJABBERD_LOG_PATH") of
|
case os:getenv("EJABBERD_LOG_PATH") of
|
||||||
false ->
|
false ->
|
||||||
?LOG_PATH;
|
"ejabberd.log";
|
||||||
Path ->
|
Path ->
|
||||||
Path
|
Path
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
|
@ -34,13 +34,12 @@
|
|||||||
clean/1,
|
clean/1,
|
||||||
opt_type/1]).
|
opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_oauth.hrl").
|
-include("ejabberd_oauth.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("jid.hrl").
|
-include("jid.hrl").
|
||||||
|
|
||||||
init() ->
|
init() ->
|
||||||
rest:start(?MYNAME),
|
rest:start(ejabberd_config:get_myname()),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
store(R) ->
|
store(R) ->
|
||||||
@ -50,7 +49,7 @@ store(R) ->
|
|||||||
SJID = jid:encode({User, Server, <<"">>}),
|
SJID = jid:encode({User, Server, <<"">>}),
|
||||||
case rest:with_retry(
|
case rest:with_retry(
|
||||||
post,
|
post,
|
||||||
[?MYNAME, Path, [],
|
[ejabberd_config:get_myname(), Path, [],
|
||||||
{[{<<"token">>, R#oauth_token.token},
|
{[{<<"token">>, R#oauth_token.token},
|
||||||
{<<"user">>, SJID},
|
{<<"user">>, SJID},
|
||||||
{<<"scope">>, R#oauth_token.scope},
|
{<<"scope">>, R#oauth_token.scope},
|
||||||
@ -65,7 +64,7 @@ store(R) ->
|
|||||||
|
|
||||||
lookup(Token) ->
|
lookup(Token) ->
|
||||||
Path = path(<<"lookup">>),
|
Path = path(<<"lookup">>),
|
||||||
case rest:with_retry(post, [?MYNAME, Path, [],
|
case rest:with_retry(post, [ejabberd_config:get_myname(), Path, [],
|
||||||
{[{<<"token">>, Token}]}],
|
{[{<<"token">>, Token}]}],
|
||||||
2, 500) of
|
2, 500) of
|
||||||
{ok, 200, {Data}} ->
|
{ok, 200, {Data}} ->
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
clean/1]).
|
clean/1]).
|
||||||
|
|
||||||
-include("ejabberd_oauth.hrl").
|
-include("ejabberd_oauth.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
-include("jid.hrl").
|
-include("jid.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
@ -49,7 +48,7 @@ store(R) ->
|
|||||||
Scope = str:join(R#oauth_token.scope, <<" ">>),
|
Scope = str:join(R#oauth_token.scope, <<" ">>),
|
||||||
Expire = R#oauth_token.expire,
|
Expire = R#oauth_token.expire,
|
||||||
case ?SQL_UPSERT(
|
case ?SQL_UPSERT(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
"oauth_token",
|
"oauth_token",
|
||||||
["!token=%(Token)s",
|
["!token=%(Token)s",
|
||||||
"jid=%(SJID)s",
|
"jid=%(SJID)s",
|
||||||
@ -63,7 +62,7 @@ store(R) ->
|
|||||||
|
|
||||||
lookup(Token) ->
|
lookup(Token) ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("select @(jid)s, @(scope)s, @(expire)d"
|
?SQL("select @(jid)s, @(scope)s, @(expire)d"
|
||||||
" from oauth_token where token=%(Token)s")) of
|
" from oauth_token where token=%(Token)s")) of
|
||||||
{selected, [{SJID, Scope, Expire}]} ->
|
{selected, [{SJID, Scope, Expire}]} ->
|
||||||
@ -79,6 +78,6 @@ lookup(Token) ->
|
|||||||
|
|
||||||
clean(TS) ->
|
clean(TS) ->
|
||||||
ejabberd_sql:sql_query(
|
ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("delete from oauth_token where expire < %(TS)d")).
|
?SQL("delete from oauth_token where expire < %(TS)d")).
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
-define(CHUNK_SIZE, 1024*20). %20k
|
-define(CHUNK_SIZE, 1024*20). %20k
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("scram.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("mod_privacy.hrl").
|
-include("mod_privacy.hrl").
|
||||||
@ -92,7 +92,7 @@ import_file(FileName, State) ->
|
|||||||
|
|
||||||
-spec export_server(binary()) -> any().
|
-spec export_server(binary()) -> any().
|
||||||
export_server(Dir) ->
|
export_server(Dir) ->
|
||||||
export_hosts(?MYHOSTS, Dir).
|
export_hosts(ejabberd_config:get_myhosts(), Dir).
|
||||||
|
|
||||||
-spec export_host(binary(), binary()) -> any().
|
-spec export_host(binary(), binary()) -> any().
|
||||||
export_host(Dir, Host) ->
|
export_host(Dir, Host) ->
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
-export([start_link/0, init/1, opt_type/1,
|
-export([start_link/0, init/1, opt_type/1,
|
||||||
config_reloaded/0, start_host/1, stop_host/1]).
|
config_reloaded/0, start_host/1, stop_host/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
@ -56,7 +55,7 @@ get_specs() ->
|
|||||||
{ok, Spec} -> [Spec];
|
{ok, Spec} -> [Spec];
|
||||||
undefined -> []
|
undefined -> []
|
||||||
end
|
end
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec get_spec(binary()) -> {ok, supervisor:child_spec()} | undefined.
|
-spec get_spec(binary()) -> {ok, supervisor:child_spec()} | undefined.
|
||||||
get_spec(Host) ->
|
get_spec(Host) ->
|
||||||
@ -72,7 +71,7 @@ get_spec(Host) ->
|
|||||||
|
|
||||||
-spec config_reloaded() -> ok.
|
-spec config_reloaded() -> ok.
|
||||||
config_reloaded() ->
|
config_reloaded() ->
|
||||||
lists:foreach(fun start_host/1, ?MYHOSTS).
|
lists:foreach(fun start_host/1, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec start_host(binary()) -> ok.
|
-spec start_host(binary()) -> ok.
|
||||||
start_host(Host) ->
|
start_host(Host) ->
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
-define(CALL_TIMEOUT, 60*1000). %% 60 seconds
|
-define(CALL_TIMEOUT, 60*1000). %% 60 seconds
|
||||||
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
|
|
||||||
-record(state, {connection :: pid() | undefined,
|
-record(state, {connection :: pid() | undefined,
|
||||||
num :: pos_integer(),
|
num :: pos_integer(),
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
%% Supervisor callbacks
|
%% Supervisor callbacks
|
||||||
-export([init/1]).
|
-export([init/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(DEFAULT_POOL_SIZE, 10).
|
-define(DEFAULT_POOL_SIZE, 10).
|
||||||
@ -98,7 +97,7 @@ init([]) ->
|
|||||||
%%% Internal functions
|
%%% Internal functions
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
is_redis_configured() ->
|
is_redis_configured() ->
|
||||||
lists:any(fun is_redis_configured/1, ?MYHOSTS).
|
lists:any(fun is_redis_configured/1, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
is_redis_configured(Host) ->
|
is_redis_configured(Host) ->
|
||||||
ServerConfigured = ejabberd_config:has_option({redis_server, Host}),
|
ServerConfigured = ejabberd_config:has_option({redis_server, Host}),
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-record(state, {pid = self() :: pid()}).
|
-record(state, {pid = self() :: pid()}).
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
transform_options/1, get_random_pid/0,
|
transform_options/1, get_random_pid/0,
|
||||||
host_up/1, config_reloaded/0, opt_type/1]).
|
host_up/1, config_reloaded/0, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(DEFAULT_POOL_SIZE, 10).
|
-define(DEFAULT_POOL_SIZE, 10).
|
||||||
@ -74,7 +73,7 @@ config_reloaded() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
is_riak_configured() ->
|
is_riak_configured() ->
|
||||||
lists:any(fun is_riak_configured/1, ?MYHOSTS).
|
lists:any(fun is_riak_configured/1, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
is_riak_configured(Host) ->
|
is_riak_configured(Host) ->
|
||||||
ServerConfigured = ejabberd_config:has_option({riak_server, Host}),
|
ServerConfigured = ejabberd_config:has_option({riak_server, Host}),
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
%% This value is used in SIP and Megaco for a transaction lifetime.
|
%% This value is used in SIP and Megaco for a transaction lifetime.
|
||||||
-define(IQ_TIMEOUT, 32000).
|
-define(IQ_TIMEOUT, 32000).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_router.hrl").
|
-include("ejabberd_router.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_router.hrl").
|
-include("ejabberd_router.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3]).
|
terminate/2, code_change/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_router.hrl").
|
-include("ejabberd_router.hrl").
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
-export([init/0, register_route/5, unregister_route/3, find_routes/1,
|
-export([init/0, register_route/5, unregister_route/3, find_routes/1,
|
||||||
get_all_routes/0]).
|
get_all_routes/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
-include("ejabberd_router.hrl").
|
-include("ejabberd_router.hrl").
|
||||||
@ -41,7 +40,7 @@ init() ->
|
|||||||
Node = erlang:atom_to_binary(node(), latin1),
|
Node = erlang:atom_to_binary(node(), latin1),
|
||||||
?DEBUG("Cleaning SQL 'route' table...", []),
|
?DEBUG("Cleaning SQL 'route' table...", []),
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME, ?SQL("delete from route where node=%(Node)s")) of
|
ejabberd_config:get_myname(), ?SQL("delete from route where node=%(Node)s")) of
|
||||||
{updated, _} ->
|
{updated, _} ->
|
||||||
ok;
|
ok;
|
||||||
Err ->
|
Err ->
|
||||||
@ -53,7 +52,7 @@ register_route(Domain, ServerHost, LocalHint, _, Pid) ->
|
|||||||
PidS = misc:encode_pid(Pid),
|
PidS = misc:encode_pid(Pid),
|
||||||
LocalHintS = enc_local_hint(LocalHint),
|
LocalHintS = enc_local_hint(LocalHint),
|
||||||
Node = erlang:atom_to_binary(node(Pid), latin1),
|
Node = erlang:atom_to_binary(node(Pid), latin1),
|
||||||
case ?SQL_UPSERT(?MYNAME, "route",
|
case ?SQL_UPSERT(ejabberd_config:get_myname(), "route",
|
||||||
["!domain=%(Domain)s",
|
["!domain=%(Domain)s",
|
||||||
"!server_host=%(ServerHost)s",
|
"!server_host=%(ServerHost)s",
|
||||||
"!node=%(Node)s",
|
"!node=%(Node)s",
|
||||||
@ -69,7 +68,7 @@ unregister_route(Domain, _, Pid) ->
|
|||||||
PidS = misc:encode_pid(Pid),
|
PidS = misc:encode_pid(Pid),
|
||||||
Node = erlang:atom_to_binary(node(Pid), latin1),
|
Node = erlang:atom_to_binary(node(Pid), latin1),
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("delete from route where domain=%(Domain)s "
|
?SQL("delete from route where domain=%(Domain)s "
|
||||||
"and pid=%(PidS)s and node=%(Node)s")) of
|
"and pid=%(PidS)s and node=%(Node)s")) of
|
||||||
{updated, _} ->
|
{updated, _} ->
|
||||||
@ -80,7 +79,7 @@ unregister_route(Domain, _, Pid) ->
|
|||||||
|
|
||||||
find_routes(Domain) ->
|
find_routes(Domain) ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("select @(server_host)s, @(node)s, @(pid)s, @(local_hint)s "
|
?SQL("select @(server_host)s, @(node)s, @(pid)s, @(local_hint)s "
|
||||||
"from route where domain=%(Domain)s")) of
|
"from route where domain=%(Domain)s")) of
|
||||||
{selected, Rows} ->
|
{selected, Rows} ->
|
||||||
@ -94,7 +93,7 @@ find_routes(Domain) ->
|
|||||||
|
|
||||||
get_all_routes() ->
|
get_all_routes() ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("select @(domain)s from route where domain <> server_host")) of
|
?SQL("select @(domain)s from route where domain <> server_host")) of
|
||||||
{selected, Domains} ->
|
{selected, Domains} ->
|
||||||
{ok, [Domain || {Domain} <- Domains]};
|
{ok, [Domain || {Domain} <- Domains]};
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
-export([get_info_s2s_connections/1,
|
-export([get_info_s2s_connections/1,
|
||||||
transform_options/1, opt_type/1]).
|
transform_options/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -303,7 +302,7 @@ init([]) ->
|
|||||||
{attributes, record_info(fields, temporarily_blocked)}]),
|
{attributes, record_info(fields, temporarily_blocked)}]),
|
||||||
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
|
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
|
||||||
lists:foreach(fun host_up/1, ?MYHOSTS),
|
lists:foreach(fun host_up/1, ejabberd_config:get_myhosts()),
|
||||||
{ok, #state{}}.
|
{ok, #state{}}.
|
||||||
|
|
||||||
handle_call(_Request, _From, State) ->
|
handle_call(_Request, _From, State) ->
|
||||||
@ -322,7 +321,7 @@ handle_info(_Info, State) -> {noreply, State}.
|
|||||||
|
|
||||||
terminate(_Reason, _State) ->
|
terminate(_Reason, _State) ->
|
||||||
ejabberd_commands:unregister_commands(get_commands_spec()),
|
ejabberd_commands:unregister_commands(get_commands_spec()),
|
||||||
lists:foreach(fun host_down/1, ?MYHOSTS),
|
lists:foreach(fun host_down/1, ejabberd_config:get_myhosts()),
|
||||||
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 60),
|
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 60),
|
||||||
ok.
|
ok.
|
||||||
@ -544,7 +543,7 @@ is_service(From, To) ->
|
|||||||
s2s -> % bypass RFC 3920 10.3
|
s2s -> % bypass RFC 3920 10.3
|
||||||
false;
|
false;
|
||||||
local ->
|
local ->
|
||||||
Hosts = (?MYHOSTS),
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
P = fun (ParentDomain) ->
|
P = fun (ParentDomain) ->
|
||||||
lists:member(ParentDomain, Hosts)
|
lists:member(ParentDomain, Hosts)
|
||||||
end,
|
end,
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
-export([stop/1, close/1, close/2, send/2, update_state/2, establish/1,
|
-export([stop/1, close/1, close/2, send/2, update_state/2, establish/1,
|
||||||
host_up/1, host_down/1]).
|
host_up/1, host_down/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
@ -263,10 +262,10 @@ init([State, Opts]) ->
|
|||||||
State1 = State#{tls_options => TLSOpts2,
|
State1 = State#{tls_options => TLSOpts2,
|
||||||
auth_domains => sets:new(),
|
auth_domains => sets:new(),
|
||||||
xmlns => ?NS_SERVER,
|
xmlns => ?NS_SERVER,
|
||||||
lang => ?MYLANG,
|
lang => ejabberd_config:get_mylang(),
|
||||||
server => ?MYNAME,
|
server => ejabberd_config:get_myname(),
|
||||||
lserver => ?MYNAME,
|
lserver => ejabberd_config:get_myname(),
|
||||||
server_host => ?MYNAME,
|
server_host => ejabberd_config:get_myname(),
|
||||||
established => false,
|
established => false,
|
||||||
shaper => Shaper},
|
shaper => Shaper},
|
||||||
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
-export([start/3, start_link/3, connect/1, close/1, close/2, stop/1, send/2,
|
-export([start/3, start_link/3, connect/1, close/1, close/2, stop/1, send/2,
|
||||||
route/2, establish/1, update_state/2, host_up/1, host_down/1]).
|
route/2, establish/1, update_state/2, host_up/1, host_down/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
@ -274,7 +273,7 @@ init([#{server := LServer, remote_server := RServer} = State, Opts]) ->
|
|||||||
State1 = State#{on_route => queue,
|
State1 = State#{on_route => queue,
|
||||||
queue => p1_queue:new(QueueType, QueueLimit),
|
queue => p1_queue:new(QueueType, QueueLimit),
|
||||||
xmlns => ?NS_SERVER,
|
xmlns => ?NS_SERVER,
|
||||||
lang => ?MYLANG,
|
lang => ejabberd_config:get_mylang(),
|
||||||
server_host => ServerHost,
|
server_host => ServerHost,
|
||||||
shaper => none},
|
shaper => none},
|
||||||
State2 = xmpp_stream_out:set_timeout(State1, Timeout),
|
State2 = xmpp_stream_out:set_timeout(State1, Timeout),
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
%% API
|
%% API
|
||||||
-export([send/2]).
|
-export([send/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
@ -106,8 +105,8 @@ init([State, Opts]) ->
|
|||||||
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
State2 = xmpp_stream_in:set_timeout(State1, Timeout),
|
||||||
State3 = State2#{access => Access,
|
State3 = State2#{access => Access,
|
||||||
xmlns => ?NS_COMPONENT,
|
xmlns => ?NS_COMPONENT,
|
||||||
lang => ?MYLANG,
|
lang => ejabberd_config:get_mylang(),
|
||||||
server => ?MYNAME,
|
server => ejabberd_config:get_myname(),
|
||||||
host_opts => dict:from_list(HostOpts1),
|
host_opts => dict:from_list(HostOpts1),
|
||||||
stream_version => undefined,
|
stream_version => undefined,
|
||||||
tls_options => TLSOpts,
|
tls_options => TLSOpts,
|
||||||
@ -170,7 +169,7 @@ handle_auth_success(_, Mech, _,
|
|||||||
end,
|
end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(H) ->
|
fun(H) ->
|
||||||
ejabberd_router:register_route(H, ?MYNAME),
|
ejabberd_router:register_route(H, ejabberd_config:get_myname()),
|
||||||
ejabberd_hooks:run(component_connected, [H])
|
ejabberd_hooks:run(component_connected, [H])
|
||||||
end, Routes),
|
end, Routes),
|
||||||
State.
|
State.
|
||||||
|
@ -44,7 +44,6 @@ start(_, _) ->
|
|||||||
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
|
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
|
||||||
socket_type/0, listen_opt_type/1]).
|
socket_type/0, listen_opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% API
|
%%% API
|
||||||
@ -71,11 +70,11 @@ set_certfile(Opts) ->
|
|||||||
true ->
|
true ->
|
||||||
Opts;
|
Opts;
|
||||||
false ->
|
false ->
|
||||||
case ejabberd_pkix:get_certfile(?MYNAME) of
|
case ejabberd_pkix:get_certfile(ejabberd_config:get_myname()) of
|
||||||
{ok, CertFile} ->
|
{ok, CertFile} ->
|
||||||
[{certfile, CertFile}|Opts];
|
[{certfile, CertFile}|Opts];
|
||||||
error ->
|
error ->
|
||||||
case ejabberd_config:get_option({domain_certfile, ?MYNAME}) of
|
case ejabberd_config:get_option({domain_certfile, ejabberd_config:get_myname()}) of
|
||||||
undefined ->
|
undefined ->
|
||||||
Opts;
|
Opts;
|
||||||
CertFile ->
|
CertFile ->
|
||||||
|
@ -85,7 +85,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2,
|
-export([init/1, handle_call/3, handle_cast/2,
|
||||||
handle_info/2, terminate/2, code_change/3, opt_type/1]).
|
handle_info/2, terminate/2, code_change/3, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -428,7 +427,7 @@ init([]) ->
|
|||||||
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
|
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
|
||||||
ejabberd_hooks:add(config_reloaded, ?MODULE, config_reloaded, 50),
|
ejabberd_hooks:add(config_reloaded, ?MODULE, config_reloaded, 50),
|
||||||
lists:foreach(fun host_up/1, ?MYHOSTS),
|
lists:foreach(fun host_up/1, ejabberd_config:get_myhosts()),
|
||||||
ejabberd_commands:register_commands(get_commands_spec()),
|
ejabberd_commands:register_commands(get_commands_spec()),
|
||||||
{ok, #state{}}.
|
{ok, #state{}}.
|
||||||
|
|
||||||
@ -445,7 +444,7 @@ handle_info(Info, State) ->
|
|||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
terminate(_Reason, _State) ->
|
terminate(_Reason, _State) ->
|
||||||
lists:foreach(fun host_down/1, ?MYHOSTS),
|
lists:foreach(fun host_down/1, ejabberd_config:get_myhosts()),
|
||||||
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
ejabberd_hooks:delete(host_up, ?MODULE, host_up, 50),
|
||||||
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 60),
|
ejabberd_hooks:delete(host_down, ?MODULE, host_down, 60),
|
||||||
ejabberd_hooks:delete(config_reloaded, ?MODULE, config_reloaded, 50),
|
ejabberd_hooks:delete(config_reloaded, ?MODULE, config_reloaded, 50),
|
||||||
@ -848,7 +847,7 @@ get_sm_backend(Host) ->
|
|||||||
-spec get_sm_backends() -> [module()].
|
-spec get_sm_backends() -> [module()].
|
||||||
|
|
||||||
get_sm_backends() ->
|
get_sm_backends() ->
|
||||||
lists:usort([get_sm_backend(Host) || Host <- ?MYHOSTS]).
|
lists:usort([get_sm_backend(Host) || Host <- ejabberd_config:get_myhosts()]).
|
||||||
|
|
||||||
-spec get_vh_by_backend(module()) -> [binary()].
|
-spec get_vh_by_backend(module()) -> [binary()].
|
||||||
|
|
||||||
@ -856,7 +855,7 @@ get_vh_by_backend(Mod) ->
|
|||||||
lists:filter(
|
lists:filter(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
get_sm_backend(Host) == Mod
|
get_sm_backend(Host) == Mod
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%%% Cache stuff
|
%%% Cache stuff
|
||||||
@ -919,7 +918,7 @@ use_cache() ->
|
|||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
Mod = get_sm_backend(Host),
|
Mod = get_sm_backend(Host),
|
||||||
use_cache(Mod, Host)
|
use_cache(Mod, Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec cache_nodes(module(), binary()) -> [node()].
|
-spec cache_nodes(module(), binary()) -> [node()].
|
||||||
cache_nodes(Mod, LServer) ->
|
cache_nodes(Mod, LServer) ->
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_sm.hrl").
|
-include("ejabberd_sm.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_sm.hrl").
|
-include("ejabberd_sm.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
get_sessions/1,
|
get_sessions/1,
|
||||||
get_sessions/2]).
|
get_sessions/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_sm.hrl").
|
-include("ejabberd_sm.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
|
@ -66,7 +66,6 @@
|
|||||||
session_established/2, session_established/3,
|
session_established/2, session_established/3,
|
||||||
opt_type/1]).
|
opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
get_pids/1, get_random_pid/1, transform_options/1,
|
get_pids/1, get_random_pid/1, transform_options/1,
|
||||||
opt_type/1]).
|
opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(PGSQL_PORT, 5432).
|
-define(PGSQL_PORT, 5432).
|
||||||
@ -172,12 +171,7 @@ check_sqlite_db(Host) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
create_sqlite_tables(DB) ->
|
create_sqlite_tables(DB) ->
|
||||||
SqlDir = case code:priv_dir(ejabberd) of
|
SqlDir = misc:sql_dir(),
|
||||||
{error, _} ->
|
|
||||||
?SQL_DIR;
|
|
||||||
PrivDir ->
|
|
||||||
filename:join(PrivDir, "sql")
|
|
||||||
end,
|
|
||||||
File = filename:join(SqlDir, "lite.sql"),
|
File = filename:join(SqlDir, "lite.sql"),
|
||||||
case file:open(File, [read, binary]) of
|
case file:open(File, [read, binary]) of
|
||||||
{ok, Fd} ->
|
{ok, Fd} ->
|
||||||
|
@ -46,7 +46,6 @@ start(_, _) ->
|
|||||||
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
|
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
|
||||||
socket_type/0, listen_opt_type/1]).
|
socket_type/0, listen_opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
@ -79,7 +78,7 @@ prepare_turn_opts(Opts) ->
|
|||||||
prepare_turn_opts(Opts, _UseTurn = false) ->
|
prepare_turn_opts(Opts, _UseTurn = false) ->
|
||||||
set_certfile(Opts);
|
set_certfile(Opts);
|
||||||
prepare_turn_opts(Opts, _UseTurn = true) ->
|
prepare_turn_opts(Opts, _UseTurn = true) ->
|
||||||
NumberOfMyHosts = length(?MYHOSTS),
|
NumberOfMyHosts = length(ejabberd_config:get_myhosts()),
|
||||||
case proplists:get_value(turn_ip, Opts) of
|
case proplists:get_value(turn_ip, Opts) of
|
||||||
undefined ->
|
undefined ->
|
||||||
?WARNING_MSG("option 'turn_ip' is undefined, "
|
?WARNING_MSG("option 'turn_ip' is undefined, "
|
||||||
@ -100,11 +99,11 @@ prepare_turn_opts(Opts, _UseTurn = true) ->
|
|||||||
"'auth_type' is set to 'user', "
|
"'auth_type' is set to 'user', "
|
||||||
"more likely the TURN relay won't "
|
"more likely the TURN relay won't "
|
||||||
"be working properly. Using ~s as "
|
"be working properly. Using ~s as "
|
||||||
"a fallback", [?MYNAME]);
|
"a fallback", [ejabberd_config:get_myname()]);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
[{auth_realm, ?MYNAME}];
|
[{auth_realm, ejabberd_config:get_myname()}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
@ -118,7 +117,7 @@ set_certfile(Opts) ->
|
|||||||
true ->
|
true ->
|
||||||
Opts;
|
Opts;
|
||||||
false ->
|
false ->
|
||||||
Realm = proplists:get_value(auth_realm, Opts, ?MYNAME),
|
Realm = proplists:get_value(auth_realm, Opts, ejabberd_config:get_myname()),
|
||||||
case ejabberd_pkix:get_certfile(Realm) of
|
case ejabberd_pkix:get_certfile(Realm) of
|
||||||
{ok, CertFile} ->
|
{ok, CertFile} ->
|
||||||
[{certfile, CertFile}|Opts];
|
[{certfile, CertFile}|Opts];
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
%% API
|
%% API
|
||||||
-export([update/0, update/1, update_info/0]).
|
-export([update/0, update/1, update_info/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
%% External exports
|
%% External exports
|
||||||
-export([make_xhtml/1, make_xhtml/2, error/1]).
|
-export([make_xhtml/1, make_xhtml/2, error/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
list_users_in_diapason/4, pretty_print_xml/1,
|
list_users_in_diapason/4, pretty_print_xml/1,
|
||||||
term_to_id/1, opt_type/1]).
|
term_to_id/1, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -1062,7 +1061,7 @@ parse_access_rule(Text) ->
|
|||||||
%%%% list_vhosts
|
%%%% list_vhosts
|
||||||
|
|
||||||
list_vhosts(Lang, JID) ->
|
list_vhosts(Lang, JID) ->
|
||||||
Hosts = (?MYHOSTS),
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
HostsAllowed = lists:filter(fun (Host) ->
|
HostsAllowed = lists:filter(fun (Host) ->
|
||||||
acl:any_rules_allowed(Host,
|
acl:any_rules_allowed(Host,
|
||||||
[configure, webadmin_view],
|
[configure, webadmin_view],
|
||||||
@ -1282,7 +1281,7 @@ get_stats(global, Lang) ->
|
|||||||
ejabberd_auth:count_users(Host)
|
ejabberd_auth:count_users(Host)
|
||||||
+ Total
|
+ Total
|
||||||
end,
|
end,
|
||||||
0, ?MYHOSTS),
|
0, ejabberd_config:get_myhosts()),
|
||||||
OutS2SNumber = ejabberd_s2s:outgoing_s2s_number(),
|
OutS2SNumber = ejabberd_s2s:outgoing_s2s_number(),
|
||||||
InS2SNumber = ejabberd_s2s:incoming_s2s_number(),
|
InS2SNumber = ejabberd_s2s:incoming_s2s_number(),
|
||||||
[?XAE(<<"table">>, [],
|
[?XAE(<<"table">>, [],
|
||||||
@ -1784,7 +1783,7 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
|||||||
?C(<<" ">>),
|
?C(<<" ">>),
|
||||||
?INPUT(<<"text">>,
|
?INPUT(<<"text">>,
|
||||||
<<"export_piefxis_host_dirhost">>,
|
<<"export_piefxis_host_dirhost">>,
|
||||||
(?MYNAME))]),
|
(ejabberd_config:get_myname()))]),
|
||||||
?XE(<<"td">>,
|
?XE(<<"td">>,
|
||||||
[?INPUT(<<"text">>,
|
[?INPUT(<<"text">>,
|
||||||
<<"export_piefxis_host_dirpath">>,
|
<<"export_piefxis_host_dirpath">>,
|
||||||
@ -1800,7 +1799,7 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
|||||||
?C(<<" ">>),
|
?C(<<" ">>),
|
||||||
?INPUT(<<"text">>,
|
?INPUT(<<"text">>,
|
||||||
<<"export_sql_filehost">>,
|
<<"export_sql_filehost">>,
|
||||||
(?MYNAME))]),
|
(ejabberd_config:get_myname()))]),
|
||||||
?XE(<<"td">>,
|
?XE(<<"td">>,
|
||||||
[?INPUT(<<"text">>,
|
[?INPUT(<<"text">>,
|
||||||
<<"export_sql_filepath">>,
|
<<"export_sql_filepath">>,
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
-export([check/2, socket_handoff/5]).
|
-export([check/2, socket_handoff/5]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
-export([start/2, handler/2, process/2, socket_type/0,
|
-export([start/2, handler/2, process/2, socket_type/0,
|
||||||
transform_listen_option/2, listen_opt_type/1]).
|
transform_listen_option/2, listen_opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
-include("mod_roster.hrl").
|
-include("mod_roster.hrl").
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
-behaviour(p1_fsm).
|
-behaviour(p1_fsm).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("type_compat.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%% External exports
|
%% External exports
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
-export([start_link/7, bind/3, search/2,
|
-export([start_link/7, bind/3, search/2,
|
||||||
modify_passwd/3]).
|
modify_passwd/3]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
decode_octet_string/3, uids_domain_subst/2, opt_type/1,
|
decode_octet_string/3, uids_domain_subst/2, opt_type/1,
|
||||||
options/1]).
|
options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("eldap.hrl").
|
-include("eldap.hrl").
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
-export([add_iq_handler/6, handle/5, iqdisc/1]).
|
-export([add_iq_handler/6, handle/5, iqdisc/1]).
|
||||||
-deprecated([{add_iq_handler, 6}, {handle, 5}, {iqdisc, 1}]).
|
-deprecated([{add_iq_handler, 6}, {handle, 5}, {iqdisc, 1}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
{ram_db_type, 2},
|
{ram_db_type, 2},
|
||||||
{ram_db_type, 3}]).
|
{ram_db_type, 3}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ stop_child(Proc) ->
|
|||||||
|
|
||||||
%% Start all the modules in all the hosts
|
%% Start all the modules in all the hosts
|
||||||
start_modules() ->
|
start_modules() ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
?INFO_MSG("Loading modules for ~s", [format_hosts_list(Hosts)]),
|
?INFO_MSG("Loading modules for ~s", [format_hosts_list(Hosts)]),
|
||||||
lists:foreach(fun start_modules/1, Hosts).
|
lists:foreach(fun start_modules/1, Hosts).
|
||||||
|
|
||||||
@ -327,7 +326,7 @@ stop_modules() ->
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
stop_modules(Host)
|
stop_modules(Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec stop_modules(binary()) -> ok.
|
-spec stop_modules(binary()) -> ok.
|
||||||
|
|
||||||
@ -418,7 +417,7 @@ get_module_opt(Host, Module, Opt) ->
|
|||||||
get_module_opt(Host, Module, Opt, F) when is_function(F) ->
|
get_module_opt(Host, Module, Opt, F) when is_function(F) ->
|
||||||
get_module_opt(Host, Module, Opt, undefined);
|
get_module_opt(Host, Module, Opt, undefined);
|
||||||
get_module_opt(global, Module, Opt, Default) ->
|
get_module_opt(global, Module, Opt, Default) ->
|
||||||
Hosts = (?MYHOSTS),
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
[Value | Values] = lists:map(fun (Host) ->
|
[Value | Values] = lists:map(fun (Host) ->
|
||||||
get_module_opt(Host, Module, Opt,
|
get_module_opt(Host, Module, Opt,
|
||||||
Default)
|
Default)
|
||||||
@ -867,7 +866,7 @@ get_hosts(Opts, Prefix) ->
|
|||||||
undefined ->
|
undefined ->
|
||||||
case get_opt(host, Opts) of
|
case get_opt(host, Opts) of
|
||||||
undefined ->
|
undefined ->
|
||||||
[<<Prefix/binary, Host/binary>> || Host <- ?MYHOSTS];
|
[<<Prefix/binary, Host/binary>> || Host <- ejabberd_config:get_myhosts()];
|
||||||
Host ->
|
Host ->
|
||||||
[Host]
|
[Host]
|
||||||
end;
|
end;
|
||||||
@ -902,7 +901,7 @@ config_reloaded() ->
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
reload_modules(Host)
|
reload_modules(Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec is_equal_opt(atom(), opts(), opts()) ->
|
-spec is_equal_opt(atom(), opts(), opts()) ->
|
||||||
true | {false, any(), any()}.
|
true | {false, any(), any()}.
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
%% External exports
|
%% External exports
|
||||||
-export([import_file/1, import_dir/1]).
|
-export([import_file/1, import_dir/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@
|
|||||||
{expr_to_term, 1},
|
{expr_to_term, 1},
|
||||||
{term_to_expr, 1}]).
|
{term_to_expr, 1}]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
|
|
||||||
%send_iq(From, To, ID, SubTags) ->
|
%send_iq(From, To, ID, SubTags) ->
|
||||||
|
59
src/misc.erl
59
src/misc.erl
@ -33,8 +33,9 @@
|
|||||||
atom_to_binary/1, binary_to_atom/1, tuple_to_binary/1,
|
atom_to_binary/1, binary_to_atom/1, tuple_to_binary/1,
|
||||||
l2i/1, i2l/1, i2l/2, expr_to_term/1, term_to_expr/1,
|
l2i/1, i2l/1, i2l/2, expr_to_term/1, term_to_expr/1,
|
||||||
now_to_usec/1, usec_to_now/1, encode_pid/1, decode_pid/2,
|
now_to_usec/1, usec_to_now/1, encode_pid/1, decode_pid/2,
|
||||||
compile_exprs/2, join_atoms/2, try_read_file/1,
|
compile_exprs/2, join_atoms/2, try_read_file/1, get_descr/2,
|
||||||
css_dir/0, img_dir/0, js_dir/0, read_css/1, read_img/1, read_js/1]).
|
css_dir/0, img_dir/0, js_dir/0, msgs_dir/0, sql_dir/0,
|
||||||
|
read_css/1, read_img/1, read_js/1]).
|
||||||
|
|
||||||
%% Deprecated functions
|
%% Deprecated functions
|
||||||
-export([decode_base64/1, encode_base64/1]).
|
-export([decode_base64/1, encode_base64/1]).
|
||||||
@ -220,36 +221,23 @@ try_read_file(Path) ->
|
|||||||
|
|
||||||
-spec css_dir() -> file:filename().
|
-spec css_dir() -> file:filename().
|
||||||
css_dir() ->
|
css_dir() ->
|
||||||
case os:getenv("EJABBERD_CSS_PATH") of
|
get_dir("css").
|
||||||
false ->
|
|
||||||
case code:priv_dir(ejabberd) of
|
|
||||||
{error, _} -> filename:join(["priv", "css"]);
|
|
||||||
Path -> filename:join([Path, "css"])
|
|
||||||
end;
|
|
||||||
Path -> Path
|
|
||||||
end.
|
|
||||||
|
|
||||||
-spec img_dir() -> file:filename().
|
-spec img_dir() -> file:filename().
|
||||||
img_dir() ->
|
img_dir() ->
|
||||||
case os:getenv("EJABBERD_IMG_PATH") of
|
get_dir("img").
|
||||||
false ->
|
|
||||||
case code:priv_dir(ejabberd) of
|
|
||||||
{error, _} -> filename:join(["priv", "img"]);
|
|
||||||
Path -> filename:join([Path, "img"])
|
|
||||||
end;
|
|
||||||
Path -> Path
|
|
||||||
end.
|
|
||||||
|
|
||||||
-spec js_dir() -> file:filename().
|
-spec js_dir() -> file:filename().
|
||||||
js_dir() ->
|
js_dir() ->
|
||||||
case os:getenv("EJABBERD_JS_PATH") of
|
get_dir("js").
|
||||||
false ->
|
|
||||||
case code:priv_dir(ejabberd) of
|
-spec msgs_dir() -> file:filename().
|
||||||
{error, _} -> filename:join(["priv", "js"]);
|
msgs_dir() ->
|
||||||
Path -> filename:join([Path, "js"])
|
get_dir("msgs").
|
||||||
end;
|
|
||||||
Path -> Path
|
-spec sql_dir() -> file:filename().
|
||||||
end.
|
sql_dir() ->
|
||||||
|
get_dir("sql").
|
||||||
|
|
||||||
-spec read_css(file:filename()) -> {ok, binary()} | {error, file:posix()}.
|
-spec read_css(file:filename()) -> {ok, binary()} | {error, file:posix()}.
|
||||||
read_css(File) ->
|
read_css(File) ->
|
||||||
@ -263,6 +251,12 @@ read_img(File) ->
|
|||||||
read_js(File) ->
|
read_js(File) ->
|
||||||
read_file(filename:join(js_dir(), File)).
|
read_file(filename:join(js_dir(), File)).
|
||||||
|
|
||||||
|
-spec get_descr(binary(), binary()) -> binary().
|
||||||
|
get_descr(Lang, Text) ->
|
||||||
|
Desc = translate:translate(Lang, Text),
|
||||||
|
Copyright = ejabberd_config:get_copyright(),
|
||||||
|
<<Desc/binary, $\n, Copyright/binary>>.
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Internal functions
|
%%% Internal functions
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
@ -304,3 +298,16 @@ read_file(Path) ->
|
|||||||
[Path, file:format_error(Why)]),
|
[Path, file:format_error(Why)]),
|
||||||
Err
|
Err
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec get_dir(string()) -> file:filename().
|
||||||
|
get_dir(Type) ->
|
||||||
|
Env = "EJABBERD_" ++ string:to_upper(Type) ++ "_PATH",
|
||||||
|
case os:getenv(Env) of
|
||||||
|
false ->
|
||||||
|
case code:priv_dir(ejabberd) of
|
||||||
|
{error, _} -> filename:join(["priv", Type]);
|
||||||
|
Path -> filename:join([Path, Type])
|
||||||
|
end;
|
||||||
|
Path ->
|
||||||
|
Path
|
||||||
|
end.
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
ping_item/4, ping_command/4, mod_opt_type/1, depends/2,
|
ping_item/4, ping_command/4, mod_opt_type/1, depends/2,
|
||||||
mod_options/1]).
|
mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("mod_roster.hrl").
|
-include("mod_roster.hrl").
|
||||||
-include("mod_privacy.hrl").
|
-include("mod_privacy.hrl").
|
||||||
@ -1594,7 +1593,7 @@ stats(Name) ->
|
|||||||
case Name of
|
case Name of
|
||||||
<<"uptimeseconds">> -> trunc(element(1, erlang:statistics(wall_clock))/1000);
|
<<"uptimeseconds">> -> trunc(element(1, erlang:statistics(wall_clock))/1000);
|
||||||
<<"processes">> -> length(erlang:processes());
|
<<"processes">> -> length(erlang:processes());
|
||||||
<<"registeredusers">> -> lists:foldl(fun(Host, Sum) -> ejabberd_auth:count_users(Host) + Sum end, 0, ?MYHOSTS);
|
<<"registeredusers">> -> lists:foldl(fun(Host, Sum) -> ejabberd_auth:count_users(Host) + Sum end, 0, ejabberd_config:get_myhosts());
|
||||||
<<"onlineusersnode">> -> length(ejabberd_sm:dirty_get_my_sessions_list());
|
<<"onlineusersnode">> -> length(ejabberd_sm:dirty_get_my_sessions_list());
|
||||||
<<"onlineusers">> -> length(ejabberd_sm:dirty_get_sessions_list())
|
<<"onlineusers">> -> length(ejabberd_sm:dirty_get_sessions_list())
|
||||||
end.
|
end.
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
@ -82,7 +81,7 @@ update_sql() ->
|
|||||||
_ ->
|
_ ->
|
||||||
update_sql(Host)
|
update_sql(Host)
|
||||||
end
|
end
|
||||||
end, ?MYHOSTS),
|
end, ejabberd_config:get_myhosts()),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
-record(state, {host :: binary(),
|
-record(state, {host :: binary(),
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
announce_motd_delete/1,
|
announce_motd_delete/1,
|
||||||
announce_all_hosts_motd_delete/1]).
|
announce_all_hosts_motd_delete/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("mod_announce.hrl").
|
-include("mod_announce.hrl").
|
||||||
@ -670,7 +669,7 @@ announce_motd(#message{to = To} = Packet) ->
|
|||||||
announce_motd(To#jid.lserver, Packet).
|
announce_motd(To#jid.lserver, Packet).
|
||||||
|
|
||||||
announce_all_hosts_motd(Packet) ->
|
announce_all_hosts_motd(Packet) ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
[announce_motd(Host, Packet) || Host <- Hosts].
|
[announce_motd(Host, Packet) || Host <- Hosts].
|
||||||
|
|
||||||
announce_motd(Host, Packet) ->
|
announce_motd(Host, Packet) ->
|
||||||
@ -685,7 +684,7 @@ announce_motd_update(#message{to = To} = Packet) ->
|
|||||||
announce_motd_update(To#jid.lserver, Packet).
|
announce_motd_update(To#jid.lserver, Packet).
|
||||||
|
|
||||||
announce_all_hosts_motd_update(Packet) ->
|
announce_all_hosts_motd_update(Packet) ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ejabberd_config:get_myhosts(),
|
||||||
[announce_motd_update(Host, Packet) || Host <- Hosts].
|
[announce_motd_update(Host, Packet) || Host <- Hosts].
|
||||||
|
|
||||||
announce_motd_update(LServer, Packet) ->
|
announce_motd_update(LServer, Packet) ->
|
||||||
@ -703,7 +702,7 @@ announce_all_hosts_motd_delete(_Packet) ->
|
|||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
Mod = gen_mod:db_mod(Host, ?MODULE),
|
Mod = gen_mod:db_mod(Host, ?MODULE),
|
||||||
delete_motd(Mod, Host)
|
delete_motd(Mod, Host)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec send_motd({presence(), ejabberd_c2s:state()}) -> {presence(), ejabberd_c2s:state()}.
|
-spec send_motd({presence(), ejabberd_c2s:state()}) -> {presence(), ejabberd_c2s:state()}.
|
||||||
send_motd({_, #{pres_last := _}} = Acc) ->
|
send_motd({_, #{pres_last := _}} = Acc) ->
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
-export([filter_packet/1, filter_offline_msg/1, filter_subscription/2]).
|
-export([filter_packet/1, filter_offline_msg/1, filter_subscription/2]).
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(SETS, gb_sets).
|
-define(SETS, gb_sets).
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
-export([start/2, stop/1, reload/3, process_iq/1, depends/2,
|
-export([start/2, stop/1, reload/3, process_iq/1, depends/2,
|
||||||
disco_features/5, mod_options/1]).
|
disco_features/5, mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
-export([depends/2, mod_opt_type/1, mod_options/1]).
|
-export([depends/2, mod_opt_type/1, mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("bosh.hrl").
|
-include("bosh.hrl").
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
%% API
|
%% API
|
||||||
-export([init/0, open_session/2, close_session/1, find_session/1]).
|
-export([init/0, open_session/2, close_session/1, find_session/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ init() ->
|
|||||||
Node = erlang:atom_to_binary(node(), latin1),
|
Node = erlang:atom_to_binary(node(), latin1),
|
||||||
?DEBUG("Cleaning SQL 'bosh' table...", []),
|
?DEBUG("Cleaning SQL 'bosh' table...", []),
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME, ?SQL("delete from bosh where node=%(Node)s")) of
|
ejabberd_config:get_myname(), ?SQL("delete from bosh where node=%(Node)s")) of
|
||||||
{updated, _} ->
|
{updated, _} ->
|
||||||
ok;
|
ok;
|
||||||
Err ->
|
Err ->
|
||||||
@ -53,7 +52,7 @@ init() ->
|
|||||||
open_session(SID, Pid) ->
|
open_session(SID, Pid) ->
|
||||||
PidS = misc:encode_pid(Pid),
|
PidS = misc:encode_pid(Pid),
|
||||||
Node = erlang:atom_to_binary(node(Pid), latin1),
|
Node = erlang:atom_to_binary(node(Pid), latin1),
|
||||||
case ?SQL_UPSERT(?MYNAME, "bosh",
|
case ?SQL_UPSERT(ejabberd_config:get_myname(), "bosh",
|
||||||
["!sid=%(SID)s",
|
["!sid=%(SID)s",
|
||||||
"node=%(Node)s",
|
"node=%(Node)s",
|
||||||
"pid=%(PidS)s"]) of
|
"pid=%(PidS)s"]) of
|
||||||
@ -65,7 +64,7 @@ open_session(SID, Pid) ->
|
|||||||
|
|
||||||
close_session(SID) ->
|
close_session(SID) ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME, ?SQL("delete from bosh where sid=%(SID)s")) of
|
ejabberd_config:get_myname(), ?SQL("delete from bosh where sid=%(SID)s")) of
|
||||||
{updated, _} ->
|
{updated, _} ->
|
||||||
ok;
|
ok;
|
||||||
_Err ->
|
_Err ->
|
||||||
@ -74,7 +73,7 @@ close_session(SID) ->
|
|||||||
|
|
||||||
find_session(SID) ->
|
find_session(SID) ->
|
||||||
case ejabberd_sql:sql_query(
|
case ejabberd_sql:sql_query(
|
||||||
?MYNAME,
|
ejabberd_config:get_myname(),
|
||||||
?SQL("select @(pid)s, @(node)s from bosh where sid=%(SID)s")) of
|
?SQL("select @(pid)s, @(node)s from bosh where sid=%(SID)s")) of
|
||||||
{selected, [{Pid, Node}]} ->
|
{selected, [{Pid, Node}]} ->
|
||||||
try {ok, misc:decode_pid(Pid, Node)}
|
try {ok, misc:decode_pid(Pid, Node)}
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
-export([user_send_packet/1, user_receive_packet/1,
|
-export([user_send_packet/1, user_receive_packet/1,
|
||||||
c2s_presence_in/2, mod_opt_type/1, mod_options/1]).
|
c2s_presence_in/2, mod_opt_type/1, mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -162,7 +161,7 @@ caps_stream_features(Acc, MyHost) ->
|
|||||||
<<"">> ->
|
<<"">> ->
|
||||||
Acc;
|
Acc;
|
||||||
Hash ->
|
Hash ->
|
||||||
[#caps{hash = <<"sha-1">>, node = ?EJABBERD_URI,
|
[#caps{hash = <<"sha-1">>, node = ejabberd_config:get_uri(),
|
||||||
version = Hash} | Acc]
|
version = Hash} | Acc]
|
||||||
end;
|
end;
|
||||||
false ->
|
false ->
|
||||||
@ -476,9 +475,9 @@ concat_xdata_fields(#xdata{fields = Fields} = X) ->
|
|||||||
-spec is_valid_node(binary()) -> boolean().
|
-spec is_valid_node(binary()) -> boolean().
|
||||||
is_valid_node(Node) ->
|
is_valid_node(Node) ->
|
||||||
case str:tokens(Node, <<"#">>) of
|
case str:tokens(Node, <<"#">>) of
|
||||||
[?EJABBERD_URI|_] ->
|
[H|_] ->
|
||||||
true;
|
H == ejabberd_config:get_uri();
|
||||||
_ ->
|
[] ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
is_carbon_copy/1, mod_opt_type/1, depends/2, clean_cache/1,
|
is_carbon_copy/1, mod_opt_type/1, depends/2, clean_cache/1,
|
||||||
mod_options/1]).
|
mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("mod_carboncopy.hrl").
|
-include("mod_carboncopy.hrl").
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
-export([init/1, handle_cast/2, handle_call/3, handle_info/2,
|
||||||
terminate/2, code_change/3, start_link/0]).
|
terminate/2, code_change/3, start_link/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("mod_carboncopy.hrl").
|
-include("mod_carboncopy.hrl").
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
%% API
|
%% API
|
||||||
-export([init/2, enable/4, disable/3, list/2]).
|
-export([init/2, enable/4, disable/3, list/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_sql_pt.hrl").
|
-include("ejabberd_sql_pt.hrl").
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
c2s_authenticated_packet/2, csi_activity/2,
|
c2s_authenticated_packet/2, csi_activity/2,
|
||||||
c2s_copy_session/2, c2s_session_resumed/1]).
|
c2s_copy_session/2, c2s_session_resumed/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
adhoc_sm_items/4, adhoc_sm_commands/4, mod_options/1,
|
adhoc_sm_items/4, adhoc_sm_commands/4, mod_options/1,
|
||||||
depends/2]).
|
depends/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("ejabberd_sm.hrl").
|
-include("ejabberd_sm.hrl").
|
||||||
@ -753,7 +752,7 @@ get_stopped_nodes(_Lang) ->
|
|||||||
lists:map(
|
lists:map(
|
||||||
fun (N) ->
|
fun (N) ->
|
||||||
S = iolist_to_binary(atom_to_list(N)),
|
S = iolist_to_binary(atom_to_list(N)),
|
||||||
#disco_item{jid = jid:make(?MYNAME),
|
#disco_item{jid = jid:make(ejabberd_config:get_myname()),
|
||||||
node = <<"stopped nodes/", S/binary>>,
|
node = <<"stopped nodes/", S/binary>>,
|
||||||
name = S}
|
name = S}
|
||||||
end,
|
end,
|
||||||
@ -1525,7 +1524,7 @@ set_form(From, Host, ?NS_ADMINL(<<"add-user">>), _Lang,
|
|||||||
AccountJID = jid:decode(AccountString),
|
AccountJID = jid:decode(AccountString),
|
||||||
User = AccountJID#jid.luser,
|
User = AccountJID#jid.luser,
|
||||||
Server = AccountJID#jid.lserver,
|
Server = AccountJID#jid.lserver,
|
||||||
true = lists:member(Server, ?MYHOSTS),
|
true = lists:member(Server, ejabberd_config:get_myhosts()),
|
||||||
true = Server == Host orelse
|
true = Server == Host orelse
|
||||||
get_permission_level(From) == global,
|
get_permission_level(From) == global,
|
||||||
case ejabberd_auth:try_register(User, Server, Password) of
|
case ejabberd_auth:try_register(User, Server, Password) of
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
disco_local_features/5, disco_sm_features/5,
|
disco_local_features/5, disco_sm_features/5,
|
||||||
disco_local_identity/5, disco_sm_identity/5]).
|
disco_local_identity/5, disco_sm_identity/5]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("type_compat.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ component_connected(Host) ->
|
|||||||
fun(ServerHost) ->
|
fun(ServerHost) ->
|
||||||
Proc = gen_mod:get_module_proc(ServerHost, ?MODULE),
|
Proc = gen_mod:get_module_proc(ServerHost, ?MODULE),
|
||||||
gen_server:cast(Proc, {component_connected, Host})
|
gen_server:cast(Proc, {component_connected, Host})
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec component_disconnected(binary(), binary()) -> ok.
|
-spec component_disconnected(binary(), binary()) -> ok.
|
||||||
component_disconnected(Host, _Reason) ->
|
component_disconnected(Host, _Reason) ->
|
||||||
@ -96,7 +96,7 @@ component_disconnected(Host, _Reason) ->
|
|||||||
fun(ServerHost) ->
|
fun(ServerHost) ->
|
||||||
Proc = gen_mod:get_module_proc(ServerHost, ?MODULE),
|
Proc = gen_mod:get_module_proc(ServerHost, ?MODULE),
|
||||||
gen_server:cast(Proc, {component_disconnected, Host})
|
gen_server:cast(Proc, {component_disconnected, Host})
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
-spec ejabberd_local(iq()) -> iq().
|
-spec ejabberd_local(iq()) -> iq().
|
||||||
ejabberd_local(IQ) ->
|
ejabberd_local(IQ) ->
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
get_info/5, transform_module_options/1, mod_opt_type/1,
|
get_info/5, transform_module_options/1, mod_opt_type/1,
|
||||||
mod_options/1, depends/2]).
|
mod_options/1, depends/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("translate.hrl").
|
-include("translate.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
@ -239,7 +238,7 @@ get_vh_services(Host) ->
|
|||||||
Hosts = lists:sort(fun (H1, H2) ->
|
Hosts = lists:sort(fun (H1, H2) ->
|
||||||
byte_size(H1) >= byte_size(H2)
|
byte_size(H1) >= byte_size(H2)
|
||||||
end,
|
end,
|
||||||
?MYHOSTS),
|
ejabberd_config:get_myhosts()),
|
||||||
lists:filter(fun (H) ->
|
lists:filter(fun (H) ->
|
||||||
case lists:dropwhile(fun (VH) ->
|
case lists:dropwhile(fun (VH) ->
|
||||||
not
|
not
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
handle_info/2, terminate/2, code_change/3,
|
handle_info/2, terminate/2, code_change/3,
|
||||||
mod_opt_type/1, depends/2, mod_options/1]).
|
mod_opt_type/1, depends/2, mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
mod_opt_type/1, mod_options/1, depends/2]).
|
mod_opt_type/1, mod_options/1, depends/2]).
|
||||||
|
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
-export([start/2, stop/1, reload/3, process/2, mod_opt_type/1, depends/2,
|
-export([start/2, stop/1, reload/3, process/2, mod_opt_type/1, depends/2,
|
||||||
mod_options/1]).
|
mod_options/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
-export([reopen_log/0, mod_opt_type/1, mod_options/1, depends/2]).
|
-export([reopen_log/0, mod_opt_type/1, mod_options/1, depends/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
-include_lib("kernel/include/file.hrl").
|
-include_lib("kernel/include/file.hrl").
|
||||||
@ -277,7 +276,7 @@ process(LocalPath, #request{host = Host, auth = Auth, headers = RHeaders} = Requ
|
|||||||
"but couldn't find the related "
|
"but couldn't find the related "
|
||||||
"ejabberd virtual host", [Host]),
|
"ejabberd virtual host", [Host]),
|
||||||
{FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN,
|
{FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN,
|
||||||
add_to_log(FileSize1, Code1, Request#request{host = ?MYNAME}),
|
add_to_log(FileSize1, Code1, Request#request{host = ejabberd_config:get_myname()}),
|
||||||
{Code1, Headers1, Contents1}
|
{Code1, Headers1, Contents1}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -383,7 +382,7 @@ reopen_log() ->
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Host) ->
|
fun(Host) ->
|
||||||
gen_server:cast(get_proc_name(Host), reopen_log)
|
gen_server:cast(get_proc_name(Host), reopen_log)
|
||||||
end, ?MYHOSTS).
|
end, ejabberd_config:get_myhosts()).
|
||||||
|
|
||||||
add_to_log(FileSize, Code, Request) ->
|
add_to_log(FileSize, Code, Request) ->
|
||||||
gen_server:cast(get_proc_name(Request#request.host),
|
gen_server:cast(get_proc_name(Request#request.host),
|
||||||
|
@ -89,7 +89,6 @@
|
|||||||
expand_home/1,
|
expand_home/1,
|
||||||
expand_host/2]).
|
expand_host/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
handle_info/2, terminate/2, code_change/3,
|
handle_info/2, terminate/2, code_change/3,
|
||||||
mod_opt_type/1, mod_options/1, depends/2]).
|
mod_opt_type/1, mod_options/1, depends/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
-include("mod_irc.hrl").
|
-include("mod_irc.hrl").
|
||||||
@ -437,10 +436,9 @@ iq_disco(ServerHost, Node, Lang) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
iq_get_vcard(Lang) ->
|
iq_get_vcard(Lang) ->
|
||||||
Desc = translate:translate(Lang, <<"ejabberd IRC module">>),
|
|
||||||
#vcard_temp{fn = <<"ejabberd/mod_irc">>,
|
#vcard_temp{fn = <<"ejabberd/mod_irc">>,
|
||||||
url = ?EJABBERD_URI,
|
url = ejabberd_config:get_uri(),
|
||||||
desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
|
desc = misc:get_descr(Lang, <<"ejabberd IRC module">>)}.
|
||||||
|
|
||||||
command_items(ServerHost, Host, Lang) ->
|
command_items(ServerHost, Host, Lang) ->
|
||||||
lists:map(fun({Node, Name, _Function}) ->
|
lists:map(fun({Node, Name, _Function}) ->
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
handle_sync_event/4, handle_info/3, terminate/3,
|
handle_sync_event/4, handle_info/3, terminate/3,
|
||||||
code_change/4]).
|
code_change/4]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("type_compat.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
@ -645,7 +645,7 @@ terminate(_Reason, _StateName, FullStateData) ->
|
|||||||
{error, SError, SStateData} -> {SError, SStateData};
|
{error, SError, SStateData} -> {SError, SStateData};
|
||||||
_ ->
|
_ ->
|
||||||
{xmpp:err_internal_server_error(
|
{xmpp:err_internal_server_error(
|
||||||
<<"Server Connect Failed">>, ?MYLANG),
|
<<"Server Connect Failed">>, ejabberd_config:get_mylang()),
|
||||||
FullStateData}
|
FullStateData}
|
||||||
end,
|
end,
|
||||||
(StateData#state.mod):closed_connection(StateData#state.host,
|
(StateData#state.mod):closed_connection(StateData#state.host,
|
||||||
@ -804,7 +804,7 @@ error_nick_in_use(_StateData, String) ->
|
|||||||
Msg = ejabberd_regexp:replace(String,
|
Msg = ejabberd_regexp:replace(String,
|
||||||
<<".*433 +[^ ]* +">>, <<"">>),
|
<<".*433 +[^ ]* +">>, <<"">>),
|
||||||
Msg1 = filter_message(Msg),
|
Msg1 = filter_message(Msg),
|
||||||
xmpp:err_conflict(Msg1, ?MYLANG).
|
xmpp:err_conflict(Msg1, ejabberd_config:get_mylang()).
|
||||||
|
|
||||||
process_nick_in_use(StateData, String) ->
|
process_nick_in_use(StateData, String) ->
|
||||||
Error = error_nick_in_use(StateData, String),
|
Error = error_nick_in_use(StateData, String),
|
||||||
@ -950,7 +950,7 @@ process_version(StateData, _Nick, From) ->
|
|||||||
send_text(StateData,
|
send_text(StateData,
|
||||||
io_lib:format("NOTICE ~s :\001VERSION ejabberd IRC "
|
io_lib:format("NOTICE ~s :\001VERSION ejabberd IRC "
|
||||||
"transport ~s (c) Alexey Shchepin\001\r\n",
|
"transport ~s (c) Alexey Shchepin\001\r\n",
|
||||||
[FromUser, ?VERSION])
|
[FromUser, ejabberd_config:get_version()])
|
||||||
++
|
++
|
||||||
io_lib:format("NOTICE ~s :\001VERSION http://ejabberd.jabber"
|
io_lib:format("NOTICE ~s :\001VERSION http://ejabberd.jabber"
|
||||||
"studio.org/\001\r\n",
|
"studio.org/\001\r\n",
|
||||||
@ -1128,14 +1128,14 @@ process_error(StateData, String) ->
|
|||||||
StateData#state.nick),
|
StateData#state.nick),
|
||||||
to = StateData#state.user,
|
to = StateData#state.user,
|
||||||
type = error,
|
type = error,
|
||||||
sub_els = [xmpp:err_internal_server_error(String, ?MYLANG)]})
|
sub_els = [xmpp:err_internal_server_error(String, ejabberd_config:get_mylang())]})
|
||||||
end, dict:fetch_keys(StateData#state.channels)).
|
end, dict:fetch_keys(StateData#state.channels)).
|
||||||
|
|
||||||
error_unknown_num(_StateData, String, Type) ->
|
error_unknown_num(_StateData, String, Type) ->
|
||||||
Msg = ejabberd_regexp:replace(String,
|
Msg = ejabberd_regexp:replace(String,
|
||||||
<<".*[45][0-9][0-9] +[^ ]* +">>, <<"">>),
|
<<".*[45][0-9][0-9] +[^ ]* +">>, <<"">>),
|
||||||
Msg1 = filter_message(Msg),
|
Msg1 = filter_message(Msg),
|
||||||
xmpp:err_undefined_condition(Type, Msg1, ?MYLANG).
|
xmpp:err_undefined_condition(Type, Msg1, ejabberd_config:get_mylang()).
|
||||||
|
|
||||||
remove_element(E, Set) ->
|
remove_element(E, Set) ->
|
||||||
case (?SETS):is_element(E, Set) of
|
case (?SETS):is_element(E, Set) of
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
remove_user/2, mod_opt_type/1, mod_options/1,
|
remove_user/2, mod_opt_type/1, mod_options/1,
|
||||||
register_user/2, depends/2, privacy_check_packet/4]).
|
register_user/2, depends/2, privacy_check_packet/4]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
@ -520,7 +520,7 @@ delete_old_messages(TypeBin, Days) when TypeBin == <<"chat">>;
|
|||||||
sql -> {sql, Host};
|
sql -> {sql, Host};
|
||||||
Other -> {Other, global}
|
Other -> {Other, global}
|
||||||
end
|
end
|
||||||
end, ?MYHOSTS)),
|
end, ejabberd_config:get_myhosts())),
|
||||||
Results = lists:map(
|
Results = lists:map(
|
||||||
fun({DBType, ServerHost}) ->
|
fun({DBType, ServerHost}) ->
|
||||||
Mod = gen_mod:db_mod(DBType, ?MODULE),
|
Mod = gen_mod:db_mod(DBType, ?MODULE),
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
-include("xmpp.hrl").
|
-include("xmpp.hrl").
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user