diff options
Diffstat (limited to 'src')
213 files changed, 1088 insertions, 399 deletions
diff --git a/src/acl.erl b/src/acl.erl index 5db79eba9..7e03298ba 100644 --- a/src/acl.erl +++ b/src/acl.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/econf.erl b/src/econf.erl index cb8cb8506..1a8711b48 100644 --- a/src/econf.erl +++ b/src/econf.erl @@ -3,7 +3,7 @@ %%% Purpose : Validator for ejabberd configuration options %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd.app.src.script b/src/ejabberd.app.src.script index 67a7a470d..a657b640b 100644 --- a/src/ejabberd.app.src.script +++ b/src/ejabberd.app.src.script @@ -16,13 +16,12 @@ Vars = case file:consult(filename:join([filename:dirname(SCRIPT), "..", "vars.co {registered, []}, {applications, [kernel, sasl, ssl, stdlib]}, {included_applications, - [inets, mnesia, os_mon, + [compiler, inets, mnesia, os_mon, cache_tab, eimp, fast_tls, fast_xml, fast_yaml, - lager, p1_acme, p1_utils, pkix, diff --git a/src/ejabberd.erl b/src/ejabberd.erl index 112654741..d39af1400 100644 --- a/src/ejabberd.erl +++ b/src/ejabberd.erl @@ -5,7 +5,7 @@ %%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_access_permissions.erl b/src/ejabberd_access_permissions.erl index 916475df9..6c4cc2ca7 100644 --- a/src/ejabberd_access_permissions.erl +++ b/src/ejabberd_access_permissions.erl @@ -5,7 +5,7 @@ %%% Created : 7 Sep 2016 by Paweł Chmielowski <pawel@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_acme.erl b/src/ejabberd_acme.erl index 93ce3c815..c67b7a0d7 100644 --- a/src/ejabberd_acme.erl +++ b/src/ejabberd_acme.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl index 9e72c7b36..c79572f16 100644 --- a/src/ejabberd_admin.erl +++ b/src/ejabberd_admin.erl @@ -5,7 +5,7 @@ %%% Created : 7 May 2006 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -30,7 +30,8 @@ -export([start_link/0, %% Server - status/0, reopen_log/0, rotate_log/0, + status/0, stop/0, restart/0, + reopen_log/0, rotate_log/0, set_loglevel/1, stop_kindly/2, send_service_message_all_mucs/2, registered_vhosts/0, @@ -40,7 +41,7 @@ %% Cluster join_cluster/1, leave_cluster/1, list_cluster/0, %% Erlang - update_list/0, update/1, + update_list/0, update/1, update/0, %% Accounts register/3, unregister/2, registered_users/1, @@ -113,11 +114,11 @@ get_commands_spec() -> args = [], result = {res, restuple}}, #ejabberd_commands{name = stop, tags = [server], desc = "Stop ejabberd gracefully", - module = init, function = stop, + module = ?MODULE, function = stop, args = [], result = {res, rescode}}, #ejabberd_commands{name = restart, tags = [server], desc = "Restart ejabberd gracefully", - module = init, function = restart, + module = ?MODULE, function = restart, args = [], result = {res, rescode}}, #ejabberd_commands{name = reopen_log, tags = [logs], desc = "Reopen the log files after being renamed", @@ -446,6 +447,16 @@ status() -> end, {Is_running, String1 ++ String2}. +stop() -> + _ = supervisor:terminate_child(ejabberd_sup, ejabberd_sm), + timer:sleep(1000), + init:stop(). + +restart() -> + _ = supervisor:terminate_child(ejabberd_sup, ejabberd_sm), + timer:sleep(1000), + init:restart(). + reopen_log() -> ejabberd_hooks:run(reopen_log_hook, []). @@ -540,6 +551,15 @@ update_module(ModuleNameString) -> {error, Reason} -> {error, Reason} end. +update() -> + io:format("Compiling ejabberd...~n", []), + os:cmd("make"), + Mods = ejabberd_admin:update_list(), + io:format("Updating modules: ~p~n", [Mods]), + ejabberd_admin:update("all"), + io:format("Updated modules: ", []), + Mods -- ejabberd_admin:update_list(). + %%% %%% Account management %%% diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index 161f1dab1..45e92d064 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -5,7 +5,7 @@ %%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl index 35e4921b7..c64c508d9 100644 --- a/src/ejabberd_auth.erl +++ b/src/ejabberd_auth.erl @@ -5,7 +5,7 @@ %%% Created : 23 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_anonymous.erl b/src/ejabberd_auth_anonymous.erl index dd7ff28eb..bfe4e0cac 100644 --- a/src/ejabberd_auth_anonymous.erl +++ b/src/ejabberd_auth_anonymous.erl @@ -5,7 +5,7 @@ %%% Created : 17 Feb 2006 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_external.erl b/src/ejabberd_auth_external.erl index a513c24ba..a5320b7bc 100644 --- a/src/ejabberd_auth_external.erl +++ b/src/ejabberd_auth_external.erl @@ -5,7 +5,7 @@ %%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_jwt.erl b/src/ejabberd_auth_jwt.erl index 6df742305..f38600bc7 100644 --- a/src/ejabberd_auth_jwt.erl +++ b/src/ejabberd_auth_jwt.erl @@ -5,7 +5,7 @@ %%% Created : 16 Mar 2019 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -85,7 +85,14 @@ check_password(User, AuthzId, Server, Token) -> end end. -user_exists(_User, _Host) -> {nocache, false}. +user_exists(User, Host) -> + %% Checking that the user has an active session + %% If the session was negociated by the JWT auth method then we define that the user exists + %% Any other cases will return that the user doesn't exist + {nocache, case ejabberd_sm:get_user_info(User, Host) of + [{_, Info}] -> proplists:get_value(auth_module, Info) == ejabberd_auth_jwt; + _ -> false + end}. use_cache(_) -> false. diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl index 7f5bd87c8..1c3143241 100644 --- a/src/ejabberd_auth_ldap.erl +++ b/src/ejabberd_auth_ldap.erl @@ -5,7 +5,7 @@ %%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_mnesia.erl b/src/ejabberd_auth_mnesia.erl index 168ee76f5..bb1aa92bf 100644 --- a/src/ejabberd_auth_mnesia.erl +++ b/src/ejabberd_auth_mnesia.erl @@ -5,7 +5,7 @@ %%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_pam.erl b/src/ejabberd_auth_pam.erl index e3b0eba6e..aa48a1931 100644 --- a/src/ejabberd_auth_pam.erl +++ b/src/ejabberd_auth_pam.erl @@ -5,7 +5,7 @@ %%% Created : 5 Jul 2007 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_auth_sql.erl b/src/ejabberd_auth_sql.erl index 50cc1902e..ca7fd0889 100644 --- a/src/ejabberd_auth_sql.erl +++ b/src/ejabberd_auth_sql.erl @@ -5,7 +5,7 @@ %%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_backend_sup.erl b/src/ejabberd_backend_sup.erl index c80dd8685..575e66e40 100644 --- a/src/ejabberd_backend_sup.erl +++ b/src/ejabberd_backend_sup.erl @@ -2,7 +2,7 @@ %%% Created : 24 Feb 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_bosh.erl b/src/ejabberd_bosh.erl index e9d2f0c0a..3bcf4f6f6 100644 --- a/src/ejabberd_bosh.erl +++ b/src/ejabberd_bosh.erl @@ -5,7 +5,7 @@ %%% Created : 20 Jul 2011 by Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 3218cce51..6f1038947 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -2,7 +2,7 @@ %%% Created : 8 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -285,12 +285,14 @@ process_closed(State, Reason) -> stop_async(self()), State#{stop_reason => Reason}. -process_terminated(#{sid := SID, socket := Socket, - jid := JID, user := U, server := S, resource := R} = State, +process_terminated(#{sid := SID, jid := JID, user := U, server := S, resource := R} = State, Reason) -> Status = format_reason(State, Reason), ?INFO_MSG("(~ts) Closing c2s session for ~ts: ~ts", - [xmpp_socket:pp(Socket), jid:encode(JID), Status]), + [case maps:find(socket, State) of + {ok, Socket} -> xmpp_socket:pp(Socket); + _ -> <<"unknown">> + end, jid:encode(JID), Status]), Pres = #presence{type = unavailable, from = JID, to = jid:remove_resource(JID)}, @@ -305,10 +307,12 @@ process_terminated(#{sid := SID, socket := Socket, end, bounce_message_queue(SID, JID), State1; -process_terminated(#{socket := Socket, - stop_reason := {tls, _}} = State, Reason) -> +process_terminated(#{stop_reason := {tls, _}} = State, Reason) -> ?WARNING_MSG("(~ts) Failed to secure c2s connection: ~ts", - [xmpp_socket:pp(Socket), format_reason(State, Reason)]), + [case maps:find(socket, State) of + {ok, Socket} -> xmpp_socket:pp(Socket); + _ -> <<"unknown">> + end, format_reason(State, Reason)]), State; process_terminated(State, _Reason) -> State. diff --git a/src/ejabberd_c2s_config.erl b/src/ejabberd_c2s_config.erl index b6c57ef98..4100ae23c 100644 --- a/src/ejabberd_c2s_config.erl +++ b/src/ejabberd_c2s_config.erl @@ -6,7 +6,7 @@ %%% Created : 2 Nov 2007 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index 343a8e54e..69b14915f 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -5,7 +5,7 @@ %%% Created : 26 Apr 2008 by Evgeniy Khramtsov <xramtsov@gmail.com> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_cluster.erl b/src/ejabberd_cluster.erl index f9f233da8..0a5364beb 100644 --- a/src/ejabberd_cluster.erl +++ b/src/ejabberd_cluster.erl @@ -3,7 +3,7 @@ %%% Created : 5 Jul 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_cluster_mnesia.erl b/src/ejabberd_cluster_mnesia.erl index 313cf9257..81bf010d7 100644 --- a/src/ejabberd_cluster_mnesia.erl +++ b/src/ejabberd_cluster_mnesia.erl @@ -5,7 +5,7 @@ %%% Created : 7 Oct 2015 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index ddf0d3c59..5371f4da4 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -5,7 +5,7 @@ %%% Created : 20 May 2008 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_commands_doc.erl b/src/ejabberd_commands_doc.erl index eec334d04..0fe5f6402 100644 --- a/src/ejabberd_commands_doc.erl +++ b/src/ejabberd_commands_doc.erl @@ -5,7 +5,7 @@ %%% Created : 20 May 2008 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index ec3d2cf8c..c5d8c4494 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -5,7 +5,7 @@ %%% Created : 14 Dec 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_config_transformer.erl b/src/ejabberd_config_transformer.erl index 053a59c21..c41220ab3 100644 --- a/src/ejabberd_config_transformer.erl +++ b/src/ejabberd_config_transformer.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index 77595cd54..057cff66c 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -5,7 +5,7 @@ %%% Created : 11 Jan 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -141,15 +141,6 @@ process(["status"], _Version) -> ?STATUS_SUCCESS end; -process(["stop"], _Version) -> - %%ejabberd_cover:stop(), - init:stop(), - ?STATUS_SUCCESS; - -process(["restart"], _Version) -> - init:restart(), - ?STATUS_SUCCESS; - %% TODO: Mnesia operations should not be hardcoded in ejabberd_ctl module. %% For now, I leave them there to avoid breaking those commands for people that %% may be using it (as format of response is going to change). diff --git a/src/ejabberd_db_sup.erl b/src/ejabberd_db_sup.erl index 248325cf1..1701779ec 100644 --- a/src/ejabberd_db_sup.erl +++ b/src/ejabberd_db_sup.erl @@ -2,7 +2,7 @@ %%% Created : 13 June 2019 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_doc.erl b/src/ejabberd_doc.erl index 77f9fab48..c603a5f9a 100644 --- a/src/ejabberd_doc.erl +++ b/src/ejabberd_doc.erl @@ -2,7 +2,7 @@ %%% File : ejabberd_doc.erl %%% Purpose : Options documentation generator %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -231,9 +231,9 @@ man_header(Lang) -> "indentation, or otherwise you will get pretty cryptic " "configuration errors.")), io_lib:nl(), - tr(Lang, ?T("Logically, configuration options are splitted into 3 main categories: " + tr(Lang, ?T("Logically, configuration options are split into 3 main categories: " "'Modules', 'Listeners' and everything else called 'Top Level' options. " - "Thus this document is splitted into 3 main chapters describing each " + "Thus this document is split into 3 main chapters describing each " "category separately. So, the contents of ejabberd.yml will typically " "look like this:")), io_lib:nl(), diff --git a/src/ejabberd_hooks.erl b/src/ejabberd_hooks.erl index 11cd20f9a..1b3c27cf6 100644 --- a/src/ejabberd_hooks.erl +++ b/src/ejabberd_hooks.erl @@ -5,7 +5,7 @@ %%% Created : 8 Aug 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index d577a10d5..56de7e255 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -5,7 +5,7 @@ %%% Created : 27 Feb 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_http_ws.erl b/src/ejabberd_http_ws.erl index eb2100a42..fec53c210 100644 --- a/src/ejabberd_http_ws.erl +++ b/src/ejabberd_http_ws.erl @@ -5,7 +5,7 @@ %%% Created : 09-10-2010 by Eric Cestari <ecestari@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_iq.erl b/src/ejabberd_iq.erl index 249c53294..be25dcb9d 100644 --- a/src/ejabberd_iq.erl +++ b/src/ejabberd_iq.erl @@ -5,7 +5,7 @@ %%% Created : 10 Nov 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index 93fd2e0fd..9c962be6e 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -5,7 +5,7 @@ %%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl index 6dfef9d01..4a12b18f9 100644 --- a/src/ejabberd_local.erl +++ b/src/ejabberd_local.erl @@ -5,7 +5,7 @@ %%% Created : 30 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index 05e197b3e..217b232fa 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -5,7 +5,7 @@ %%% Created : 12 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2013-2021 ProcessOne +%%% ejabberd, Copyright (C) 2013-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_mnesia.erl b/src/ejabberd_mnesia.erl index 3818a1515..70dfe3e6e 100644 --- a/src/ejabberd_mnesia.erl +++ b/src/ejabberd_mnesia.erl @@ -5,7 +5,7 @@ %%% Created : 17 Nov 2016 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_oauth.erl b/src/ejabberd_oauth.erl index 9b2c517de..1d26798b0 100644 --- a/src/ejabberd_oauth.erl +++ b/src/ejabberd_oauth.erl @@ -5,7 +5,7 @@ %%% Created : 20 Mar 2015 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_oauth_mnesia.erl b/src/ejabberd_oauth_mnesia.erl index de22f94a6..8bb2efba7 100644 --- a/src/ejabberd_oauth_mnesia.erl +++ b/src/ejabberd_oauth_mnesia.erl @@ -5,7 +5,7 @@ %%% Created : 20 Jul 2016 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_oauth_rest.erl b/src/ejabberd_oauth_rest.erl index b968c9263..9182ec256 100644 --- a/src/ejabberd_oauth_rest.erl +++ b/src/ejabberd_oauth_rest.erl @@ -5,7 +5,7 @@ %%% Created : 26 Jul 2016 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_oauth_sql.erl b/src/ejabberd_oauth_sql.erl index 25be737f0..89dcc590c 100644 --- a/src/ejabberd_oauth_sql.erl +++ b/src/ejabberd_oauth_sql.erl @@ -5,7 +5,7 @@ %%% Created : 27 Jul 2016 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_old_config.erl b/src/ejabberd_old_config.erl index 991677133..47812d894 100644 --- a/src/ejabberd_old_config.erl +++ b/src/ejabberd_old_config.erl @@ -1,7 +1,7 @@ %%%---------------------------------------------------------------------- %%% Purpose: Transform old-style Erlang config to YAML config %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl index 77b76799f..8837ef475 100644 --- a/src/ejabberd_options.erl +++ b/src/ejabberd_options.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -141,7 +141,7 @@ opt_type(domain_balancing) -> #{component_number => econf:int(2, 1000), type => econf:enum([random, source, destination, bare_source, bare_destination])}, - [{required, [component_number]}, {return, map}, unique]), + [{return, map}, unique]), [{return, map}]); opt_type(ext_api_path_oauth) -> econf:binary(); diff --git a/src/ejabberd_options_doc.erl b/src/ejabberd_options_doc.erl index a725f4572..9d4cea829 100644 --- a/src/ejabberd_options_doc.erl +++ b/src/ejabberd_options_doc.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -220,7 +220,9 @@ doc() -> {access_rules, #{value => "{AccessName: {allow|deny: ACLRules|ACLName}}", desc => - ?T("The option specifies access rules. Each access rule is " + ?T("This option defines " + "http://../basic/#access-rules[Access Rules]. " + "Each access rule is " "assigned a name that can be referenced from other parts " "of the configuration file (mostly from 'access' options of " "ejabberd modules). Each rule definition may contain " @@ -387,7 +389,7 @@ doc() -> {auth_scram_hash, #{value => "sha | sha256 | sha512", desc => - ?T("Hash algorith that should be used to store password in SCRAM format. " + ?T("Hash algorithm that should be used to store password in SCRAM format. " "You shouldn't change this if you already have passwords generated with " "a different algorithm - users that have such passwords will not be able " "to authenticate. The default value is 'sha'.")}}, @@ -449,7 +451,7 @@ doc() -> desc => [?T("Path to a file of CA root certificates. " "The default is to use system defined file if possible."), "", - ?T("For server conections, this 'ca_file' option is overriden by the http://../toplevel/#s2s-cafile[s2s_cafile] option."), "" + ?T("For server connections, this 'ca_file' option is overridden by the http://../toplevel/#s2s-cafile[s2s_cafile] option."), "" ]}}, {captcha_cmd, #{value => ?T("Path"), @@ -1083,9 +1085,10 @@ doc() -> {s2s_access, #{value => ?T("Access"), desc => - ?T("The access rule to restrict server-to-server connections. " - "The default value is 'all' which means no restrictions " - "are applied.")}}, + ?T("This http://../basic/#access-rules[Access Rule] defines to " + "what remote servers can s2s connections be established. " + "The default value is 'all'; no restrictions are applied, it is" + " allowed to connect s2s to/from all remote servers.")}}, {s2s_cafile, #{value => ?T("Path"), desc => @@ -1373,14 +1376,14 @@ doc() -> "protect against connections from other domains than given " "in the configuration file. In this way, the lower layer load " "balancer can be chosen for a specific ejabberd implementation " - "while still providing a secure Websocket connection. " + "while still providing a secure WebSocket connection. " "The default value is 'ignore'. An example value of the 'URL' is " "\"https://test.example.org:8081\".")}}, {websocket_ping_interval, #{value => "timeout()", desc => ?T("Defines time between pings sent by the server to a client " - "(Websocket level protocol pings are used for this) to keep " + "(WebSocket level protocol pings are used for this) to keep " "a connection active. If the client doesn't respond to two " "consecutive pings, the connection will be assumed as closed. " "The value of '0' can be used to disable the feature. This option " diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index d62efb300..add52770d 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -5,7 +5,7 @@ %%% Created : 17 Jul 2008 by Pablo Polvorin <pablo.polvorin@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -166,6 +166,7 @@ export_user(User, Server, Fd) -> LServer = jid:nameprep(Server), {PassPlain, PassScram} = case ejabberd_auth:password_format(LServer) of scram -> {[], [format_scram_password(Password)]}; + _ when Password == <<"">> -> {[], []}; _ -> {[{<<"password">>, Password}], []} end, Els = diff --git a/src/ejabberd_pkix.erl b/src/ejabberd_pkix.erl index 7ccb92cce..c5a945588 100644 --- a/src/ejabberd_pkix.erl +++ b/src/ejabberd_pkix.erl @@ -3,7 +3,7 @@ %%% Created : 4 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_redis.erl b/src/ejabberd_redis.erl index 640a75be1..597c57cfb 100644 --- a/src/ejabberd_redis.erl +++ b/src/ejabberd_redis.erl @@ -4,7 +4,7 @@ %%% Created : 8 May 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_redis_sup.erl b/src/ejabberd_redis_sup.erl index cfc400a7a..6906ef937 100644 --- a/src/ejabberd_redis_sup.erl +++ b/src/ejabberd_redis_sup.erl @@ -3,7 +3,7 @@ %%% Created : 6 Apr 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_regexp.erl b/src/ejabberd_regexp.erl index ef967893e..5841dd4da 100644 --- a/src/ejabberd_regexp.erl +++ b/src/ejabberd_regexp.erl @@ -5,7 +5,7 @@ %%% Created : 8 Dec 2011 by Badlop %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl index 492beb6d3..7be9475ec 100644 --- a/src/ejabberd_router.erl +++ b/src/ejabberd_router.erl @@ -5,7 +5,7 @@ %%% Created : 27 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_router_mnesia.erl b/src/ejabberd_router_mnesia.erl index b4144a97d..53adca533 100644 --- a/src/ejabberd_router_mnesia.erl +++ b/src/ejabberd_router_mnesia.erl @@ -2,7 +2,7 @@ %%% Created : 11 Jan 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_router_multicast.erl b/src/ejabberd_router_multicast.erl index e97ccb837..f3aba8407 100644 --- a/src/ejabberd_router_multicast.erl +++ b/src/ejabberd_router_multicast.erl @@ -5,7 +5,7 @@ %%% Created : 11 Aug 2007 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_router_redis.erl b/src/ejabberd_router_redis.erl index 8d75081b3..450aa4b6b 100644 --- a/src/ejabberd_router_redis.erl +++ b/src/ejabberd_router_redis.erl @@ -3,7 +3,7 @@ %%% Created : 28 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_router_sql.erl b/src/ejabberd_router_sql.erl index 54f7bdfed..07a3c27f8 100644 --- a/src/ejabberd_router_sql.erl +++ b/src/ejabberd_router_sql.erl @@ -3,7 +3,7 @@ %%% Created : 28 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl index 04490071c..9b40ad717 100644 --- a/src/ejabberd_s2s.erl +++ b/src/ejabberd_s2s.erl @@ -5,7 +5,7 @@ %%% Created : 7 Dec 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -387,7 +387,7 @@ start_connection(From, To, Opts) -> MaxS2SConnectionsNumber, MaxS2SConnectionsNumberPerNode, Opts); true -> - %% We choose a connexion from the pool of opened ones. + %% We choose a connection from the pool of opened ones. {ok, choose_connection(From, L)} end end. diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl index 8177a7333..b3ff0c2b4 100644 --- a/src/ejabberd_s2s_in.erl +++ b/src/ejabberd_s2s_in.erl @@ -2,7 +2,7 @@ %%% Created : 12 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl index f057705ed..f7998240c 100644 --- a/src/ejabberd_s2s_out.erl +++ b/src/ejabberd_s2s_out.erl @@ -2,7 +2,7 @@ %%% Created : 16 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_service.erl b/src/ejabberd_service.erl index b854bcb2b..5e386ed7d 100644 --- a/src/ejabberd_service.erl +++ b/src/ejabberd_service.erl @@ -2,7 +2,7 @@ %%% Created : 11 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_shaper.erl b/src/ejabberd_shaper.erl index d4a883baf..4bd5229fa 100644 --- a/src/ejabberd_shaper.erl +++ b/src/ejabberd_shaper.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sip.erl b/src/ejabberd_sip.erl index 62b9c0333..a85b139e0 100644 --- a/src/ejabberd_sip.erl +++ b/src/ejabberd_sip.erl @@ -5,7 +5,7 @@ %%% Created : 30 Apr 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2013-2021 ProcessOne +%%% ejabberd, Copyright (C) 2013-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index afb95c10b..231e4351e 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -5,7 +5,7 @@ %%% Created : 24 Nov 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sm_mnesia.erl b/src/ejabberd_sm_mnesia.erl index 396e1c6d6..ec321271b 100644 --- a/src/ejabberd_sm_mnesia.erl +++ b/src/ejabberd_sm_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 9 Mar 2015 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sm_redis.erl b/src/ejabberd_sm_redis.erl index a436aa923..5f612b926 100644 --- a/src/ejabberd_sm_redis.erl +++ b/src/ejabberd_sm_redis.erl @@ -4,7 +4,7 @@ %%% Created : 11 Mar 2015 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sm_sql.erl b/src/ejabberd_sm_sql.erl index 9c90b75c4..b58b66f0d 100644 --- a/src/ejabberd_sm_sql.erl +++ b/src/ejabberd_sm_sql.erl @@ -4,7 +4,7 @@ %%% Created : 9 Mar 2015 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sql.erl b/src/ejabberd_sql.erl index afca5b183..d68d1a8e1 100644 --- a/src/ejabberd_sql.erl +++ b/src/ejabberd_sql.erl @@ -5,7 +5,7 @@ %%% Created : 8 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sql_pt.erl b/src/ejabberd_sql_pt.erl index d131570f7..6c0a2a55f 100644 --- a/src/ejabberd_sql_pt.erl +++ b/src/ejabberd_sql_pt.erl @@ -5,7 +5,7 @@ %%% Created : 20 Jan 2016 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -41,6 +41,7 @@ server_host_used = false, used_vars = [], use_new_schema, + need_timestamp_pass = false, need_array_pass = false}). -define(QUERY_RECORD, "sql_query"). @@ -50,12 +51,6 @@ -define(MOD, sql__module_). --ifdef(NEW_SQL_SCHEMA). --define(USE_NEW_SCHEMA, true). --else. --define(USE_NEW_SCHEMA, false). --endif. - %%==================================================================== %% API %%==================================================================== @@ -175,17 +170,24 @@ transform_sql(Arg) -> Pos, no_server_host), [] end, - case ParseRes#state.need_array_pass of - true -> + case {ParseRes#state.need_array_pass, ParseRes#state.need_timestamp_pass} of + {true, _} -> {PR1, PR2} = perform_array_pass(ParseRes), {PRO1, PRO2} = perform_array_pass(ParseResOld), set_pos(make_schema_check( - erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(PR2)]), + erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(PR2, pgsql)]), erl_syntax:tuple([erl_syntax:atom(any), make_sql_query(PR1)])]), - erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(PRO2)]), + erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(PRO2, pgsql)]), erl_syntax:tuple([erl_syntax:atom(any), make_sql_query(PRO1)])])), Pos); - false -> + {_, true} -> + set_pos(make_schema_check( + erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(ParseRes, pgsql)]), + erl_syntax:tuple([erl_syntax:atom(any), make_sql_query(ParseRes)])]), + erl_syntax:list([erl_syntax:tuple([erl_syntax:atom(pgsql), make_sql_query(ParseResOld, pgsql)]), + erl_syntax:tuple([erl_syntax:atom(any), make_sql_query(ParseResOld)])])), + Pos); + _ -> set_pos( make_schema_check( make_sql_query(ParseRes), @@ -271,6 +273,8 @@ parse1([$@, $( | S], Acc, State) -> [EVar]); string -> EVar; + timestamp -> + EVar; boolean -> erl_syntax:application( erl_syntax:atom(ejabberd_sql), @@ -301,7 +305,7 @@ parse1([$%, $( | S], Acc, State) -> erl_syntax:atom(?ESCAPE_RECORD), erl_syntax:atom(string)), [erl_syntax:variable(Name)]), - State3#state{'query' = [{var, Var}, + State3#state{'query' = [{var, Var, Type}, {str, "server_host="} | State3#state.'query'], args = [Convert | State3#state.args], @@ -333,21 +337,26 @@ parse1([$%, $( | S], Acc, State) -> erl_syntax:atom(?ESCAPE_RECORD), erl_syntax:atom(IT2)), erl_syntax:variable(Name)]), - State2#state{'query' = [[{var, Var}] | State2#state.'query'], + State2#state{'query' = [[{var, Var, Type}] | State2#state.'query'], need_array_pass = true, args = [[Convert, ConvertArr] | State2#state.args], params = [Var | State2#state.params], param_pos = State2#state.param_pos + 1, used_vars = [Name | State2#state.used_vars]}; _ -> + {TS, Type2} = case Type of + timestamp -> {true, string}; + Other -> {State2#state.need_timestamp_pass, Other} + end, Convert = erl_syntax:application( erl_syntax:record_access( erl_syntax:variable(?ESCAPE_VAR), erl_syntax:atom(?ESCAPE_RECORD), - erl_syntax:atom(Type)), + erl_syntax:atom(Type2)), [erl_syntax:variable(Name)]), - State2#state{'query' = [{var, Var} | State2#state.'query'], + State2#state{'query' = [{var, Var, Type} | State2#state.'query'], + need_timestamp_pass = TS, args = [Convert | State2#state.args], params = [Var | State2#state.params], param_pos = State2#state.param_pos + 1, @@ -365,7 +374,7 @@ parse1("%ESCAPE" ++ S, Acc, State) -> []), Var = State1#state.param_pos, State2 = - State1#state{'query' = [{var, Var} | State1#state.'query'], + State1#state{'query' = [{var, Var, string} | State1#state.'query'], args = [Convert | State1#state.args], params = [Var | State1#state.params], param_pos = State1#state.param_pos + 1}, @@ -403,6 +412,7 @@ parse_name([$), T | S], Acc, 0, IsArg, State) -> $d -> integer; $s -> string; $b -> boolean; + $t -> timestamp; $H when IsArg -> host; _ -> throw({error, State#state.loc, @@ -426,10 +436,10 @@ make_var(V) -> perform_array_pass(State) -> {NQ, PQ, Rest} = lists:foldl( - fun([{var, _} = Var], {N, P, {str, Str} = Prev}) -> + fun([{var, _, _} = Var], {N, P, {str, Str} = Prev}) -> Str2 = re:replace(Str, "(^|\s+)in\s*$", " = any(", [{return, list}]), {[Var, Prev | N], [{str, ")"}, Var, {str, Str2} | P], none}; - ([{var, _}], _) -> + ([{var, _, _}], _) -> throw({error, State#state.loc, ["List variable not following 'in' operator"]}); (Other, {N, P, none}) -> {N, P, Other}; @@ -451,16 +461,27 @@ perform_array_pass(State) -> State#state{query = lists:reverse(PQ2), args = lists:reverse(PA), need_array_pass = false}}. make_sql_query(State) -> + make_sql_query(State, unknown). + +make_sql_query(State, Type) -> Hash = erlang:phash2(State#state{loc = undefined, use_new_schema = true}), SHash = <<"Q", (integer_to_binary(Hash))/binary>>, Query = pack_query(State#state.'query'), EQuery = - lists:map( + lists:flatmap( fun({str, S}) -> - erl_syntax:binary( + [erl_syntax:binary( [erl_syntax:binary_field( - erl_syntax:string(S))]); - ({var, V}) -> make_var(V) + erl_syntax:string(S))])]; + ({var, V, timestamp}) when Type == pgsql -> + [erl_syntax:binary( + [erl_syntax:binary_field( + erl_syntax:string("to_timestamp("))]), + make_var(V), + erl_syntax:binary( + [erl_syntax:binary_field( + erl_syntax:string(", 'YYYY-MM-DD HH24:MI:SS')"))])]; + ({var, V, _}) -> [make_var(V)] end, Query), erl_syntax:record_expr( erl_syntax:atom(?QUERY_RECORD), @@ -715,7 +736,7 @@ make_sql_upsert_pgsql901(Table, ParseRes0) -> #state{'query' = [{str, " RETURNING *) "}]}, Insert ]), - Upsert = make_sql_query(State), + Upsert = make_sql_query(State, pgsql), erl_syntax:application( erl_syntax:atom(ejabberd_sql), erl_syntax:atom(sql_query_t), @@ -766,7 +787,7 @@ make_sql_upsert_pgsql905(Table, ParseRes0) -> #state{'query' = [{str, ") DO UPDATE SET "}]}, Set ]), - Upsert = make_sql_query(State), + Upsert = make_sql_query(State, pgsql), erl_syntax:application( erl_syntax:atom(ejabberd_sql), erl_syntax:atom(sql_query_t), @@ -890,12 +911,12 @@ resolve_vars(ST1, ST2) -> end, ST1#state.params), NewQuery = lists:map( - fun({var, Var}) -> + fun({var, Var, Type}) -> case dict:find(Var, Map) of {ok, New} -> - {var, New}; + {var, New, Type}; error -> - {var, Var} + {var, Var, Type} end; (S) -> S end, ST1#state.'query'), diff --git a/src/ejabberd_sql_sup.erl b/src/ejabberd_sql_sup.erl index d4af0244b..659189c33 100644 --- a/src/ejabberd_sql_sup.erl +++ b/src/ejabberd_sql_sup.erl @@ -5,7 +5,7 @@ %%% Created : 22 Dec 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_stun.erl b/src/ejabberd_stun.erl index 118af6eac..b41baca12 100644 --- a/src/ejabberd_stun.erl +++ b/src/ejabberd_stun.erl @@ -5,7 +5,7 @@ %%% Created : 8 May 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2013-2021 ProcessOne +%%% ejabberd, Copyright (C) 2013-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_sup.erl b/src/ejabberd_sup.erl index 364c8a058..a97c7784b 100644 --- a/src/ejabberd_sup.erl +++ b/src/ejabberd_sup.erl @@ -5,7 +5,7 @@ %%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_system_monitor.erl b/src/ejabberd_system_monitor.erl index 208909366..d03e3bbd8 100644 --- a/src/ejabberd_system_monitor.erl +++ b/src/ejabberd_system_monitor.erl @@ -5,7 +5,7 @@ %%% Created : 21 Mar 2007 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_tmp_sup.erl b/src/ejabberd_tmp_sup.erl index 64316d4c9..f23b51289 100644 --- a/src/ejabberd_tmp_sup.erl +++ b/src/ejabberd_tmp_sup.erl @@ -5,7 +5,7 @@ %%% Created : 18 Jul 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_update.erl b/src/ejabberd_update.erl index ff6c2712d..0ec129944 100644 --- a/src/ejabberd_update.erl +++ b/src/ejabberd_update.erl @@ -5,7 +5,7 @@ %%% Created : 27 Jan 2006 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_web.erl b/src/ejabberd_web.erl index 5cfbb93aa..431ae8ef3 100644 --- a/src/ejabberd_web.erl +++ b/src/ejabberd_web.erl @@ -6,7 +6,7 @@ %%% Created : 28 Feb 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejabberd_web_admin.erl b/src/ejabberd_web_admin.erl index ee50a0031..7691dd794 100644 --- a/src/ejabberd_web_admin.erl +++ b/src/ejabberd_web_admin.erl @@ -5,7 +5,7 @@ %%% Created : 9 Apr 2004 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -333,7 +333,7 @@ make_xhtml(Els, Host, Node, Lang, JID, Level) -> [?XE(<<"p">>, [?AC(<<"https://www.ejabberd.im/">>, <<"ejabberd">>), ?C(<<" ">>), ?C(ejabberd_option:version()), - ?C(<<" (c) 2002-2021 ">>), + ?C(<<" (c) 2002-2022 ">>), ?AC(<<"https://www.process-one.net/">>, <<"ProcessOne, leader in messaging and push solutions">>)] )])])])]}}. @@ -1857,11 +1857,11 @@ build_elements_pages_list(Size, PageNumber, PageSize) -> ?C(<<" [", (integer_to_binary(PageNumber))/binary, "] ">>)). calculate_pages_number(Size, PageSize) -> - Remainer = case Size rem PageSize of + Remainder = case Size rem PageSize of 0 -> 0; _ -> 1 end, - case (Size div PageSize) + Remainer of + case (Size div PageSize) + Remainder of 1 -> 0; Res -> Res end. diff --git a/src/ejabberd_websocket.erl b/src/ejabberd_websocket.erl index 5f9d284a6..966242331 100644 --- a/src/ejabberd_websocket.erl +++ b/src/ejabberd_websocket.erl @@ -33,7 +33,7 @@ %%% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE %%% POSSIBILITY OF SUCH DAMAGE. %%% ========================================================================================================== -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%%---------------------------------------------------------------------- -module(ejabberd_websocket). diff --git a/src/ejabberd_xmlrpc.erl b/src/ejabberd_xmlrpc.erl index 1a1ec63f4..9e587add8 100644 --- a/src/ejabberd_xmlrpc.erl +++ b/src/ejabberd_xmlrpc.erl @@ -5,7 +5,7 @@ %%% Created : 21 Aug 2007 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ejd2sql.erl b/src/ejd2sql.erl index 427e13087..6afad112c 100644 --- a/src/ejd2sql.erl +++ b/src/ejd2sql.erl @@ -5,7 +5,7 @@ %%% Created : 22 Aug 2005 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/eldap_filter.erl b/src/eldap_filter.erl index ab5b8eb6f..4e554572d 100644 --- a/src/eldap_filter.erl +++ b/src/eldap_filter.erl @@ -6,7 +6,7 @@ %%% Author: Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/eldap_pool.erl b/src/eldap_pool.erl index dd3b9e665..148095783 100644 --- a/src/eldap_pool.erl +++ b/src/eldap_pool.erl @@ -5,7 +5,7 @@ %%% Created : 12 Nov 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/eldap_utils.erl b/src/eldap_utils.erl index dae9b563b..efbd78550 100644 --- a/src/eldap_utils.erl +++ b/src/eldap_utils.erl @@ -5,7 +5,7 @@ %%% Created : 12 Oct 2006 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/elixir_logger_backend.erl b/src/elixir_logger_backend.erl index d466652e1..0db3ee517 100644 --- a/src/elixir_logger_backend.erl +++ b/src/elixir_logger_backend.erl @@ -5,7 +5,7 @@ %%% Created : 9 March 2016 by Mickael Remond <mremond@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/ext_mod.erl b/src/ext_mod.erl index b3e88a9cb..02666e9eb 100644 --- a/src/ext_mod.erl +++ b/src/ext_mod.erl @@ -5,7 +5,7 @@ %%% Created : 19 Feb 2015 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2006-2021 ProcessOne +%%% ejabberd, Copyright (C) 2006-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/extauth.erl b/src/extauth.erl index 6462df1cb..16a5e3f7c 100644 --- a/src/extauth.erl +++ b/src/extauth.erl @@ -2,7 +2,7 @@ %%% Created : 7 May 2018 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/extauth_sup.erl b/src/extauth_sup.erl index 7537e8aef..c10bbf3bf 100644 --- a/src/extauth_sup.erl +++ b/src/extauth_sup.erl @@ -2,7 +2,7 @@ %%% Created : 7 May 2018 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index 29057435d..313061ae0 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -5,7 +5,7 @@ %%% Created : 22 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/gen_mod.erl b/src/gen_mod.erl index 212afb4ff..1d9d26b40 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -5,7 +5,7 @@ %%% Created : 24 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/gen_pubsub_node.erl b/src/gen_pubsub_node.erl index 3f83fe48f..df6c61944 100644 --- a/src/gen_pubsub_node.erl +++ b/src/gen_pubsub_node.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/gen_pubsub_nodetree.erl b/src/gen_pubsub_nodetree.erl index b6b73b8cb..190051fd7 100644 --- a/src/gen_pubsub_nodetree.erl +++ b/src/gen_pubsub_nodetree.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/jd2ejd.erl b/src/jd2ejd.erl index 279dd6e0d..b7fd5f66c 100644 --- a/src/jd2ejd.erl +++ b/src/jd2ejd.erl @@ -5,7 +5,7 @@ %%% Created : 2 Feb 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/misc.erl b/src/misc.erl index 474fad615..1cfcc2182 100644 --- a/src/misc.erl +++ b/src/misc.erl @@ -8,7 +8,7 @@ %%% Created : 30 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_adhoc.erl b/src/mod_adhoc.erl index 73c7d82af..1a2d63038 100644 --- a/src/mod_adhoc.erl +++ b/src/mod_adhoc.erl @@ -5,7 +5,7 @@ %%% Created : 15 Nov 2005 by Magnus Henoch <henoch@dtek.chalmers.se> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index 9834acf01..0b95c9ceb 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -5,7 +5,7 @@ %%% Created : 10 Aug 2008 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -695,7 +695,7 @@ get_commands_spec() -> args_example = [<<"group3">>, <<"myserver.com">>], args_desc = ["Group identifier", "Group server name"], result_example = [{<<"name">>, "Group 3"}, {<<"displayed_groups">>, "group1"}], - result_desc = "List of group informations, as key and value", + result_desc = "List of group information, as key and value", result = {informations, {list, {information, {tuple, [{key, string}, {value, string}]}}}}}, #ejabberd_commands{name = srg_get_members, tags = [shared_roster_group], desc = "Get members of a Shared Roster Group", diff --git a/src/mod_admin_update_sql.erl b/src/mod_admin_update_sql.erl index 02beb4bf8..3f17deefc 100644 --- a/src/mod_admin_update_sql.erl +++ b/src/mod_admin_update_sql.erl @@ -5,7 +5,7 @@ %%% Created : 9 Aug 2017 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -164,10 +164,12 @@ update_tables(State) -> drop_index(State, "i_timestamp"), drop_index(State, "i_peer"), drop_index(State, "i_bare_peer"), + drop_index(State, "i_username_peer"), + drop_index(State, "i_username_bare_peer"), create_index(State, "archive", "i_archive_sh_username_timestamp", ["server_host", "username", "timestamp"]), create_index(State, "archive", "i_archive_sh_timestamp", ["server_host", "timestamp"]), - create_index(State, "archive", "i_archive_sh_peer", ["server_host", "peer"]), - create_index(State, "archive", "i_archive_sh_bare_peer", ["server_host", "bare_peer"]), + create_index(State, "archive", "i_archive_sh_username_peer", ["server_host", "username", "peer"]), + create_index(State, "archive", "i_archive_sh_username_bare_peer", ["server_host", "username", "bare_peer"]), drop_sh_default(State, "archive"), add_sh_column(State, "archive_prefs"), @@ -255,20 +257,30 @@ update_tables(State) -> create_index(State, "sm", "i_sm_sh_username", ["server_host", "username"]), drop_sh_default(State, "sm"), - add_sh_column(State, "carboncopy"), - drop_index(State, "i_carboncopy_ur"), - drop_index(State, "i_carboncopy_user"), - add_pkey(State, "carboncopy", ["server_host", "username", "resource"]), - create_index(State, "carboncopy", "i_carboncopy_sh_user", ["server_host", "username"]), - drop_sh_default(State, "carboncopy"), - add_sh_column(State, "push_session"), drop_index(State, "i_push_usn"), drop_index(State, "i_push_ut"), add_pkey(State, "push_session", ["server_host", "username", "timestamp"]), - create_index(State, "push_session", "i_push_session_susn", ["server_host", "username", "service", "node"]), + create_unique_index(State, "push_session", "i_push_session_susn", ["server_host", "username", "service", "node"]), drop_sh_default(State, "push_session"), + add_sh_column(State, "mix_pam"), + drop_index(State, "i_mix_pam"), + drop_index(State, "i_mix_pam_us"), + create_unique_index(State, "mix_pam", "i_mix_pam", ["username", "server_host", "channel", "service"]), + create_index(State, "mix_pam", "i_mix_pam_us", ["username", "server_host"]), + drop_sh_default(State, "mix_pam"), + + add_sh_column(State, "route"), + drop_index(State, "i_route"), + create_unique_index(State, "route", "i_route", ["domain", "server_host", "node", "pid"]), + drop_sh_default(State, "route"), + + add_sh_column(State, "mqtt_pub"), + drop_index(State, "i_mqtt_topic"), + create_unique_index(State, "mqtt_pub", "i_mqtt_topic_server", ["topic", "server_host"]), + drop_sh_default(State, "mqtt_pub"), + ok. add_sh_column(#state{dbtype = pgsql} = State, Table) -> diff --git a/src/mod_announce.erl b/src/mod_announce.erl index 21213615c..8698a8a3b 100644 --- a/src/mod_announce.erl +++ b/src/mod_announce.erl @@ -5,7 +5,7 @@ %%% Created : 11 Aug 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_announce_mnesia.erl b/src/mod_announce_mnesia.erl index 068406e01..d56d036ad 100644 --- a/src/mod_announce_mnesia.erl +++ b/src/mod_announce_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_announce_sql.erl b/src/mod_announce_sql.erl index bc79fc77a..5ef3a7900 100644 --- a/src/mod_announce_sql.erl +++ b/src/mod_announce_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_avatar.erl b/src/mod_avatar.erl index 09329853d..0db65c253 100644 --- a/src/mod_avatar.erl +++ b/src/mod_avatar.erl @@ -3,7 +3,7 @@ %%% Created : 13 Sep 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -475,7 +475,7 @@ mod_doc() -> [{convert, #{value => "{From: To}", desc => - ?T("Defines image convertion rules: the format in 'From' " + ?T("Defines image conversion rules: the format in 'From' " "will be converted to format in 'To'. The value of 'From' " "can also be 'default', which is match-all rule. NOTE: " "the list of supported formats is detected at compile time " @@ -489,4 +489,4 @@ mod_doc() -> desc => ?T("Limit any given JID by the number of avatars it is able " "to convert per minute. This is to protect the server from " - "image convertion DoS. The default value is '10'.")}}]}. + "image conversion DoS. The default value is '10'.")}}]}. diff --git a/src/mod_block_strangers.erl b/src/mod_block_strangers.erl index 92f52236d..437df2307 100644 --- a/src/mod_block_strangers.erl +++ b/src/mod_block_strangers.erl @@ -5,7 +5,7 @@ %%% Created : 25 Dec 2016 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_blocking.erl b/src/mod_blocking.erl index 7d4b1bff5..06aa4b195 100644 --- a/src/mod_blocking.erl +++ b/src/mod_blocking.erl @@ -5,7 +5,7 @@ %%% Created : 24 Aug 2008 by Stephan Maka <stephan@spaceboyz.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_bosh.erl b/src/mod_bosh.erl index 37a7fa809..8f2690d60 100644 --- a/src/mod_bosh.erl +++ b/src/mod_bosh.erl @@ -7,7 +7,7 @@ %%% Created : 20 Jul 2011 by Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -207,7 +207,7 @@ mod_doc() -> "It makes it possible to simulate long lived connections " "required by XMPP over the HTTP protocol. In practice, " "this module makes it possible to use XMPP in a browser without " - "Websocket support and more generally to have a way to use " + "WebSocket support and more generally to have a way to use " "XMPP while having to get through an HTTP proxy."), opts => [{json, @@ -244,7 +244,8 @@ mod_doc() -> {ram_db_type, #{value => "mnesia | sql | redis", desc => - ?T("Same as _`default_ram_db`_ but applied to this module only.")}}, + ?T("Same as top-level _`default_ram_db`_ option, " + "but applied to this module only.")}}, {use_cache, #{value => "true | false", desc => diff --git a/src/mod_bosh_mnesia.erl b/src/mod_bosh_mnesia.erl index 3f9f32345..01a64d67e 100644 --- a/src/mod_bosh_mnesia.erl +++ b/src/mod_bosh_mnesia.erl @@ -2,7 +2,7 @@ %%% Created : 12 Jan 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_bosh_redis.erl b/src/mod_bosh_redis.erl index c288f6c06..12c0a925d 100644 --- a/src/mod_bosh_redis.erl +++ b/src/mod_bosh_redis.erl @@ -5,7 +5,7 @@ %%% Created : 28 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_bosh_sql.erl b/src/mod_bosh_sql.erl index 7dba8fc4b..80369facc 100644 --- a/src/mod_bosh_sql.erl +++ b/src/mod_bosh_sql.erl @@ -5,7 +5,7 @@ %%% Created : 28 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_caps.erl b/src/mod_caps.erl index bc48dac6f..3c8b16b0b 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -5,7 +5,7 @@ %%% Created : 7 Oct 2006 by Magnus Henoch <henoch@dtek.chalmers.se> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_caps_mnesia.erl b/src/mod_caps_mnesia.erl index 965c3dbfd..db3ac8351 100644 --- a/src/mod_caps_mnesia.erl +++ b/src/mod_caps_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_caps_sql.erl b/src/mod_caps_sql.erl index 7fb3cf8fa..7ab39b489 100644 --- a/src/mod_caps_sql.erl +++ b/src/mod_caps_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index a4e3a7999..3013ab749 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -7,7 +7,7 @@ %%% {mod_carboncopy, []} %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_client_state.erl b/src/mod_client_state.erl index 3585ec3a4..14a49fdba 100644 --- a/src/mod_client_state.erl +++ b/src/mod_client_state.erl @@ -5,7 +5,7 @@ %%% Created : 11 Sep 2014 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2014-2021 ProcessOne +%%% ejabberd, Copyright (C) 2014-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_configure.erl b/src/mod_configure.erl index 32c7ebb31..385c6d657 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -5,7 +5,7 @@ %%% Created : 19 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -171,9 +171,14 @@ get_local_identity(Acc, _From, _To, Node, Lang) -> ?INFO_COMMAND(?T("Get User Last Login Time"), Lang); ?NS_ADMINL(<<"user-stats">>) -> ?INFO_COMMAND(?T("Get User Statistics"), Lang); + ?NS_ADMINL(<<"get-registered-users-list">>) -> + ?INFO_COMMAND(?T("Get List of Registered Users"), + Lang); ?NS_ADMINL(<<"get-registered-users-num">>) -> ?INFO_COMMAND(?T("Get Number of Registered Users"), Lang); + ?NS_ADMINL(<<"get-online-users-list">>) -> + ?INFO_COMMAND(?T("Get List of Online Users"), Lang); ?NS_ADMINL(<<"get-online-users-num">>) -> ?INFO_COMMAND(?T("Get Number of Online Users"), Lang); _ -> Acc @@ -252,8 +257,12 @@ get_local_features(Acc, From, ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); ?NS_ADMINL(<<"user-stats">>) -> ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); + ?NS_ADMINL(<<"get-registered-users-list">>) -> + ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); ?NS_ADMINL(<<"get-registered-users-num">>) -> ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); + ?NS_ADMINL(<<"get-online-users-list">>) -> + ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); ?NS_ADMINL(<<"get-online-users-num">>) -> ?INFO_RESULT(Allow, [?NS_COMMANDS], Lang); _ -> Acc @@ -476,8 +485,12 @@ get_local_items(Acc, From, #jid{lserver = LServer} = To, ?ITEMS_RESULT(Allow, LNode, {error, Err}); ?NS_ADMINL(<<"user-stats">>) -> ?ITEMS_RESULT(Allow, LNode, {error, Err}); + ?NS_ADMINL(<<"get-registered-users-list">>) -> + ?ITEMS_RESULT(Allow, LNode, {error, Err}); ?NS_ADMINL(<<"get-registered-users-num">>) -> ?ITEMS_RESULT(Allow, LNode, {error, Err}); + ?NS_ADMINL(<<"get-online-users-list">>) -> + ?ITEMS_RESULT(Allow, LNode, {error, Err}); ?NS_ADMINL(<<"get-online-users-num">>) -> ?ITEMS_RESULT(Allow, LNode, {error, Err}); _ -> Acc @@ -515,8 +528,12 @@ get_local_items(_Host, [<<"user">>], Server, Lang) -> (?NS_ADMINX(<<"get-user-lastlogin">>))), ?NODE(?T("Get User Statistics"), (?NS_ADMINX(<<"user-stats">>))), + ?NODE(?T("Get List of Registered Users"), + (?NS_ADMINX(<<"get-registered-users-list">>))), ?NODE(?T("Get Number of Registered Users"), (?NS_ADMINX(<<"get-registered-users-num">>))), + ?NODE(?T("Get List of Online Users"), + (?NS_ADMINX(<<"get-online-users-list">>))), ?NODE(?T("Get Number of Online Users"), (?NS_ADMINX(<<"get-online-users-num">>)))]}; get_local_items(_Host, [<<"http:">> | _], _Server, @@ -1065,6 +1082,16 @@ get_form(_Host, ?NS_ADMINL(<<"user-stats">>), Lang) -> label = tr(Lang, ?T("Jabber ID")), var = <<"accountjid">>, required = true}]}}; +get_form(Host, ?NS_ADMINL(<<"get-registered-users-list">>), Lang) -> + Values = [jid:encode(jid:make(U, Host)) + || {U, _} <- ejabberd_auth:get_users(Host)], + {result, completed, + #xdata{type = form, + fields = [?HFIELD(), + #xdata_field{type = 'jid-multi', + label = tr(Lang, ?T("The list of all users")), + var = <<"registereduserjids">>, + values = Values}]}}; get_form(Host, ?NS_ADMINL(<<"get-registered-users-num">>), Lang) -> Num = integer_to_binary(ejabberd_auth:count_users(Host)), @@ -1075,6 +1102,17 @@ get_form(Host, label = tr(Lang, ?T("Number of registered users")), var = <<"registeredusersnum">>, values = [Num]}]}}; +get_form(Host, ?NS_ADMINL(<<"get-online-users-list">>), Lang) -> + Accounts = [jid:encode(jid:make(U, Host)) + || {U, _, _} <- ejabberd_sm:get_vh_session_list(Host)], + Values = lists:usort(Accounts), + {result, completed, + #xdata{type = form, + fields = [?HFIELD(), + #xdata_field{type = 'jid-multi', + label = tr(Lang, ?T("The list of all online users")), + var = <<"onlineuserjids">>, + values = Values}]}}; get_form(Host, ?NS_ADMINL(<<"get-online-users-num">>), Lang) -> Num = integer_to_binary(ejabberd_sm:get_vh_session_number(Host)), diff --git a/src/mod_conversejs.erl b/src/mod_conversejs.erl index 8683d60ab..ce943b330 100644 --- a/src/mod_conversejs.erl +++ b/src/mod_conversejs.erl @@ -5,7 +5,7 @@ %%% Created : 8 Nov 2021 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -50,23 +50,32 @@ reload(_Host, _NewOpts, _OldOpts) -> depends(_Host, _Opts) -> []. -process([], #request{method = 'GET'}) -> - Host = ejabberd_config:get_myname(), - Domain = gen_mod:get_module_opt(Host, ?MODULE, default_domain), - Script = gen_mod:get_module_opt(Host, ?MODULE, conversejs_script), - CSS = gen_mod:get_module_opt(Host, ?MODULE, conversejs_css), +process([], #request{method = 'GET', host = Host, raw_path = RawPath}) -> + ExtraOptions = get_extra_options(Host), + DomainRaw = gen_mod:get_module_opt(Host, ?MODULE, default_domain), + Domain = misc:expand_keyword(<<"@HOST@">>, DomainRaw, Host), + Script = get_file_url(Host, conversejs_script, + <<RawPath/binary, "/converse.min.js">>, + <<"https://cdn.conversejs.org/dist/converse.min.js">>), + CSS = get_file_url(Host, conversejs_css, + <<RawPath/binary, "/converse.min.css">>, + <<"https://cdn.conversejs.org/dist/converse.min.css">>), Init = [{<<"discover_connection_methods">>, false}, {<<"jid">>, Domain}, {<<"default_domain">>, Domain}, {<<"domain_placeholder">>, Domain}, - {<<"view_mode">>, <<"fullscreen">>}], + {<<"registration_domain">>, Domain}, + {<<"assets_path">>, RawPath}, + {<<"i18n">>, ejabberd_option:language(Host)}, + {<<"view_mode">>, <<"fullscreen">>} + | ExtraOptions], Init2 = - case gen_mod:get_module_opt(Host, ?MODULE, websocket_url) of + case mod_host_meta:get_url(?MODULE, websocket, any, Host) of undefined -> Init; WSURL -> [{<<"websocket_url">>, WSURL} | Init] end, Init3 = - case gen_mod:get_module_opt(Host, ?MODULE, bosh_service_url) of + case mod_host_meta:get_url(?MODULE, bosh, any, Host) of undefined -> Init2; BoshURL -> [{<<"bosh_service_url">>, BoshURL} | Init2] end, @@ -85,13 +94,109 @@ process([], #request{method = 'GET'}) -> <<"</script>">>, <<"</body>">>, <<"</html>">>]}; -process(_, _) -> - ejabberd_web:error(not_found). +process(LocalPath, #request{host = Host}) -> + case is_served_file(LocalPath) of + true -> serve(Host, LocalPath); + false -> ejabberd_web:error(not_found) + end. + +%%---------------------------------------------------------------------- +%% File server +%%---------------------------------------------------------------------- + +is_served_file([<<"converse.min.js">>]) -> true; +is_served_file([<<"converse.min.css">>]) -> true; +is_served_file([<<"converse.min.js.map">>]) -> true; +is_served_file([<<"converse.min.css.map">>]) -> true; +is_served_file([<<"emojis.js">>]) -> true; +is_served_file([<<"locales">>, _]) -> true; +is_served_file([<<"locales">>, <<"dayjs">>, _]) -> true; +is_served_file([<<"webfonts">>, _]) -> true; +is_served_file(_) -> false. + +serve(Host, LocalPath) -> + case get_conversejs_resources(Host) of + undefined -> ejabberd_web:error(not_found); + MainPath -> serve2(LocalPath, MainPath) + end. + +get_conversejs_resources(Host) -> + Opts = gen_mod:get_module_opts(Host, ?MODULE), + mod_conversejs_opt:conversejs_resources(Opts). + +%% Copied from mod_muc_log_http.erl + +serve2(LocalPathBin, MainPathBin) -> + LocalPath = [binary_to_list(LPB) || LPB <- LocalPathBin], + MainPath = binary_to_list(MainPathBin), + FileName = filename:join(filename:split(MainPath) ++ LocalPath), + case file:read_file(FileName) of + {ok, FileContents} -> + ?DEBUG("Delivering content.", []), + {200, + [{<<"Content-Type">>, content_type(FileName)}], + FileContents}; + {error, eisdir} -> + {403, [], "Forbidden"}; + {error, Error} -> + ?DEBUG("Delivering error: ~p", [Error]), + case Error of + eacces -> {403, [], "Forbidden"}; + enoent -> {404, [], "Not found"}; + _Else -> {404, [], atom_to_list(Error)} + end + end. + +content_type(Filename) -> + case string:to_lower(filename:extension(Filename)) of + ".css" -> "text/css"; + ".js" -> "text/javascript"; + ".map" -> "application/json"; + ".ttf" -> "font/ttf"; + ".woff" -> "font/woff"; + ".woff2" -> "font/woff2" + end. + +%%---------------------------------------------------------------------- +%% Options parsing +%%---------------------------------------------------------------------- + +get_extra_options(Host) -> + RawOpts = gen_mod:get_module_opt(Host, ?MODULE, conversejs_options), + lists:map(fun({Name, <<"true">>}) -> {Name, true}; + ({Name, <<"false">>}) -> {Name, false}; + ({<<"locked_domain">> = Name, Value}) -> + {Name, misc:expand_keyword(<<"@HOST@">>, Value, Host)}; + ({Name, Value}) -> + {Name, Value} + end, + RawOpts). + +get_file_url(Host, Option, Filename, Default) -> + FileRaw = case gen_mod:get_module_opt(Host, ?MODULE, Option) of + auto -> get_auto_file_url(Host, Filename, Default); + F -> F + end, + misc:expand_keyword(<<"@HOST@">>, FileRaw, Host). + +get_auto_file_url(Host, Filename, Default) -> + case get_conversejs_resources(Host) of + undefined -> Default; + _ -> Filename + end. + +%%---------------------------------------------------------------------- +%% +%%---------------------------------------------------------------------- mod_opt_type(bosh_service_url) -> - econf:either(undefined, econf:binary()); + econf:either(auto, econf:binary()); mod_opt_type(websocket_url) -> - econf:either(undefined, econf:binary()); + econf:either(auto, econf:binary()); +mod_opt_type(conversejs_resources) -> + econf:either(undefined, econf:directory()); +mod_opt_type(conversejs_options) -> + econf:map(econf:binary(), econf:either(econf:binary(), econf:int())); mod_opt_type(conversejs_script) -> econf:binary(); mod_opt_type(conversejs_css) -> @@ -100,11 +205,13 @@ mod_opt_type(default_domain) -> econf:binary(). mod_options(_) -> - [{bosh_service_url, undefined}, - {websocket_url, undefined}, - {default_domain, ejabberd_config:get_myname()}, - {conversejs_script, <<"https://cdn.conversejs.org/dist/converse.min.js">>}, - {conversejs_css, <<"https://cdn.conversejs.org/dist/converse.min.css">>}]. + [{bosh_service_url, auto}, + {websocket_url, auto}, + {default_domain, <<"@HOST@">>}, + {conversejs_resources, undefined}, + {conversejs_options, []}, + {conversejs_script, auto}, + {conversejs_css, auto}]. mod_doc() -> #{desc => @@ -114,44 +221,99 @@ mod_doc() -> ?T("To use this module, in addition to adding it to the 'modules' " "section, you must also enable it in 'listen' -> 'ejabberd_http' -> " "http://../listen-options/#request-handlers[request_handlers]."), "", - ?T("You must also setup either the option 'websocket_url' or 'bosh_service_url'."), "", - ?T("By default, the options 'conversejs_css' and 'conversejs_script'" - " point to the public Converse.js client. Alternatively, you can" - " host the client locally using _`mod_http_fileserver`_.") + ?T("Make sure either 'mod_bosh' or 'ejabberd_http_ws' " + "http://../listen-options/#request-handlers[request_handlers] " + "are enabled."), "", + ?T("When 'conversejs_css' and 'conversejs_script' are 'auto', " + "by default they point to the public Converse client.") + ], + example => + [{?T("Manually setup WebSocket url, and use the public Converse client:"), + ["listen:", + " -", + " port: 5280", + " module: ejabberd_http", + " request_handlers:", + " /bosh: mod_bosh", + " /websocket: ejabberd_http_ws", + " /conversejs: mod_conversejs", + "", + "modules:", + " mod_bosh: {}", + " mod_conversejs:", + " websocket_url: \"ws://@HOST@:5280/websocket\""]}, + {?T("Host Converse locally and let auto detection of WebSocket and Converse URLs:"), + ["listen:", + " -", + " port: 443", + " module: ejabberd_http", + " tls: true", + " request_handlers:", + " /websocket: ejabberd_http_ws", + " /conversejs: mod_conversejs", + "", + "modules:", + " mod_conversejs:", + " conversejs_resources: \"/home/ejabberd/conversejs-9.0.0/package/dist\""]}, + {?T("Configure some additional options for Converse"), + ["modules:", + " mod_conversejs:", + " websocket_url: auto", + " conversejs_options:", + " auto_away: 30", + " clear_cache_on_logout: true", + " i18n: \"pt\"", + " locked_domain: \"@HOST@\"", + " message_archiving: always", + " theme: concord"]} ], - example => - ["listen:", - " -", - " port: 5280", - " module: ejabberd_http", - " request_handlers:", - " /websocket: ejabberd_http_ws", - " /conversejs: mod_conversejs", - "", - "modules:", - " mod_conversejs:", - " websocket_url: \"ws://example.org:5280/websocket\""], opts => [{websocket_url, - #{value => ?T("WebsocketURL"), + #{value => ?T("auto | WebSocketURL"), desc => - ?T("A websocket URL to which Converse.js can connect to.")}}, + ?T("A WebSocket URL to which Converse can connect to. " + "The keyword '@HOST@' is replaced with the real virtual " + "host name. " + "If set to 'auto', it will build the URL of the first " + "configured WebSocket request handler. " + "The default value is 'auto'.")}}, {bosh_service_url, - #{value => ?T("BoshURL"), + #{value => ?T("auto | BoshURL"), desc => - ?T("BOSH service URL to which Converse.js can connect to.")}}, + ?T("BOSH service URL to which Converse can connect to. " + "The keyword '@HOST@' is replaced with the real " + "virtual host name. " + "If set to 'auto', it will build the URL of the first " + "configured BOSH request handler. " + "The default value is 'auto'.")}}, {default_domain, #{value => ?T("Domain"), desc => ?T("Specify a domain to act as the default for user JIDs. " - "The default value is the first domain defined in the " - "ejabberd configuration file.")}}, + "The keyword '@HOST@' is replaced with the hostname. " + "The default value is '@HOST@'.")}}, + {conversejs_resources, + #{value => ?T("Path"), + desc => + ?T("Local path to the Converse files. " + "If not set, the public Converse client will be used instead.")}}, + {conversejs_options, + #{value => "{Name: Value}", + desc => + ?T("Specify additional options to be passed to Converse. " + "See https://conversejs.org/docs/html/configuration.html[Converse configuration]. " + "Only boolean, integer and string values are supported; " + "lists are not supported.")}}, {conversejs_script, - #{value => ?T("URL"), + #{value => ?T("auto | URL"), desc => - ?T("Converse.js main script URL.")}}, + ?T("Converse main script URL. " + "The keyword '@HOST@' is replaced with the hostname. " + "The default value is 'auto'.")}}, {conversejs_css, - #{value => ?T("URL"), + #{value => ?T("auto | URL"), desc => - ?T("Converse.js CSS URL.")}}] + ?T("Converse CSS URL. " + "The keyword '@HOST@' is replaced with the hostname. " + "The default value is 'auto'.")}}] }. diff --git a/src/mod_conversejs_opt.erl b/src/mod_conversejs_opt.erl index 9e53978ea..c8132bfab 100644 --- a/src/mod_conversejs_opt.erl +++ b/src/mod_conversejs_opt.erl @@ -5,23 +5,37 @@ -export([bosh_service_url/1]). -export([conversejs_css/1]). +-export([conversejs_options/1]). +-export([conversejs_resources/1]). -export([conversejs_script/1]). -export([default_domain/1]). -export([websocket_url/1]). --spec bosh_service_url(gen_mod:opts() | global | binary()) -> 'undefined' | binary(). +-spec bosh_service_url(gen_mod:opts() | global | binary()) -> 'auto' | binary(). bosh_service_url(Opts) when is_map(Opts) -> gen_mod:get_opt(bosh_service_url, Opts); bosh_service_url(Host) -> gen_mod:get_module_opt(Host, mod_conversejs, bosh_service_url). --spec conversejs_css(gen_mod:opts() | global | binary()) -> binary(). +-spec conversejs_css(gen_mod:opts() | global | binary()) -> 'auto' | binary(). conversejs_css(Opts) when is_map(Opts) -> gen_mod:get_opt(conversejs_css, Opts); conversejs_css(Host) -> gen_mod:get_module_opt(Host, mod_conversejs, conversejs_css). --spec conversejs_script(gen_mod:opts() | global | binary()) -> binary(). +-spec conversejs_options(gen_mod:opts() | global | binary()) -> [{binary(),binary() | integer()}]. +conversejs_options(Opts) when is_map(Opts) -> + gen_mod:get_opt(conversejs_options, Opts); +conversejs_options(Host) -> + gen_mod:get_module_opt(Host, mod_conversejs, conversejs_options). + +-spec conversejs_resources(gen_mod:opts() | global | binary()) -> 'undefined' | binary(). +conversejs_resources(Opts) when is_map(Opts) -> + gen_mod:get_opt(conversejs_resources, Opts); +conversejs_resources(Host) -> + gen_mod:get_module_opt(Host, mod_conversejs, conversejs_resources). + +-spec conversejs_script(gen_mod:opts() | global | binary()) -> 'auto' | binary(). conversejs_script(Opts) when is_map(Opts) -> gen_mod:get_opt(conversejs_script, Opts); conversejs_script(Host) -> @@ -33,7 +47,7 @@ default_domain(Opts) when is_map(Opts) -> default_domain(Host) -> gen_mod:get_module_opt(Host, mod_conversejs, default_domain). --spec websocket_url(gen_mod:opts() | global | binary()) -> 'undefined' | binary(). +-spec websocket_url(gen_mod:opts() | global | binary()) -> 'auto' | binary(). websocket_url(Opts) when is_map(Opts) -> gen_mod:get_opt(websocket_url, Opts); websocket_url(Host) -> diff --git a/src/mod_delegation.erl b/src/mod_delegation.erl index 3ae3b8a51..19a1adcc6 100644 --- a/src/mod_delegation.erl +++ b/src/mod_delegation.erl @@ -4,7 +4,7 @@ %%% Purpose : XEP-0355: Namespace Delegation %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_disco.erl b/src/mod_disco.erl index deb9d15a2..8a74d85df 100644 --- a/src/mod_disco.erl +++ b/src/mod_disco.erl @@ -5,7 +5,7 @@ %%% Created : 1 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_fail2ban.erl b/src/mod_fail2ban.erl index 8751653d8..d7b2963f4 100644 --- a/src/mod_fail2ban.erl +++ b/src/mod_fail2ban.erl @@ -5,7 +5,7 @@ %%% Created : 15 Aug 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2014-2021 ProcessOne +%%% ejabberd, Copyright (C) 2014-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_host_meta.erl b/src/mod_host_meta.erl new file mode 100644 index 000000000..f2d8b92ad --- /dev/null +++ b/src/mod_host_meta.erl @@ -0,0 +1,237 @@ +%%%------------------------------------------------------------------- +%%% File : mod_host_meta.erl +%%% Author : Badlop <badlop@process-one.net> +%%% Purpose : Serve host-meta files as described in XEP-0156 +%%% Created : 25 March 2022 by Badlop <badlop@process-one.net> +%%% +%%% +%%% ejabberd, Copyright (C) 2022 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. +%%% +%%%---------------------------------------------------------------------- + +-module(mod_host_meta). + +-author('badlop@process-one.net'). + +-protocol({xep, 156, '1.4.0'}). + +-behaviour(gen_mod). + +-export([start/2, stop/1, reload/3, process/2, + mod_opt_type/1, mod_options/1, depends/2]). +-export([mod_doc/0]). +-export([get_url/4]). + +-include("logger.hrl"). + +-include_lib("xmpp/include/xmpp.hrl"). + +-include("ejabberd_http.hrl"). + +-include("ejabberd_web_admin.hrl"). + +-include("translate.hrl"). + +%%%---------------------------------------------------------------------- +%%% gen_mod callbacks +%%%---------------------------------------------------------------------- + +start(_Host, _Opts) -> + ok. + +stop(_Host) -> + ok. + +reload(_Host, _NewOpts, _OldOpts) -> + ok. + +depends(_Host, _Opts) -> + [{mod_bosh, soft}]. + +%%%---------------------------------------------------------------------- +%%% HTTP handlers +%%%---------------------------------------------------------------------- + +process([], #request{method = 'GET', tp = https, host = Host, path = Path}) -> + case lists:last(Path) of + <<"host-meta">> -> + file_xml(Host); + <<"host-meta.json">> -> + file_json(Host) + end; +process(_Path, _Request) -> + {404, [], "Not Found"}. + +%%%---------------------------------------------------------------------- +%%% Internal +%%%---------------------------------------------------------------------- + +%% When set to 'auto', it only takes the first valid listener options it finds + +file_xml(Host) -> + BoshList = case get_url(?MODULE, bosh, true, Host) of + undefined -> []; + BoshUrl -> + [?XA(<<"Link">>, + [{<<"rel">>, <<"urn:xmpp:alt-connections:xbosh">>}, + {<<"href">>, BoshUrl}] + )] + end, + WsList = case get_url(?MODULE, websocket, true, Host) of + undefined -> []; + WsUrl -> + [?XA(<<"Link">>, + [{<<"rel">>, <<"urn:xmpp:alt-connections:websocket">>}, + {<<"href">>, WsUrl}] + )] + end, + {200, [html, + {<<"Content-Type">>, <<"application/xrd+xml">>}, + {<<"Access-Control-Allow-Origin">>, <<"*">>}], + [<<"<?xml version='1.0' encoding='utf-8'?>\n">>, + fxml:element_to_binary( + ?XAE(<<"XRD">>, + [{<<"xmlns">>,<<"http://docs.oasis-open.org/ns/xri/xrd-1.0">>}], + BoshList ++ WsList) + )]}. + +file_json(Host) -> + BoshList = case get_url(?MODULE, bosh, true, Host) of + undefined -> []; + BoshUrl -> [#{rel => <<"urn:xmpp:alt-connections:xbosh">>, + href => BoshUrl}] + end, + WsList = case get_url(?MODULE, websocket, true, Host) of + undefined -> []; + WsUrl -> [#{rel => <<"urn:xmpp:alt-connections:websocket">>, + href => WsUrl}] + end, + {200, [html, + {<<"Content-Type">>, <<"application/json">>}, + {<<"Access-Control-Allow-Origin">>, <<"*">>}], + [jiffy:encode(#{links => BoshList ++ WsList})]}. + +get_url(M, bosh, Tls, Host) -> + get_url(M, Tls, Host, bosh_service_url, mod_bosh); +get_url(M, websocket, Tls, Host) -> + get_url(M, Tls, Host, websocket_url, ejabberd_http_ws). + +get_url(M, Tls, Host, Option, Module) -> + case get_url_preliminar(M, Tls, Host, Option, Module) of + undefined -> undefined; + Url -> misc:expand_keyword(<<"@HOST@">>, Url, Host) + end. + +get_url_preliminar(M, Tls, Host, Option, Module) -> + case gen_mod:get_module_opt(Host, M, Option) of + undefined -> undefined; + auto -> get_auto_url(Tls, Module); + <<"auto">> -> get_auto_url(Tls, Module); + U when is_binary(U) -> U + end. + +get_auto_url(Tls, Module) -> + case find_handler_port_path(Tls, Module) of + [] -> undefined; + [{ThisTls, Port, Path} | _] -> + Protocol = case {ThisTls, Module} of + {false, mod_bosh} -> <<"http">>; + {true, mod_bosh} -> <<"https">>; + {false, ejabberd_http_ws} -> <<"ws">>; + {true, ejabberd_http_ws} -> <<"wss">> + end, + <<Protocol/binary, + "://@HOST@:", + (integer_to_binary(Port))/binary, + "/", + (str:join(Path, <<"/">>))/binary>> + end. + +find_handler_port_path(Tls, Module) -> + lists:filtermap( + fun({{Port, _, _}, + ejabberd_http, + #{tls := ThisTls, request_handlers := Handlers}}) + when (Tls == any) or (Tls == ThisTls) -> + case lists:keyfind(Module, 2, Handlers) of + false -> false; + {Path, Module} -> {true, {ThisTls, Port, Path}} + end; + (_) -> false + end, ets:tab2list(ejabberd_listener)). + +%%%---------------------------------------------------------------------- +%%% Options and Doc +%%%---------------------------------------------------------------------- + +mod_opt_type(bosh_service_url) -> + econf:either(undefined, econf:binary()); +mod_opt_type(websocket_url) -> + econf:either(undefined, econf:binary()). + +mod_options(_) -> + [{bosh_service_url, <<"auto">>}, + {websocket_url, <<"auto">>}]. + +mod_doc() -> + #{desc => + [?T("This module serves small 'host-meta' files as described in " + "https://xmpp.org/extensions/xep-0156.html[XEP-0156: Discovering " + "Alternative XMPP Connection Methods]."), "", + ?T("This module is available since ejabberd 22.xx."), "", + ?T("To use this module, in addition to adding it to the 'modules' " + "section, you must also enable it in 'listen' -> 'ejabberd_http' -> " + "http://../listen-options/#request-handlers[request_handlers]."), "", + ?T("Notice it only works if ejabberd_http has tls enabled.")], + example => + ["listen:", + " -", + " port: 443", + " module: ejabberd_http", + " tls: true", + " request_handlers:", + " /bosh: mod_bosh", + " /ws: ejabberd_http_ws", + " /.well-known/host-meta: mod_host_meta", + " /.well-known/host-meta.json: mod_host_meta", + "", + "modules:", + " mod_bosh: {}", + " mod_host_meta:", + " bosh_service_url: \"https://@HOST@:5443/bosh\"", + " websocket_url: \"wss://@HOST@:5443/ws\""], + + opts => + [{websocket_url, + #{value => "undefined | auto | WebSocketURL", + desc => + ?T("WebSocket URL to announce. " + "The keyword '@HOST@' is replaced with the real virtual " + "host name. " + "If set to 'auto', it will build the URL of the first " + "configured WebSocket request handler. " + "The default value is 'auto'.")}}, + {bosh_service_url, + #{value => "undefined | auto | BoshURL", + desc => + ?T("BOSH service URL to announce. " + "The keyword '@HOST@' is replaced with the real " + "virtual host name. " + "If set to 'auto', it will build the URL of the first " + "configured BOSH request handler. " + "The default value is 'auto'.")}}] + }. diff --git a/src/mod_host_meta_opt.erl b/src/mod_host_meta_opt.erl new file mode 100644 index 000000000..965e95cf8 --- /dev/null +++ b/src/mod_host_meta_opt.erl @@ -0,0 +1,20 @@ +%% Generated automatically +%% DO NOT EDIT: run `make options` instead + +-module(mod_host_meta_opt). + +-export([bosh_service_url/1]). +-export([websocket_url/1]). + +-spec bosh_service_url(gen_mod:opts() | global | binary()) -> 'undefined' | binary(). +bosh_service_url(Opts) when is_map(Opts) -> + gen_mod:get_opt(bosh_service_url, Opts); +bosh_service_url(Host) -> + gen_mod:get_module_opt(Host, mod_host_meta, bosh_service_url). + +-spec websocket_url(gen_mod:opts() | global | binary()) -> 'undefined' | binary(). +websocket_url(Opts) when is_map(Opts) -> + gen_mod:get_opt(websocket_url, Opts); +websocket_url(Host) -> + gen_mod:get_module_opt(Host, mod_host_meta, websocket_url). + diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl index 023df39ca..8bd9522ce 100644 --- a/src/mod_http_api.erl +++ b/src/mod_http_api.erl @@ -5,7 +5,7 @@ %%% Created : 15 Sep 2014 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -525,8 +525,9 @@ mod_options(_) -> mod_doc() -> #{desc => - [?T("This module provides a ReST API to call ejabberd commands " - "using JSON data."), "", + [?T("This module provides a ReST interface to call " + "https://docs.ejabberd.im/developer/ejabberd-api[ejabberd API] " + "commands using JSON data."), "", ?T("To use this module, in addition to adding it to the 'modules' " "section, you must also enable it in 'listen' -> 'ejabberd_http' -> " "http://../listen-options/#request-handlers[request_handlers]."), "", diff --git a/src/mod_http_fileserver.erl b/src/mod_http_fileserver.erl index a5c6ebbfd..d20d626bd 100644 --- a/src/mod_http_fileserver.erl +++ b/src/mod_http_fileserver.erl @@ -5,7 +5,7 @@ %%% Created : %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index 1ff94eb4a..88be57718 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -5,7 +5,7 @@ %%% Created : 20 Aug 2015 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2015-2021 ProcessOne +%%% ejabberd, Copyright (C) 2015-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_http_upload_quota.erl b/src/mod_http_upload_quota.erl index 5ed7fcefb..2d8a0b0de 100644 --- a/src/mod_http_upload_quota.erl +++ b/src/mod_http_upload_quota.erl @@ -5,7 +5,7 @@ %%% Created : 15 Oct 2015 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2015-2021 ProcessOne +%%% ejabberd, Copyright (C) 2015-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_jidprep.erl b/src/mod_jidprep.erl index c666f8544..605ca53b1 100644 --- a/src/mod_jidprep.erl +++ b/src/mod_jidprep.erl @@ -5,7 +5,7 @@ %%% Created : 11 Sep 2019 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2019-2021 ProcessOne +%%% ejabberd, Copyright (C) 2019-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_last.erl b/src/mod_last.erl index a7d36c791..c13e4d22f 100644 --- a/src/mod_last.erl +++ b/src/mod_last.erl @@ -5,7 +5,7 @@ %%% Created : 24 Oct 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_last_mnesia.erl b/src/mod_last_mnesia.erl index a2549dfcf..c081ba039 100644 --- a/src/mod_last_mnesia.erl +++ b/src/mod_last_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_last_sql.erl b/src/mod_last_sql.erl index 07b9a62b3..121c96045 100644 --- a/src/mod_last_sql.erl +++ b/src/mod_last_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_legacy_auth.erl b/src/mod_legacy_auth.erl index 2b29b4cd2..0053d88a6 100644 --- a/src/mod_legacy_auth.erl +++ b/src/mod_legacy_auth.erl @@ -2,7 +2,7 @@ %%% Created : 11 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_mam.erl b/src/mod_mam.erl index 9bf154f58..59940ec81 100644 --- a/src/mod_mam.erl +++ b/src/mod_mam.erl @@ -5,7 +5,7 @@ %%% Created : 4 Jul 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2013-2021 ProcessOne +%%% ejabberd, Copyright (C) 2013-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -740,7 +740,7 @@ should_archive(#message{body = Body, subject = Subject, #message{} = Msg -> should_archive(Msg, LServer); _ -> - false + misc:is_mucsub_message(Pkt) end end end diff --git a/src/mod_mam_mnesia.erl b/src/mod_mam_mnesia.erl index d21d0e6ce..dc5898fca 100644 --- a/src/mod_mam_mnesia.erl +++ b/src/mod_mam_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 15 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_mam_sql.erl b/src/mod_mam_sql.erl index 269b4c963..8e803587e 100644 --- a/src/mod_mam_sql.erl +++ b/src/mod_mam_sql.erl @@ -4,7 +4,7 @@ %%% Created : 15 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_metrics.erl b/src/mod_metrics.erl index d42f79112..d1f24c700 100644 --- a/src/mod_metrics.erl +++ b/src/mod_metrics.erl @@ -5,7 +5,7 @@ %%% Created : 22 Oct 2015 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_mqtt.erl b/src/mod_mqtt.erl index 5d00408df..01950d64a 100644 --- a/src/mod_mqtt.erl +++ b/src/mod_mqtt.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. diff --git a/src/mod_mqtt_mnesia.erl b/src/mod_mqtt_mnesia.erl index 92c43d2ee..1d8e7aa5b 100644 --- a/src/mod_mqtt_mnesia.erl +++ b/src/mod_mqtt_mnesia.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ -export([init/2, publish/6, delete_published/2, lookup_published/2]). -export([list_topics/1, use_cache/1]). -export([init/0]). --export([subscribe/4, unsubscribe/2, find_subscriber/2]). +-export([subscribe/4, unsubscribe/2, find_subscriber/2, mqtree_match/1]). -export([open_session/1, close_session/1, lookup_session/1, get_sessions/2]). -include("logger.hrl"). @@ -103,7 +103,7 @@ lookup_published({_, S, _}, Topic) -> correlation_data = CorrelationData, content_type = ContentType, user_properties = UserProps}] -> - Props = #{payload_format => PayloadFormat, + Props = #{payload_format_indicator => PayloadFormat, response_topic => ResponseTopic, correlation_data => CorrelationData, content_type => ContentType, @@ -249,9 +249,16 @@ unsubscribe({U, S, R} = USR, Topic) -> Reason, [jid:encode(USR), Topic]) end. -find_subscriber(S, Topic) when is_binary(Topic) -> +mqtree_match(Topic) -> Tree = mqtree:whereis(mqtt_sub_index), - case mqtree:match(Tree, Topic) of + mqtree:match(Tree, Topic). + +mqtree_multi_match(Topic) -> + {Res, []} = ejabberd_cluster:multicall(?MODULE, mqtree_match, [Topic]), + lists:umerge(Res). + +find_subscriber(S, Topic) when is_binary(Topic) -> + case mqtree_multi_match(Topic) of [Filter|Filters] -> find_subscriber(S, {Filters, {Filter, S, '_', '_'}}); [] -> diff --git a/src/mod_mqtt_session.erl b/src/mod_mqtt_session.erl index e7737804e..6a551f00f 100644 --- a/src/mod_mqtt_session.erl +++ b/src/mod_mqtt_session.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ -include("logger.hrl"). -include("mqtt.hrl"). -include_lib("xmpp/include/xmpp.hrl"). +-include_lib("public_key/include/public_key.hrl"). -record(state, {vsn = ?VSN :: integer(), version :: undefined | mqtt_version(), @@ -47,7 +48,8 @@ in_flight :: undefined | publish() | pubrel(), codec :: mqtt_codec:state(), queue :: undefined | p1_queue:queue(publish()), - tls :: boolean()}). + tls :: boolean(), + tls_verify :: boolean()}). -type acks() :: #{non_neg_integer() => pubrec()}. -type subscriptions() :: #{binary() => {sub_opts(), non_neg_integer()}}. @@ -162,6 +164,7 @@ init([SockMod, Socket, ListenOpts]) -> State1 = #state{socket = {SockMod, Socket}, id = p1_rand:uniform(65535), tls = proplists:get_bool(tls, ListenOpts), + tls_verify = proplists:get_bool(tls_verify, ListenOpts), codec = mqtt_codec:new(MaxSize)}, Timeout = timer:seconds(30), State2 = set_timeout(State1, Timeout), @@ -553,7 +556,7 @@ unregister_session(_, _) -> {error, state(), error_reason()}. handle_connect(#connect{clean_start = CleanStart} = Pkt, #state{jid = undefined, peername = IP} = State) -> - case authenticate(Pkt, IP) of + case authenticate(Pkt, IP, State) of {ok, JID} -> case validate_will(Pkt, JID) of ok -> @@ -939,7 +942,12 @@ check_sock_result({_, Sock}, {error, Why}) -> starttls(#state{socket = {gen_tcp, Socket}, tls = true}) -> case ejabberd_pkix:get_certfile() of {ok, Cert} -> - case fast_tls:tcp_to_tls(Socket, [{certfile, Cert}]) of + CAFileOpt = + case ejabberd_option:c2s_cafile(ejabberd_config:get_myname()) of + undefined -> []; + CAFile -> [{cafile, CAFile}] + end, + case fast_tls:tcp_to_tls(Socket, [{certfile, Cert}] ++ CAFileOpt) of {ok, TLSSock} -> {ok, {fast_tls, TLSSock}}; {error, Why} -> @@ -1172,9 +1180,9 @@ parse_credentials(JID, ClientID) -> end end. --spec authenticate(connect(), peername()) -> {ok, jid:jid()} | {error, reason_code()}. -authenticate(Pkt, IP) -> - case authenticate(Pkt) of +-spec authenticate(connect(), peername(), state()) -> {ok, jid:jid()} | {error, reason_code()}. +authenticate(Pkt, IP, State) -> + case authenticate(Pkt, State) of {ok, JID, AuthModule} -> ?INFO_MSG("Accepted MQTT authentication for ~ts by ~s backend from ~s", [jid:encode(JID), @@ -1185,8 +1193,8 @@ authenticate(Pkt, IP) -> Err end. --spec authenticate(connect()) -> {ok, jid:jid(), module()} | {error, reason_code()}. -authenticate(#connect{password = Pass, properties = Props} = Pkt) -> +-spec authenticate(connect(), state()) -> {ok, jid:jid(), module()} | {error, reason_code()}. +authenticate(#connect{password = Pass, properties = Props} = Pkt, State) -> case parse_credentials(Pkt) of {ok, #jid{luser = LUser, lserver = LServer} = JID} -> case maps:find(authentication_method, Props) of @@ -1200,16 +1208,82 @@ authenticate(#connect{password = Pass, properties = Props} = Pkt) -> {ok, _} -> {error, 'bad-authentication-method'}; error -> - case ejabberd_auth:check_password_with_authmodule( - LUser, <<>>, LServer, Pass) of - {true, AuthModule} -> {ok, JID, AuthModule}; - false -> {error, 'not-authorized'} - end + case Pass of + <<>> -> + case tls_auth(JID, State) of + true -> + {ok, JID, pkix}; + false -> + {error, 'not-authorized'} + end; + _ -> + case ejabberd_auth:check_password_with_authmodule( + LUser, <<>>, LServer, Pass) of + {true, AuthModule} -> {ok, JID, AuthModule}; + false -> {error, 'not-authorized'} + end + end end; {error, _} = Err -> Err end. +-spec tls_auth(jid:jid(), state()) -> boolean(). +tls_auth(_JID, #state{tls_verify = false}) -> + false; +tls_auth(JID, State) -> + case State#state.socket of + {fast_tls, Sock} -> + case fast_tls:get_peer_certificate(Sock, otp) of + {ok, Cert} -> + case fast_tls:get_verify_result(Sock) of + 0 -> + case get_cert_jid(Cert) of + {ok, JID2} -> + jid:remove_resource(jid:tolower(JID)) == + jid:remove_resource(jid:tolower(JID2)); + error -> + false + end; + VerifyRes -> + Reason = fast_tls:get_cert_verify_string(VerifyRes, Cert), + ?WARNING_MSG("TLS verify failed: ~s", [Reason]), + false + end; + error -> + false + end; + _ -> + false + end. + +get_cert_jid(Cert) -> + case Cert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.subject of + {rdnSequence, Attrs1} -> + Attrs = lists:flatten(Attrs1), + case lists:keyfind(?'id-at-commonName', + #'AttributeTypeAndValue'.type, Attrs) of + #'AttributeTypeAndValue'{value = {utf8String, Val}} -> + try jid:decode(Val) of + #jid{luser = <<>>} -> + case jid:make(Val, ejabberd_config:get_myname()) of + error -> + error; + JID -> + {ok, JID} + end; + JID -> + {ok, JID} + catch _:{bad_jid, _} -> + error + end; + _ -> + error + end; + _ -> + error + end. + %%%=================================================================== %%% Validators %%%=================================================================== diff --git a/src/mod_mqtt_sql.erl b/src/mod_mqtt_sql.erl index fefd000cd..dd40771f5 100644 --- a/src/mod_mqtt_sql.erl +++ b/src/mod_mqtt_sql.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. diff --git a/src/mod_mqtt_ws.erl b/src/mod_mqtt_ws.erl index 01f182d30..1c9c8de7a 100644 --- a/src/mod_mqtt_ws.erl +++ b/src/mod_mqtt_ws.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. diff --git a/src/mod_muc.erl b/src/mod_muc.erl index 72f386b00..ec55e3c14 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -5,7 +5,7 @@ %%% Created : 19 Mar 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -402,10 +402,10 @@ init([Host, Worker]) -> {stop, normal, ok, state()}. handle_call(stop, _From, State) -> {stop, normal, ok, State}; -handle_call({unhibernate, Room, Host}, _From, +handle_call({unhibernate, Room, Host, ResetHibernationTime}, _From, #{server_host := ServerHost} = State) -> RMod = gen_mod:ram_db_mod(ServerHost, ?MODULE), - {reply, load_room(RMod, Host, ServerHost, Room), State}; + {reply, load_room(RMod, Host, ServerHost, Room, ResetHibernationTime), State}; handle_call({create, Room, Host, Opts}, _From, #{server_host := ServerHost} = State) -> ?DEBUG("MUC: create new room '~ts'~n", [Room]), @@ -579,11 +579,15 @@ extract_password(#iq{} = IQ) -> -spec unhibernate_room(binary(), binary(), binary()) -> {ok, pid()} | error. unhibernate_room(ServerHost, Host, Room) -> + unhibernate_room(ServerHost, Host, Room, true). + +-spec unhibernate_room(binary(), binary(), binary(), boolean()) -> {ok, pid()} | error. +unhibernate_room(ServerHost, Host, Room, ResetHibernationTime) -> RMod = gen_mod:ram_db_mod(ServerHost, ?MODULE), case RMod:find_online_room(ServerHost, Room, Host) of error -> Proc = procname(ServerHost, {Room, Host}), - case ?GEN_SERVER:call(Proc, {unhibernate, Room, Host}, 20000) of + case ?GEN_SERVER:call(Proc, {unhibernate, Room, Host, ResetHibernationTime}, 20000) of {ok, _} = R -> R; _ -> error end; @@ -605,7 +609,7 @@ route_to_room(Packet, ServerHost) -> Err = xmpp:err_item_not_found(ErrText, Lang), ejabberd_router:route_error(Packet, Err); StartType -> - case load_room(RMod, Host, ServerHost, Room) of + case load_room(RMod, Host, ServerHost, Room, true) of {error, notfound} when StartType == start -> case check_create_room(ServerHost, Host, Room, From) of true -> @@ -849,28 +853,36 @@ load_permanent_rooms(Hosts, ServerHost, Opts) -> lists:foreach( fun(R) -> {Room, _} = R#muc_room.name_host, - unhibernate_room(ServerHost, Host, Room) + unhibernate_room(ServerHost, Host, Room, false) end, get_rooms(ServerHost, Host)) end, Hosts); false -> ok end. --spec load_room(module(), binary(), binary(), binary()) -> {ok, pid()} | - {error, notfound | term()}. -load_room(RMod, Host, ServerHost, Room) -> +-spec load_room(module(), binary(), binary(), binary(), boolean()) -> + {ok, pid()} | {error, notfound | term()}. +load_room(RMod, Host, ServerHost, Room, ResetHibernationTime) -> case restore_room(ServerHost, Host, Room) of error -> {error, notfound}; Opts0 -> + Mod = gen_mod:db_mod(ServerHost, mod_muc), case proplists:get_bool(persistent, Opts0) of true -> ?DEBUG("Restore room: ~ts", [Room]), - start_room(RMod, Host, ServerHost, Room, Opts0); + Res2 = start_room(RMod, Host, ServerHost, Room, Opts0), + case {Res2, ResetHibernationTime} of + {{ok, _}, true} -> + NewOpts = lists:keyreplace(hibernation_time, 1, Opts0, {hibernation_time, undefined}), + store_room(ServerHost, Host, Room, NewOpts, []); + _ -> + ok + end, + Res2; _ -> ?DEBUG("Restore hibernated non-persistent room: ~ts", [Room]), Res = start_room(RMod, Host, ServerHost, Room, Opts0), - Mod = gen_mod:db_mod(ServerHost, mod_muc), case erlang:function_exported(Mod, get_subscribed_rooms, 3) of true -> ok; @@ -1424,14 +1436,13 @@ mod_doc() -> {db_type, #{value => "mnesia | sql", desc => - ?T("Define the type of persistent storage where the module will " - "store room information. The default is the storage defined " - "by the global option 'default_db', or 'mnesia' if omitted.")}}, + ?T("Same as top-level _`default_db`_ option, " + "but applied to this module only.")}}, {ram_db_type, #{value => "mnesia | sql", desc => - ?T("Define the type of volatile (in-memory) storage where the module " - "will store room information ('muc_online_room' and 'muc_online_users').")}}, + ?T("Same as top-level _`default_ram_db`_ option, " + "but applied to this module only.")}}, {hibernation_timeout, #{value => "infinity | Seconds", desc => diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index ac2d887fe..0015eb30a 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -5,7 +5,7 @@ %%% Created : 8 Sep 2007 by Badlop <badlop@ono.com> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -858,7 +858,7 @@ rooms_report(Method, Action, Service, Days) -> muc_unused(Method, Action, Service, Last_allowed) -> %% Get all required info about all existing rooms - Rooms_all = get_all_rooms(Service), + Rooms_all = get_all_rooms(Service, erlang:system_time(microsecond) - Last_allowed*24*60*60*1000), %% Decide which ones pass the requirements Rooms_pass = decide_rooms(Method, Rooms_all, Last_allowed), @@ -883,14 +883,14 @@ get_online_rooms(ServiceArg) -> || {RoomName, RoomHost, Pid} <- mod_muc:get_online_rooms(Host)] end, Hosts). -get_all_rooms(ServiceArg) -> +get_all_rooms(ServiceArg, Timestamp) -> Hosts = find_services(ServiceArg), lists:flatmap( fun(Host) -> - get_all_rooms2(Host) + get_all_rooms2(Host, Timestamp) end, Hosts). -get_all_rooms2(Host) -> +get_all_rooms2(Host, Timestamp) -> ServerHost = ejabberd_router:host_of_route(Host), OnlineRooms = get_online_rooms(Host), OnlineMap = lists:foldl( @@ -900,8 +900,11 @@ get_all_rooms2(Host) -> Mod = gen_mod:db_mod(ServerHost, mod_muc), DbRooms = - case erlang:function_exported(Mod, get_rooms_without_subscribers, 2) of - true -> + case {erlang:function_exported(Mod, get_rooms_without_subscribers, 2), + erlang:function_exported(Mod, get_hibernated_rooms_older_than, 3)} of + {_, true} -> + Mod:get_hibernated_rooms_older_than(ServerHost, Host, Timestamp); + {true, _} -> Mod:get_rooms_without_subscribers(ServerHost, Host); _ -> Mod:get_rooms(ServerHost, Host) @@ -956,6 +959,8 @@ decide_room(unused, {_Room_name, _Host, ServerHost, Room_pid}, Last_allowed) -> case lists:keyfind(hibernation_time, 1, Opts) of false -> {NodeStartTime, 0}; + {_, undefined} -> + {NodeStartTime, 0}; {_, T} -> {T, 0} end @@ -1045,8 +1050,8 @@ get_room_occupants(Pid) -> get_room_occupants_number(Room, Host) -> case get_room_pid(Room, Host) of Pid when is_pid(Pid )-> - S = get_room_state(Pid), - maps:size(S#state.users); + {ok, #{occupants_number := N}} = mod_muc_room:get_info(Pid), + N; _ -> throw({error, room_not_found}) end. diff --git a/src/mod_muc_log.erl b/src/mod_muc_log.erl index 8bcbc8bc0..0ee493b94 100644 --- a/src/mod_muc_log.erl +++ b/src/mod_muc_log.erl @@ -5,7 +5,7 @@ %%% Created : 12 Mar 2006 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_muc_mnesia.erl b/src/mod_muc_mnesia.erl index c822acc68..18b1e74ef 100644 --- a/src/mod_muc_mnesia.erl +++ b/src/mod_muc_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index aaf3e8895..fd2c931a3 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -5,7 +5,7 @@ %%% Created : 19 Mar 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -49,6 +49,7 @@ get_config/1, set_config/2, get_state/1, + get_info/1, change_item/5, change_item_async/5, config_reloaded/1, @@ -217,6 +218,17 @@ get_state(Pid) -> {error, notfound} end. +-spec get_info(pid()) -> {ok, #{occupants_number => integer()}} | + {error, notfound | timeout}. +get_info(Pid) -> + try + {ok, p1_fsm:sync_send_all_state_event(Pid, get_info)} + catch _:{timeout, {p1_fsm, _, _}} -> + {error, timeout}; + _:{_, {p1_fsm, _, _}} -> + {error, notfound} + end. + -spec subscribe(pid(), jid(), binary(), [binary()]) -> {ok, [binary()]} | {error, binary()}. subscribe(Pid, JID, Nick, Nodes) -> try p1_fsm:sync_send_all_state_event(Pid, {muc_subscribe, JID, Nick, Nodes}) @@ -644,7 +656,7 @@ normal_state({route, ToNick, normal_state(hibernate, StateData) -> case maps:size(StateData#state.users) of 0 -> - store_room_no_checks(StateData, []), + store_room_no_checks(StateData, [], true), ?INFO_MSG("Hibernating room ~ts@~ts", [StateData#state.room, StateData#state.host]), {stop, normal, StateData#state{hibernate_timer = hibernating}}; _ -> @@ -721,6 +733,10 @@ handle_sync_event(get_config, _From, StateName, handle_sync_event(get_state, _From, StateName, StateData) -> {reply, {ok, StateData}, StateName, StateData}; +handle_sync_event(get_info, _From, StateName, + StateData) -> + Result = #{occupants_number => maps:size(StateData#state.users)}, + {reply, Result, StateName, StateData}; handle_sync_event({change_config, Config}, _From, StateName, StateData) -> {result, undefined, NSD} = change_config(Config, StateData), @@ -3997,8 +4013,8 @@ set_vcard_xupdate(State) -> -define(MAKE_CONFIG_OPT(Opt), {get_config_opt_name(Opt), element(Opt, Config)}). --spec make_opts(state()) -> [{atom(), any()}]. -make_opts(StateData) -> +-spec make_opts(state(), boolean()) -> [{atom(), any()}]. +make_opts(StateData, Hibernation) -> Config = StateData#state.config, Subscribers = muc_subscribers_fold( fun(_LJID, Sub, Acc) -> @@ -4042,7 +4058,7 @@ make_opts(StateData) -> {hats_users, lists:map(fun({U, H}) -> {U, maps:to_list(H)} end, maps:to_list(StateData#state.hats_users))}, - {hibernation_time, erlang:system_time(microsecond)}, + {hibernation_time, if Hibernation -> erlang:system_time(microsecond); true -> undefined end}, {subscribers, Subscribers}]. expand_opts(CompactOpts) -> @@ -5004,13 +5020,13 @@ add_to_log(Type, Data, StateData) when Type == roomconfig_change_disabledlogging -> mod_muc_log:add_to_log(StateData#state.server_host, roomconfig_change, Data, StateData#state.jid, - make_opts(StateData)); + make_opts(StateData, false)); add_to_log(Type, Data, StateData) -> case (StateData#state.config)#config.logging of true -> mod_muc_log:add_to_log(StateData#state.server_host, Type, Data, StateData#state.jid, - make_opts(StateData)); + make_opts(StateData, false)); false -> ok end. @@ -5075,16 +5091,18 @@ store_room(StateData, ChangesHints) -> StateData#state.host, StateData#state.room, ChangesHints); _ -> - store_room_no_checks(StateData, ChangesHints) + store_room_no_checks(StateData, ChangesHints, false), + ok end; true -> ok end. -store_room_no_checks(StateData, ChangesHints) -> +-spec store_room_no_checks(state(), list(), boolean()) -> {atomic, any()}. +store_room_no_checks(StateData, ChangesHints, Hibernation) -> mod_muc:store_room(StateData#state.server_host, StateData#state.host, StateData#state.room, - make_opts(StateData), + make_opts(StateData, Hibernation), ChangesHints). -spec send_subscriptions_change_notifications(jid(), binary(), subscribe|unsubscribe, state()) -> ok. diff --git a/src/mod_muc_sql.erl b/src/mod_muc_sql.erl index 8aa7ad62b..3fed0bf2b 100644 --- a/src/mod_muc_sql.erl +++ b/src/mod_muc_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -38,6 +38,7 @@ register_online_user/4, unregister_online_user/4, count_online_rooms_by_user/3, get_online_rooms_by_user/3, get_subscribed_rooms/3, get_rooms_without_subscribers/2, + get_hibernated_rooms_older_than/3, find_online_room_by_pid/2, remove_user/2]). -export([set_affiliation/6, set_affiliations/4, get_affiliation/5, get_affiliations/3, search_affiliation/4]). @@ -64,13 +65,19 @@ store_room(LServer, Host, Name, Opts, ChangesHints) -> _ -> {[], Opts} end, SOpts = misc:term_to_expr(Opts2), + Timestamp = case lists:keyfind(hibernation_time, 1, Opts) of + false -> <<"1970-01-02 00:00:00">>; + {_, undefined} -> <<"1970-01-02 00:00:00">>; + {_, Time} -> usec_to_sql_timestamp(Time) + end, F = fun () -> ?SQL_UPSERT_T( "muc_room", ["!name=%(Name)s", "!host=%(Host)s", "server_host=%(LServer)s", - "opts=%(SOpts)s"]), + "opts=%(SOpts)s", + "created_at=%(Timestamp)t"]), case ChangesHints of Changes when is_list(Changes) -> [change_room(Host, Name, Change) || Change <- Changes]; @@ -179,6 +186,23 @@ get_rooms_without_subscribers(LServer, Host) -> [] end. +get_hibernated_rooms_older_than(LServer, Host, Timestamp) -> + TimestampS = usec_to_sql_timestamp(Timestamp), + case catch ejabberd_sql:sql_query( + LServer, + ?SQL("select @(name)s, @(opts)s from muc_room" + " where host=%(Host)s and created_at < %(TimestampS)t and created_at > '1970-01-02 00:00:00'")) of + {selected, RoomOpts} -> + lists:map( + fun({Room, Opts}) -> + OptsD = ejabberd_sql:decode_term(Opts), + #muc_room{name_host = {Room, Host}, + opts = mod_muc:opts_to_binary(OptsD)} + end, RoomOpts); + _Err -> + [] + end. + get_rooms(LServer, Host) -> case catch ejabberd_sql:sql_query( LServer, @@ -497,3 +521,12 @@ clean_tables(ServerHost) -> ?ERROR_MSG("Failed to clean 'muc_online_users' table: ~p", [Err2]), Err2 end. + +usec_to_sql_timestamp(Timestamp) -> + TS = misc:usec_to_now(Timestamp), + case calendar:now_to_universal_time(TS) of + {{Year, Month, Day}, {Hour, Minute, Second}} -> + list_to_binary(io_lib:format("~4..0B-~2..0B-~2..0B " + "~2..0B:~2..0B:~2..0B", + [Year, Month, Day, Hour, Minute, Second])) + end. diff --git a/src/mod_muc_sup.erl b/src/mod_muc_sup.erl index 62240c857..11a147bb5 100644 --- a/src/mod_muc_sup.erl +++ b/src/mod_muc_sup.erl @@ -2,7 +2,7 @@ %%% Created : 4 Jul 2019 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_multicast.erl b/src/mod_multicast.erl index fa076da70..92de4c7ad 100644 --- a/src/mod_multicast.erl +++ b/src/mod_multicast.erl @@ -5,7 +5,7 @@ %%% Created : 29 May 2007 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 1d367eb72..70e7403ed 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -5,7 +5,7 @@ %%% Created : 5 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_offline_mnesia.erl b/src/mod_offline_mnesia.erl index a3c902fb3..34893cd97 100644 --- a/src/mod_offline_mnesia.erl +++ b/src/mod_offline_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 15 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_offline_sql.erl b/src/mod_offline_sql.erl index 4e8441b7f..65465dffd 100644 --- a/src/mod_offline_sql.erl +++ b/src/mod_offline_sql.erl @@ -4,7 +4,7 @@ %%% Created : 15 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_ping.erl b/src/mod_ping.erl index f233b2ae8..28f7a57b0 100644 --- a/src/mod_ping.erl +++ b/src/mod_ping.erl @@ -5,7 +5,7 @@ %%% Created : 11 Jul 2009 by Brian Cully <bjc@kublai.com> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_pres_counter.erl b/src/mod_pres_counter.erl index 77f42961f..80b8fb85f 100644 --- a/src/mod_pres_counter.erl +++ b/src/mod_pres_counter.erl @@ -5,7 +5,7 @@ %%% Created : 23 Sep 2010 by Ahmed Omar %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl index 5ac26c2f5..4a4ebd5c5 100644 --- a/src/mod_privacy.erl +++ b/src/mod_privacy.erl @@ -5,7 +5,7 @@ %%% Created : 21 Jul 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_privacy_mnesia.erl b/src/mod_privacy_mnesia.erl index 2f9cb0027..f2c6879f1 100644 --- a/src/mod_privacy_mnesia.erl +++ b/src/mod_privacy_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 14 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_privacy_sql.erl b/src/mod_privacy_sql.erl index b27442724..07c97ca7f 100644 --- a/src/mod_privacy_sql.erl +++ b/src/mod_privacy_sql.erl @@ -4,7 +4,7 @@ %%% Created : 14 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_private.erl b/src/mod_private.erl index 436aae222..f6cebbcda 100644 --- a/src/mod_private.erl +++ b/src/mod_private.erl @@ -5,7 +5,7 @@ %%% Created : 16 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_private_mnesia.erl b/src/mod_private_mnesia.erl index b5617d96e..5c789f0a7 100644 --- a/src/mod_private_mnesia.erl +++ b/src/mod_private_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_private_sql.erl b/src/mod_private_sql.erl index 08a13e8a4..d2efbe98d 100644 --- a/src/mod_private_sql.erl +++ b/src/mod_private_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_privilege.erl b/src/mod_privilege.erl index 353a8da27..9c8c9462e 100644 --- a/src/mod_privilege.erl +++ b/src/mod_privilege.erl @@ -4,7 +4,7 @@ %%% Purpose : XEP-0356: Privileged Entity %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65.erl b/src/mod_proxy65.erl index ce1c67a36..1ccb31978 100644 --- a/src/mod_proxy65.erl +++ b/src/mod_proxy65.erl @@ -5,7 +5,7 @@ %%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -173,8 +173,8 @@ mod_doc() -> {ram_db_type, #{value => "mnesia | redis | sql", desc => - ?T("Define the type of volatile (in-memory) storage where the module " - "will store room information.")}}, + ?T("Same as top-level _`default_ram_db`_ option, " + "but applied to this module only.")}}, {ip, #{value => ?T("IPAddress"), desc => diff --git a/src/mod_proxy65_lib.erl b/src/mod_proxy65_lib.erl index f0fb40830..6298d7bf0 100644 --- a/src/mod_proxy65_lib.erl +++ b/src/mod_proxy65_lib.erl @@ -5,7 +5,7 @@ %%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65_mnesia.erl b/src/mod_proxy65_mnesia.erl index cd1790f96..73f248d4c 100644 --- a/src/mod_proxy65_mnesia.erl +++ b/src/mod_proxy65_mnesia.erl @@ -2,7 +2,7 @@ %%% Created : 16 Jan 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65_redis.erl b/src/mod_proxy65_redis.erl index ab1f3cf85..e93dce36a 100644 --- a/src/mod_proxy65_redis.erl +++ b/src/mod_proxy65_redis.erl @@ -3,7 +3,7 @@ %%% Created : 31 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl index 78a8d85d2..c6995482d 100644 --- a/src/mod_proxy65_service.erl +++ b/src/mod_proxy65_service.erl @@ -5,7 +5,7 @@ %%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65_sql.erl b/src/mod_proxy65_sql.erl index ece71c9c5..6e69e5a0f 100644 --- a/src/mod_proxy65_sql.erl +++ b/src/mod_proxy65_sql.erl @@ -3,7 +3,7 @@ %%% Created : 30 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_proxy65_stream.erl b/src/mod_proxy65_stream.erl index 505daf446..4e1eaf3fe 100644 --- a/src/mod_proxy65_stream.erl +++ b/src/mod_proxy65_stream.erl @@ -4,7 +4,7 @@ %%% Purpose : Bytestream process. %%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru> %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index d161ec10c..0aa4d1afc 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -2262,10 +2262,11 @@ get_affiliations(Host, Node, JID) -> set_affiliations(Host, Node, From, Affs) -> Owner = jid:tolower(jid:remove_resource(From)), Action = - fun(#pubsub_node{type = Type, id = Nidx, owners = O} = N) -> + fun(#pubsub_node{type = Type, id = Nidx, owners = O, options = Options} = N) -> Owners = node_owners_call(Host, Type, Nidx, O), case lists:member(Owner, Owners) of true -> + AccessModel = get_option(Options, access_model), OwnerJID = jid:make(Owner), FilteredAffs = case Owners of @@ -2298,6 +2299,17 @@ set_affiliations(Host, Node, From, Affs) -> end; _ -> ok + end, + case AccessModel of + whitelist when Affiliation /= owner, + Affiliation /= publisher, + Affiliation /= member -> + node_action(Host, Type, + unsubscribe_node, + [Nidx, OwnerJID, JID, + all]); + _ -> + ok end end, FilteredAffs), {result, undefined}; @@ -4474,7 +4486,7 @@ mod_doc() -> "to the 'create' stanza element."), ?T("- 'flat' plugin handles the default behaviour and " "follows standard XEP-0060 implementation."), - ?T("- 'pep' plugin adds extention to handle Personal " + ?T("- 'pep' plugin adds extension to handle Personal " "Eventing Protocol (XEP-0163) to the PubSub engine. " "Adding pep allows to handle PEP automatically.")]}}, {vcard, diff --git a/src/mod_pubsub_mnesia.erl b/src/mod_pubsub_mnesia.erl index b7730ce55..3d2d1e46b 100644 --- a/src/mod_pubsub_mnesia.erl +++ b/src/mod_pubsub_mnesia.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_pubsub_sql.erl b/src/mod_pubsub_sql.erl index 0e670e1d5..41b7eed70 100644 --- a/src/mod_pubsub_sql.erl +++ b/src/mod_pubsub_sql.erl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_push.erl b/src/mod_push.erl index 5477c5792..f3e0479f3 100644 --- a/src/mod_push.erl +++ b/src/mod_push.erl @@ -5,7 +5,7 @@ %%% Created : 15 Jul 2017 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_push_keepalive.erl b/src/mod_push_keepalive.erl index e0e83f1e1..1ced2690f 100644 --- a/src/mod_push_keepalive.erl +++ b/src/mod_push_keepalive.erl @@ -5,7 +5,7 @@ %%% Created : 15 Jul 2017 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_push_mnesia.erl b/src/mod_push_mnesia.erl index 665ab48f2..e265678e7 100644 --- a/src/mod_push_mnesia.erl +++ b/src/mod_push_mnesia.erl @@ -5,7 +5,7 @@ %%% Created : 15 Jul 2017 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_push_sql.erl b/src/mod_push_sql.erl index c024a12d1..ae6774a51 100644 --- a/src/mod_push_sql.erl +++ b/src/mod_push_sql.erl @@ -5,7 +5,7 @@ %%% Created : 26 Oct 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2017-2021 ProcessOne +%%% ejabberd, Copyright (C) 2017-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_register.erl b/src/mod_register.erl index b85efd57c..5f3d7de56 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -5,7 +5,7 @@ %%% Created : 8 Dec 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_register_web.erl b/src/mod_register_web.erl index 0cf4bcff8..59bc855bc 100644 --- a/src/mod_register_web.erl +++ b/src/mod_register_web.erl @@ -5,7 +5,7 @@ %%% Created : 4 May 2008 by Badlop <badlop@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 94cae4950..e2b176502 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -5,7 +5,7 @@ %%% Created : 11 Dec 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_roster_mnesia.erl b/src/mod_roster_mnesia.erl index fa1d52f7c..e42367b1f 100644 --- a/src/mod_roster_mnesia.erl +++ b/src/mod_roster_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_roster_sql.erl b/src/mod_roster_sql.erl index ebfcde463..1a8d812b6 100644 --- a/src/mod_roster_sql.erl +++ b/src/mod_roster_sql.erl @@ -4,7 +4,7 @@ %%% Created : 14 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_s2s_dialback.erl b/src/mod_s2s_dialback.erl index 05747e3bc..5e966967d 100644 --- a/src/mod_s2s_dialback.erl +++ b/src/mod_s2s_dialback.erl @@ -2,7 +2,7 @@ %%% Created : 16 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_service_log.erl b/src/mod_service_log.erl index f5f23eeb0..2f962a13f 100644 --- a/src/mod_service_log.erl +++ b/src/mod_service_log.erl @@ -5,7 +5,7 @@ %%% Created : 24 Aug 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index 358a8df32..1960835a1 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -5,7 +5,7 @@ %%% Created : 5 Mar 2005 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -150,7 +150,8 @@ depends(_Host, _Opts) -> -spec init_cache(module(), binary(), gen_mod:opts()) -> ok. init_cache(Mod, Host, Opts) -> - ets_cache:new(?SPECIAL_GROUPS_CACHE, [{max_size, 4}]), + NumHosts = length(ejabberd_option:hosts()), + ets_cache:new(?SPECIAL_GROUPS_CACHE, [{max_size, NumHosts * 4}]), case use_cache(Mod, Host) of true -> CacheOpts = cache_opts(Opts), @@ -1275,11 +1276,8 @@ mod_doc() -> [{db_type, #{value => "mnesia | sql", desc => - ?T("Define the type of storage where the module will create " - "the tables and store user information. The default is " - "the storage defined by the top-level _`default_db`_ option, " - "or 'mnesia' if omitted. If 'sql' value is defined, " - "make sure you have defined the database.")}}, + ?T("Same as top-level _`default_db`_ option, " + "but applied to this module only.")}}, {use_cache, #{value => "true | false", desc => diff --git a/src/mod_shared_roster_ldap.erl b/src/mod_shared_roster_ldap.erl index e842ab261..216dd4ce1 100644 --- a/src/mod_shared_roster_ldap.erl +++ b/src/mod_shared_roster_ldap.erl @@ -7,7 +7,7 @@ %%% Created : 5 Mar 2005 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_shared_roster_mnesia.erl b/src/mod_shared_roster_mnesia.erl index 484df0cd5..0504184ba 100644 --- a/src/mod_shared_roster_mnesia.erl +++ b/src/mod_shared_roster_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 14 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_shared_roster_sql.erl b/src/mod_shared_roster_sql.erl index 0d44dce69..ca25314fd 100644 --- a/src/mod_shared_roster_sql.erl +++ b/src/mod_shared_roster_sql.erl @@ -4,7 +4,7 @@ %%% Created : 14 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_sic.erl b/src/mod_sic.erl index 4eeb8fd08..c21482d7f 100644 --- a/src/mod_sic.erl +++ b/src/mod_sic.erl @@ -5,7 +5,7 @@ %%% Created : 6 Mar 2010 by Karim Gemayel <karim.gemayel@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_sip.erl b/src/mod_sip.erl index 6ea2a408f..5c1e09467 100644 --- a/src/mod_sip.erl +++ b/src/mod_sip.erl @@ -5,7 +5,7 @@ %%% Created : 21 Apr 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2014-2021 ProcessOne +%%% ejabberd, Copyright (C) 2014-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_sip_proxy.erl b/src/mod_sip_proxy.erl index ddfefb1ad..8534766c4 100644 --- a/src/mod_sip_proxy.erl +++ b/src/mod_sip_proxy.erl @@ -5,7 +5,7 @@ %%% Created : 21 Apr 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2014-2021 ProcessOne +%%% ejabberd, Copyright (C) 2014-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_sip_registrar.erl b/src/mod_sip_registrar.erl index 5079aebf0..7c6ffef9e 100644 --- a/src/mod_sip_registrar.erl +++ b/src/mod_sip_registrar.erl @@ -5,7 +5,7 @@ %%% Created : 23 Apr 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2014-2021 ProcessOne +%%% ejabberd, Copyright (C) 2014-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_stats.erl b/src/mod_stats.erl index c61fe6175..52798ce49 100644 --- a/src/mod_stats.erl +++ b/src/mod_stats.erl @@ -5,7 +5,7 @@ %%% Created : 11 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_stream_mgmt.erl b/src/mod_stream_mgmt.erl index f60f6722b..67ab815d1 100644 --- a/src/mod_stream_mgmt.erl +++ b/src/mod_stream_mgmt.erl @@ -3,7 +3,7 @@ %%% Created : 25 Dec 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as @@ -268,7 +268,7 @@ c2s_handle_info(State, {timeout, _, Timeout}) when Timeout == ack_timeout; Timeout == pending_timeout -> %% Late arrival of an already cancelled timer: we just ignore it. %% This might happen because misc:cancel_timer/1 doesn't guarantee - %% timer cancelation in the case when p1_server is used. + %% timer cancellation in the case when p1_server is used. {stop, State}; c2s_handle_info(State, _) -> State. diff --git a/src/mod_stun_disco.erl b/src/mod_stun_disco.erl index cbb671639..26a2646cc 100644 --- a/src/mod_stun_disco.erl +++ b/src/mod_stun_disco.erl @@ -5,7 +5,7 @@ %%% Created : 18 Apr 2020 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% ejabberd, Copyright (C) 2020-2021 ProcessOne +%%% ejabberd, Copyright (C) 2020-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_time.erl b/src/mod_time.erl index 4ec3cd64e..9530967ec 100644 --- a/src/mod_time.erl +++ b/src/mod_time.erl @@ -6,7 +6,7 @@ %%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 8e0d32a4a..3ac97b30e 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -5,7 +5,7 @@ %%% Created : 2 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index bc6e7ebca..f8e9a1d93 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -4,7 +4,7 @@ %%% Created : 29 Jul 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_vcard_mnesia.erl b/src/mod_vcard_mnesia.erl index ad4be701c..694333d65 100644 --- a/src/mod_vcard_mnesia.erl +++ b/src/mod_vcard_mnesia.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_vcard_sql.erl b/src/mod_vcard_sql.erl index 620c1b4b5..842d68c80 100644 --- a/src/mod_vcard_sql.erl +++ b/src/mod_vcard_sql.erl @@ -4,7 +4,7 @@ %%% Created : 13 Apr 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_vcard_xupdate.erl b/src/mod_vcard_xupdate.erl index 59ebc7f71..61d582437 100644 --- a/src/mod_vcard_xupdate.erl +++ b/src/mod_vcard_xupdate.erl @@ -5,7 +5,7 @@ %%% Created : 9 Mar 2007 by Igor Goryachev <igor@goryachev.org> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mod_version.erl b/src/mod_version.erl index 9aa93829d..b842dcfd0 100644 --- a/src/mod_version.erl +++ b/src/mod_version.erl @@ -5,7 +5,7 @@ %%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/mqtt_codec.erl b/src/mqtt_codec.erl index 74fed4eac..e09391ddf 100644 --- a/src/mqtt_codec.erl +++ b/src/mqtt_codec.erl @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeny Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. +%%% @copyright (C) 2002-2022 ProcessOne, SARL. All Rights Reserved. %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. diff --git a/src/node_flat.erl b/src/node_flat.erl index 55dea0d8d..b829395cc 100644 --- a/src/node_flat.erl +++ b/src/node_flat.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl index f9c8a209d..a4142cb10 100644 --- a/src/node_flat_sql.erl +++ b/src/node_flat_sql.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/node_pep.erl b/src/node_pep.erl index 66431b948..c52db1b3e 100644 --- a/src/node_pep.erl +++ b/src/node_pep.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/node_pep_sql.erl b/src/node_pep_sql.erl index 3bb66bc4c..1d1a632f2 100644 --- a/src/node_pep_sql.erl +++ b/src/node_pep_sql.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/nodetree_tree.erl b/src/nodetree_tree.erl index 853c1fb93..df6e9cb60 100644 --- a/src/nodetree_tree.erl +++ b/src/nodetree_tree.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/nodetree_tree_sql.erl b/src/nodetree_tree_sql.erl index 402c50901..6c3419948 100644 --- a/src/nodetree_tree_sql.erl +++ b/src/nodetree_tree_sql.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/nodetree_virtual.erl b/src/nodetree_virtual.erl index c0274a795..988c0334c 100644 --- a/src/nodetree_virtual.erl +++ b/src/nodetree_virtual.erl @@ -5,7 +5,7 @@ %%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/prosody2ejabberd.erl b/src/prosody2ejabberd.erl index 8f5c35f84..07b6427e7 100644 --- a/src/prosody2ejabberd.erl +++ b/src/prosody2ejabberd.erl @@ -4,7 +4,7 @@ %%% Created : 20 Jan 2016 by Evgeny Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/proxy_protocol.erl b/src/proxy_protocol.erl index 146135a69..5716fe2e6 100644 --- a/src/proxy_protocol.erl +++ b/src/proxy_protocol.erl @@ -5,7 +5,7 @@ %%% Created : 27 Nov 2018 by Paweł Chmielowski <pawel@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/pubsub_db_sql.erl b/src/pubsub_db_sql.erl index 6c1e3b162..99c758d43 100644 --- a/src/pubsub_db_sql.erl +++ b/src/pubsub_db_sql.erl @@ -5,7 +5,7 @@ %%% Created : 7 Aug 2009 by Pablo Polvorin <pablo.polvorin@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/pubsub_index.erl b/src/pubsub_index.erl index 5b8d17e95..370fa1967 100644 --- a/src/pubsub_index.erl +++ b/src/pubsub_index.erl @@ -5,7 +5,7 @@ %%% Created : 30 Apr 2009 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/pubsub_migrate.erl b/src/pubsub_migrate.erl index 35fa87b90..9436ca133 100644 --- a/src/pubsub_migrate.erl +++ b/src/pubsub_migrate.erl @@ -5,7 +5,7 @@ %%% Created : 26 Jul 2014 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/pubsub_subscription.erl b/src/pubsub_subscription.erl index 92d6d314d..0b212d21c 100644 --- a/src/pubsub_subscription.erl +++ b/src/pubsub_subscription.erl @@ -5,7 +5,7 @@ %%% Created : 29 May 2009 by Brian Cully <bjc@kublai.com> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/pubsub_subscription_sql.erl b/src/pubsub_subscription_sql.erl index c36934f50..1b5257891 100644 --- a/src/pubsub_subscription_sql.erl +++ b/src/pubsub_subscription_sql.erl @@ -6,7 +6,7 @@ %%% Created : 7 Aug 2009 by Pablo Polvorin <pablo.polvorin@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/rest.erl b/src/rest.erl index 1bb5c5ef7..58e424700 100644 --- a/src/rest.erl +++ b/src/rest.erl @@ -5,7 +5,7 @@ %%% Created : 16 Oct 2014 by Christophe Romain <christophe.romain@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/str.erl b/src/str.erl index a12d2640e..cc7957f97 100644 --- a/src/str.erl +++ b/src/str.erl @@ -5,7 +5,7 @@ %%% Created : 23 Feb 2012 by Evgeniy Khramtsov <ekhramtsov@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/translate.erl b/src/translate.erl index f2ca7c759..b0034588a 100644 --- a/src/translate.erl +++ b/src/translate.erl @@ -5,7 +5,7 @@ %%% Created : 6 Jan 2003 by Alexey Shchepin <alexey@process-one.net> %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as diff --git a/src/win32_dns.erl b/src/win32_dns.erl index 76b347e45..bd65cdc36 100644 --- a/src/win32_dns.erl +++ b/src/win32_dns.erl @@ -5,7 +5,7 @@ %%% Created : 5 Mar 2009 by Geoff Cant %%% %%% -%%% ejabberd, Copyright (C) 2002-2021 ProcessOne +%%% ejabberd, Copyright (C) 2002-2022 ProcessOne %%% %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License as |