diff options
300 files changed, 1509 insertions, 661 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cd9a38c8..abe20503f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - otp: ['19.3', '24'] + otp: ['19.3', '24', '25.0-rc1'] include: - otp: '19.3' rebar: 2 @@ -33,6 +33,9 @@ jobs: - otp: '24' rebar: 3 os: ubuntu-20.04 + - otp: '25.0-rc1' + rebar: 3 + os: ubuntu-20.04 runs-on: ${{ matrix.os }} services: redis: @@ -52,7 +55,7 @@ jobs: shellcheck ejabberd.init.template shellcheck -x ejabberdctl.template - - name: Get previous Erlang/OTP + - name: Get specific Erlang/OTP uses: ErlGang/setup-erlang@master if: matrix.otp != 24 with: @@ -129,11 +132,11 @@ jobs: --prefix=/tmp/ejabberd \ --enable-all \ --disable-elixir \ + --disable-mssql \ --disable-odbc make update make - - run: make rel - run: make install -s - run: make hooks - run: make options @@ -143,11 +146,36 @@ jobs: [ ${{ matrix.rebar }} = 3 ] && true \ || { cat dialyzer/error.log ; test ! -s dialyzer/error.log ; } - - name: Run tests - if: matrix.otp != 24 + - name: Check Production Release + if: matrix.rebar == 3 + run: | + make rel + RE=_build/prod/rel/ejabberd + $RE/bin/ejabberdctl start + $RE/bin/ejabberdctl started + $RE/bin/ejabberdctl stop + $RE/bin/ejabberdctl stopped + cat $RE/var/log/ejabberd/ejabberd.log + grep -q "is stopped in" $RE/var/log/ejabberd/ejabberd.log + + - name: Check Development Release + if: matrix.rebar == 3 + run: | + make dev + RE=_build/dev/rel/ejabberd + $RE/bin/ejabberdctl start + $RE/bin/ejabberdctl started + $RE/bin/ejabberdctl stop + $RE/bin/ejabberdctl stopped + cat $RE/var/log/ejabberd/ejabberd.log + grep -q "is stopped in" $RE/var/log/ejabberd/ejabberd.log + + - name: Run tests (OTP 19.3) + if: matrix.otp == '19.3' + id: ct2 run: make test - - name: Run tests (OTP 24) - if: matrix.otp == 24 + - name: Run tests + if: matrix.otp != '19.3' id: ct run: | (cd priv && ln -sf ../sql) @@ -160,7 +188,8 @@ jobs: rebar3 cover - name: Check results - if: always() + if: always() && (steps.ct.outcome != 'skipped' || steps.ct2.outcome != 'skipped') + id: ctresults run: | [[ -d _build ]] && ln -s _build/test/logs/last/ logs || true ln `find logs/ -name suite.log` logs/suite.log @@ -169,7 +198,7 @@ jobs: test $(find logs/ -empty -name error.log) - name: View logs failures - if: failure() + if: failure() && steps.ctresults.outcome == 'failure' run: | cat logs/suite.log | awk \ 'BEGIN{RS="\n=case";FS="\n"} /=result\s*failed/ {print "=case" $0}' diff --git a/CHANGELOG.md b/CHANGELOG.md index 288931b5c..2f804a359 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -213,7 +213,7 @@ Translations: - Fix problem with leaving old data when updating shared rosters - Fix edge case that caused failure of resuming old sessions with stream management. -- Fix crash when room that was started with loging enabled was later +- Fix crash when room that was started with logging enabled was later changed to logging disabled - Increase default shaper limits (this should help with delays for clients that are using jingle) @@ -278,7 +278,7 @@ Translations: for all backends not only SQL - Add infrastructure for having module documentation directly in individual module source code -- Generate man page automaticaly +- Generate man page automatically - Implement copy feature in mod_carboncopy * Fixes @@ -286,7 +286,7 @@ Translations: - Fix handling of result in xmlrpc module - Make webadmin work even when accessed through not declared domain - Better error reporting in xmlrpc -- Limit ammount of results returned by disco queries to pubsub nodes +- Limit amount of results returned by disco queries to pubsub nodes - Improve validation of configured JWT keys - Fix race condition in Redis/SQL startup - Fix loading order of third party modules @@ -387,7 +387,7 @@ Translations: - Improve handling of unexpected iq in mod_muc_room - Attach mod_muc_room processes to a supervisor - Restore room when receiving message or generic iq for not started room -- Distribute routing of MUC messages accross all CPU cores +- Distribute routing of MUC messages across all CPU cores * PubSub - Fix pending nodes retrieval for SQL backend @@ -421,7 +421,7 @@ Translations: - Make static hooks analyzer working again * MUC -- Service admins are allowed to recreate room even if archiv is nonempty +- Service admins are allowed to recreate room even if archive is nonempty - New option user_mucsub_from_muc_archive - Avoid late arrival of get_disco_item response - Handle get_subscribed_rooms call from mod_muc_room pid diff --git a/Makefile.in b/Makefile.in index 3066488f0..982e6df52 100644 --- a/Makefile.in +++ b/Makefile.in @@ -113,6 +113,7 @@ ifeq "$(REBAR_VER)" "6" EBINDIR=$(DEPSDIR)/ejabberd/ebin REBARREL=MIX_ENV=prod $(REBAR) release --overwrite REBARDEV=MIX_ENV=dev $(REBAR) release --overwrite + RELIVECMD=escript rel/relive.escript && MIX_ENV=dev RELIVE=true iex --name ejabberd@localhost -S mix run else ifeq "$(REBAR_VER)" "3" SKIPDEPS= @@ -130,6 +131,7 @@ endif EBINDIR=$(DEPSDIR)/ejabberd/ebin REBARREL=$(REBAR) as prod tar REBARDEV=REBAR_PROFILE=dev $(REBAR) release + RELIVECMD=$(REBAR) relive else SKIPDEPS=skip_deps=true LISTDEPS=-q list-deps @@ -142,6 +144,8 @@ else EBINDIR=ebin REBARREL=$(REBAR) generate REBARDEV= + RELIVECMD=@echo "Rebar2 detected... relive not supported.\ + \nTry: ./configure --with-rebar=./rebar3 ; make relive" endif endif @@ -268,13 +272,28 @@ copy-files: copy-files-sub: copy-files-sub2 -install: copy-files - # - # Configuration files - $(INSTALL) -d -m 750 $(G_USER) $(ETCDIR) - [ -f $(ETCDIR)/ejabberd.yml ] \ - && $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml-new \ - || $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml +relive: + $(RELIVECMD) + +relivelibdir=$(shell pwd)/$(DEPSDIR) +relivedir=$(shell pwd)/_build/relive +iexpath=$(shell which iex) + +ejabberdctl.relive: + $(SED) -e "s*{{rootdir}}*@prefix@*g" \ + -e "s*{{installuser}}*@INSTALLUSER@*g" \ + -e "s*{{bindir}}/iex*$(iexpath)*g" \ + -e "s*{{bindir}}*@bindir@*g" \ + -e "s*{{libdir}}*${relivelibdir}*g" \ + -e "s*{{sysconfdir}}/ejabberd*$(relivedir)/conf*g" \ + -e "s*{{localstatedir}}/log/ejabberd*$(relivedir)/logs*g" \ + -e "s*{{localstatedir}}/lib/ejabberd*$(relivedir)/database*g" \ + -e "s*{{docdir}}*@docdir@*g" \ + -e "s*{{erl}}*@ERL@*g" \ + -e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \ + > ejabberdctl.relive + +ejabberdctl.example: $(SED) -e "s*{{rootdir}}*@prefix@*g" \ -e "s*{{installuser}}*@INSTALLUSER@*g" \ -e "s*{{bindir}}*@bindir@*g" \ @@ -285,6 +304,14 @@ install: copy-files -e "s*{{erl}}*@ERL@*g" \ -e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \ > ejabberdctl.example + +install: copy-files ejabberdctl.example + # + # Configuration files + $(INSTALL) -d -m 750 $(G_USER) $(ETCDIR) + [ -f $(ETCDIR)/ejabberd.yml ] \ + && $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml-new \ + || $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml [ -f $(ETCDIR)/ejabberdctl.cfg ] \ && $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \ || $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg @@ -470,6 +497,7 @@ help: @echo "" @echo " rel Build a production release" @echo " dev Build a development release" + @echo " relive Start a live ejabberd in _build/relive/" @echo "" @echo " edoc Generate edoc documentation (unused)" @echo " options Generate ejabberd_option.erl" @@ -177,19 +177,6 @@ Check the full list of targets: make help -Development ------------ - -In order to assist in the development of ejabberd, and particularly the -execution of the test suite, a Vagrant environment is available at -https://github.com/processone/ejabberd-vagrant-dev. - -To start ejabberd in development mode from the repository directory, you can -type a command like: - - EJABBERD_CONFIG_PATH=ejabberd.yml erl -pa ebin -pa deps/*/ebin -pa test -pa deps/elixir/lib/*/ebin/ -s ejabberd - - Translation ----------- diff --git a/_checkouts/configure_deps/src/configure_deps_prv.erl b/_checkouts/configure_deps/src/configure_deps_prv.erl index f4333e4f0..91f2a3adc 100644 --- a/_checkouts/configure_deps/src/configure_deps_prv.erl +++ b/_checkouts/configure_deps/src/configure_deps_prv.erl @@ -19,7 +19,7 @@ init(State) -> {example, "rebar3 configure-deps"}, % How to use the plugin {opts, []}, % list of options understood by the plugin {short_desc, "Explicitly run ./configure for dependencies"}, - {desc, "A rebar plugin to allow explicitly running ./configure on depdendencies. Useful if dependencies might change prior to compilation when configure is run."} + {desc, "A rebar plugin to allow explicitly running ./configure on dependencies. Useful if dependencies might change prior to compilation when configure is run."} ]), {ok, rebar_state:add_provider(State, Provider)}. diff --git a/config/runtime.exs b/config/runtime.exs index 050eae8b0..ad8c6bdc9 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,12 +1,18 @@ import Config -rootpath = System.get_env("RELEASE_ROOT", "") - -# This is standard path in the context of ejabberd release -config :ejabberd, - file: Path.join(rootpath, "etc/ejabberd/ejabberd.yml"), - log_path: Path.join(rootpath, 'var/log/ejabberd/ejabberd.log') - -# Customize Mnesia directory: -config :mnesia, - dir: Path.join(rootpath, 'var/lib/ejabberd/') +case System.get_env("RELIVE", "false") do + "true" -> + rootpath = System.get_env("RELEASE_ROOT", "_build/relive") + config :ejabberd, + file: Path.join(rootpath, "conf/ejabberd.yml"), + log_path: Path.join(rootpath, 'logs/ejabberd.log') + config :mnesia, + dir: Path.join(rootpath, 'database/') + "false" -> + rootpath = System.get_env("RELEASE_ROOT", "") + config :ejabberd, + file: Path.join(rootpath, "etc/ejabberd/ejabberd.yml"), + log_path: Path.join(rootpath, 'var/log/ejabberd/ejabberd.log') + config :mnesia, + dir: Path.join(rootpath, 'var/lib/ejabberd/') +end diff --git a/configure.ac b/configure.ac index 1b0500e0d..864a042f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.53) +AC_PREREQ(2.59) AC_INIT(ejabberd, m4_esyscmd([echo `git describe --tags 2>/dev/null || echo 0.0` | sed 's/-g.*//;s/-/./' | tr -d '\012']), [ejabberd@process-one.net], [ejabberd]) REQUIRE_ERLANG_MIN="8.3 (Erlang/OTP 19.3)" REQUIRE_ERLANG_MAX="100.0.0 (No Max)" @@ -19,8 +19,7 @@ fi # Checks Erlang runtime and compiler AC_ARG_WITH(erlang, - AC_HELP_STRING([--with-erlang=dir], - [search for erlang in dir]), + AS_HELP_STRING([--with-erlang=dir],[search for erlang in dir]), [if test "$withval" = "yes" -o "$withval" = "no" -o "X$with_erlang" = "X"; then extra_erl_path="" else @@ -29,8 +28,7 @@ fi ]) AC_ARG_WITH(rebar, - AC_HELP_STRING([--with-rebar=bin], - [use the rebar/rebar3/mix binary specified]), + AS_HELP_STRING([--with-rebar=bin],[use the rebar/rebar3/mix binary specified]), [if test "$withval" = "yes" -o "$withval" = "no" -o "X$with_rebar" = "X"; then rebar="rebar" else @@ -70,15 +68,15 @@ AC_CONFIG_FILES([Makefile vars.config]) AC_ARG_ENABLE(all, -[AC_HELP_STRING([--enable-all], [same as --enable-odbc --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-redis --enable-elixir --enable-stun --enable-sip --enable-debug --enable-lua --enable-tools (useful for Dialyzer checks, default: no)])], +[AS_HELP_STRING([--enable-all],[same as --enable-odbc --enable-mssql --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-redis --enable-elixir --enable-stun --enable-sip --enable-debug --enable-lua --enable-tools (useful for Dialyzer checks, default: no)])], [case "${enableval}" in - yes) odbc=true mysql=true pgsql=true sqlite=true pam=true zlib=true redis=true elixir=true stun=true sip=true debug=true lua=true tools=true ;; - no) odbc=false mysql=false pgsql=false sqlite=false pam=false zlib=false redis=false elixir=false stun=false sip=false debug=false lua=false tools=false ;; + yes) odbc=true mssql=true mysql=true pgsql=true sqlite=true pam=true zlib=true redis=true elixir=true stun=true sip=true debug=true lua=true tools=true ;; + no) odbc=false mssql=false mysql=false pgsql=false sqlite=false pam=false zlib=false redis=false elixir=false stun=false sip=false debug=false lua=false tools=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;; esac],[]) AC_ARG_ENABLE(debug, -[AC_HELP_STRING([--enable-debug], [enable debug information (default: yes)])], +[AS_HELP_STRING([--enable-debug],[enable debug information (default: yes)])], [case "${enableval}" in yes) debug=true ;; no) debug=false ;; @@ -86,7 +84,7 @@ AC_ARG_ENABLE(debug, esac],[if test "x$debug" = "x"; then debug=true; fi]) AC_ARG_ENABLE(elixir, -[AC_HELP_STRING([--enable-elixir], [enable Elixir support (default: no)])], +[AS_HELP_STRING([--enable-elixir],[enable Elixir support (default: no)])], [case "${enableval}" in yes) elixir=true ;; no) elixir=false ;; @@ -94,8 +92,7 @@ AC_ARG_ENABLE(elixir, esac],[if test "x$elixir" = "x"; then elixir=false; fi]) AC_ARG_ENABLE(erlang-version-check, -[AC_HELP_STRING([--enable-erlang-version-check], - [Check Erlang/OTP version (default: yes)])]) +[AS_HELP_STRING([--enable-erlang-version-check],[Check Erlang/OTP version (default: yes)])]) case "$enable_erlang_version_check" in yes|'') ERLANG_VERSION_CHECK([$REQUIRE_ERLANG_MIN],[$REQUIRE_ERLANG_MAX]) @@ -106,7 +103,7 @@ case "$enable_erlang_version_check" in esac AC_ARG_ENABLE(full_xml, -[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])], +[AS_HELP_STRING([--enable-full-xml],[use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])], [case "${enableval}" in yes) full_xml=true ;; no) full_xml=false ;; @@ -128,7 +125,7 @@ if test "$ENABLEGROUP" != ""; then fi AC_ARG_ENABLE(latest_deps, -[AC_HELP_STRING([--enable-latest-deps], [makes rebar use latest commits for dependencies instead of tagged versions (default: no)])], +[AS_HELP_STRING([--enable-latest-deps],[makes rebar use latest commits for dependencies instead of tagged versions (default: no)])], [case "${enableval}" in yes) latest_deps=true ;; no) latest_deps=false ;; @@ -136,7 +133,7 @@ AC_ARG_ENABLE(latest_deps, esac],[if test "x$latest_deps" = "x"; then latest_deps=false; fi]) AC_ARG_ENABLE(lua, -[AC_HELP_STRING([--enable-lua], [enable Lua support, to import from Prosody (default: no)])], +[AS_HELP_STRING([--enable-lua],[enable Lua support, to import from Prosody (default: no)])], [case "${enableval}" in yes) lua=true ;; no) lua=false ;; @@ -144,15 +141,15 @@ AC_ARG_ENABLE(lua, esac],[if test "x$lua" = "x"; then lua=false; fi]) AC_ARG_ENABLE(mssql, -[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])], +[AS_HELP_STRING([--enable-mssql],[use Microsoft SQL Server database (default: no, requires --enable-odbc)])], [case "${enableval}" in - yes) db_type=mssql; mssql=true ;; - no) db_type=generic; mssql=false ;; + yes) mssql=true ;; + no) mssql=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;; -esac],[db_type=generic]) +esac],[if test "x$mssql" = "x"; then mssql=false; fi]) AC_ARG_ENABLE(mysql, -[AC_HELP_STRING([--enable-mysql], [enable MySQL support (default: no)])], +[AS_HELP_STRING([--enable-mysql],[enable MySQL support (default: no)])], [case "${enableval}" in yes) mysql=true ;; no) mysql=false ;; @@ -160,7 +157,7 @@ AC_ARG_ENABLE(mysql, esac],[if test "x$mysql" = "x"; then mysql=false; fi]) AC_ARG_ENABLE(new_sql_schema, -[AC_HELP_STRING([--enable-new-sql-schema], [use new SQL schema (default: no)])], +[AS_HELP_STRING([--enable-new-sql-schema],[use new SQL schema by default (default: no)])], [case "${enableval}" in yes) new_sql_schema=true ;; no) new_sql_schema=false ;; @@ -168,7 +165,7 @@ AC_ARG_ENABLE(new_sql_schema, esac],[new_sql_schema=false]) AC_ARG_ENABLE(odbc, -[AC_HELP_STRING([--enable-odbc], [enable pure ODBC support (default: no)])], +[AS_HELP_STRING([--enable-odbc],[enable pure ODBC support (default: no)])], [case "${enableval}" in yes) odbc=true ;; no) odbc=false ;; @@ -176,7 +173,7 @@ AC_ARG_ENABLE(odbc, esac],[if test "x$odbc" = "x"; then odbc=false; fi]) AC_ARG_ENABLE(pam, -[AC_HELP_STRING([--enable-pam], [enable PAM support (default: no)])], +[AS_HELP_STRING([--enable-pam],[enable PAM support (default: no)])], [case "${enableval}" in yes) pam=true ;; no) pam=false ;; @@ -184,7 +181,7 @@ AC_ARG_ENABLE(pam, esac],[if test "x$pam" = "x"; then pam=false; fi]) AC_ARG_ENABLE(pgsql, -[AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL support (default: no)])], +[AS_HELP_STRING([--enable-pgsql],[enable PostgreSQL support (default: no)])], [case "${enableval}" in yes) pgsql=true ;; no) pgsql=false ;; @@ -192,7 +189,7 @@ AC_ARG_ENABLE(pgsql, esac],[if test "x$pgsql" = "x"; then pgsql=false; fi]) AC_ARG_ENABLE(redis, -[AC_HELP_STRING([--enable-redis], [enable Redis support (default: no)])], +[AS_HELP_STRING([--enable-redis],[enable Redis support (default: no)])], [case "${enableval}" in yes) redis=true ;; no) redis=false ;; @@ -200,7 +197,7 @@ AC_ARG_ENABLE(redis, esac],[if test "x$redis" = "x"; then redis=false; fi]) AC_ARG_ENABLE(roster_gateway_workaround, -[AC_HELP_STRING([--enable-roster-gateway-workaround], [turn on workaround for processing gateway subscriptions (default: no)])], +[AS_HELP_STRING([--enable-roster-gateway-workaround],[turn on workaround for processing gateway subscriptions (default: no)])], [case "${enableval}" in yes) roster_gateway_workaround=true ;; no) roster_gateway_workaround=false ;; @@ -208,7 +205,7 @@ AC_ARG_ENABLE(roster_gateway_workaround, esac],[roster_gateway_workaround=false]) AC_ARG_ENABLE(sip, -[AC_HELP_STRING([--enable-sip], [enable SIP support (default: no)])], +[AS_HELP_STRING([--enable-sip],[enable SIP support (default: no)])], [case "${enableval}" in yes) sip=true ;; no) sip=false ;; @@ -216,7 +213,7 @@ AC_ARG_ENABLE(sip, esac],[if test "x$sip" = "x"; then sip=false; fi]) AC_ARG_ENABLE(sqlite, -[AC_HELP_STRING([--enable-sqlite], [enable SQLite support (default: no)])], +[AS_HELP_STRING([--enable-sqlite],[enable SQLite support (default: no)])], [case "${enableval}" in yes) sqlite=true ;; no) sqlite=false ;; @@ -224,7 +221,7 @@ AC_ARG_ENABLE(sqlite, esac],[if test "x$sqlite" = "x"; then sqlite=false; fi]) AC_ARG_ENABLE(stun, -[AC_HELP_STRING([--enable-stun], [enable STUN/TURN support (default: yes)])], +[AS_HELP_STRING([--enable-stun],[enable STUN/TURN support (default: yes)])], [case "${enableval}" in yes) stun=true ;; no) stun=false ;; @@ -232,7 +229,7 @@ AC_ARG_ENABLE(stun, esac],[if test "x$stun" = "x"; then stun=true; fi]) AC_ARG_ENABLE(system_deps, -[AC_HELP_STRING([--enable-system-deps], [makes rebar use locally installed dependencies instead of downloading them (default: no)])], +[AS_HELP_STRING([--enable-system-deps],[makes rebar use locally installed dependencies instead of downloading them (default: no)])], [case "${enableval}" in yes) system_deps=true ;; no) system_deps=false ;; @@ -240,7 +237,7 @@ AC_ARG_ENABLE(system_deps, esac],[if test "x$system_deps" = "x"; then system_deps=false; fi]) AC_ARG_ENABLE(tools, -[AC_HELP_STRING([--enable-tools], [build development tools (default: no)])], +[AS_HELP_STRING([--enable-tools],[build development tools (default: no)])], [case "${enableval}" in yes) tools=true ;; no) tools=false ;; @@ -262,7 +259,7 @@ if test "$ENABLEUSER" != ""; then fi AC_ARG_ENABLE(zlib, -[AC_HELP_STRING([--enable-zlib], [enable Stream Compression (XEP-0138) using zlib (default: yes)])], +[AS_HELP_STRING([--enable-zlib],[enable Stream Compression (XEP-0138) using zlib (default: yes)])], [case "${enableval}" in yes) zlib=true ;; no) zlib=false ;; @@ -286,8 +283,8 @@ esac AC_SUBST(roster_gateway_workaround) AC_SUBST(new_sql_schema) AC_SUBST(full_xml) -AC_SUBST(db_type) AC_SUBST(odbc) +AC_SUBST(mssql) AC_SUBST(mysql) AC_SUBST(pgsql) AC_SUBST(sqlite) diff --git a/ejabberdctl.template b/ejabberdctl.template index 408a4fe6d..7f0e0c96d 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -68,7 +68,6 @@ done [ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH" [ -n "$ERLANG_NODE_ARG" ] && ERLANG_NODE="$ERLANG_NODE_ARG" [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && S="-s" -: "${EJABBERD_DOC_PATH:="{{docdir}}"}" : "${EJABBERD_LOG_PATH:="$LOGS_DIR/ejabberd.log"}" # define erl parameters @@ -98,7 +97,6 @@ EJABBERD_OPTS="-mnesia dir \"$SPOOL_DIR\" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejab # export global variables export EJABBERD_CONFIG_PATH export EJABBERD_LOG_PATH -export EJABBERD_DOC_PATH export EJABBERD_PID_PATH export ERL_CRASH_DUMP export ERL_EPMD_ADDRESS @@ -181,12 +179,18 @@ help() { echo "" echo "Commands to start an ejabberd node:" - echo " start Start an ejabberd node in server mode" - echo " debug Attach an interactive Erlang shell to a running ejabberd node" - echo " iexdebug Attach an interactive Elixir shell to a running ejabberd node" - echo " live Start an ejabberd node in live (interactive) mode" - echo " iexlive Start an ejabberd node in live (interactive) mode, within an Elixir shell" - echo " foreground Start an ejabberd node in server mode (attached)" + echo " start Start in server mode" + echo " foreground Start in server mode (attached)" + echo " foreground-quiet Start in server mode (attached), show only critical messages" + echo " live Start in interactive mode, with Erlang shell" + echo " iexlive Start in interactive mode, with Elixir shell" + echo "" + echo "Commands to interact with a running ejabberd node:" + echo " debug Attach an interactive Erlang shell to a running node" + echo " iexdebug Attach an interactive Elixir shell to a running node" + echo " etop Attach to a running node and start Erlang Top" + echo " ping Send ping to the node, returns pong or pang" + echo " started|stopped Wait for the node to fully start|stop" echo "" echo "Optional parameters when starting an ejabberd node:" echo " --config-dir dir Config ejabberd: $ETC_DIR" diff --git a/include/adhoc.hrl b/include/adhoc.hrl index 2047db874..aa784d9b0 100644 --- a/include/adhoc.hrl +++ b/include/adhoc.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/bosh.hrl b/include/bosh.hrl index ca43a569b..e02675ed0 100644 --- a/include/bosh.hrl +++ b/include/bosh.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_auth.hrl b/include/ejabberd_auth.hrl index 00f31cfd3..a29b2cc29 100644 --- a/include/ejabberd_auth.hrl +++ b/include/ejabberd_auth.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_commands.hrl b/include/ejabberd_commands.hrl index d0f5ba70a..9009f7bb2 100644 --- a/include/ejabberd_commands.hrl +++ b/include/ejabberd_commands.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_config.hrl b/include/ejabberd_config.hrl index 555d998b7..c9805a3da 100644 --- a/include/ejabberd_config.hrl +++ b/include/ejabberd_config.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_ctl.hrl b/include/ejabberd_ctl.hrl index e962e85be..37935ebe2 100644 --- a/include/ejabberd_ctl.hrl +++ b/include/ejabberd_ctl.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_http.hrl b/include/ejabberd_http.hrl index 62e19a8f0..92dfd870e 100644 --- a/include/ejabberd_http.hrl +++ b/include/ejabberd_http.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_oauth.hrl b/include/ejabberd_oauth.hrl index d9a5a09de..7e7509454 100644 --- a/include/ejabberd_oauth.hrl +++ b/include/ejabberd_oauth.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_sm.hrl b/include/ejabberd_sm.hrl index 92e85ae03..d5286d793 100644 --- a/include/ejabberd_sm.hrl +++ b/include/ejabberd_sm.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_sql.hrl b/include/ejabberd_sql.hrl index 2d9ac03ec..cfa238b48 100644 --- a/include/ejabberd_sql.hrl +++ b/include/ejabberd_sql.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_sql_pt.hrl b/include/ejabberd_sql_pt.hrl index 07479d440..fd61bdd03 100644 --- a/include/ejabberd_sql_pt.hrl +++ b/include/ejabberd_sql_pt.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_stacktrace.hrl b/include/ejabberd_stacktrace.hrl index cc07c6eab..2d8fc6e43 100644 --- a/include/ejabberd_stacktrace.hrl +++ b/include/ejabberd_stacktrace.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/ejabberd_web_admin.hrl b/include/ejabberd_web_admin.hrl index 25df7f0c0..99f27f8de 100644 --- a/include/ejabberd_web_admin.hrl +++ b/include/ejabberd_web_admin.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/eldap.hrl b/include/eldap.hrl index db4f5428a..0787d1f98 100644 --- a/include/eldap.hrl +++ b/include/eldap.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/http_bind.hrl b/include/http_bind.hrl index a94379ee0..8a5ceb8ab 100644 --- a/include/http_bind.hrl +++ b/include/http_bind.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/logger.hrl b/include/logger.hrl index d69ff0d07..ed62f3607 100644 --- a/include/logger.hrl +++ b/include/logger.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_announce.hrl b/include/mod_announce.hrl index 9c7647272..498dce8d0 100644 --- a/include/mod_announce.hrl +++ b/include/mod_announce.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_caps.hrl b/include/mod_caps.hrl index aa5287069..4bf404837 100644 --- a/include/mod_caps.hrl +++ b/include/mod_caps.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_last.hrl b/include/mod_last.hrl index 6b2ae7d78..aed9bdc6f 100644 --- a/include/mod_last.hrl +++ b/include/mod_last.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_mam.hrl b/include/mod_mam.hrl index 494c4bd5a..27c892abe 100644 --- a/include/mod_mam.hrl +++ b/include/mod_mam.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_muc.hrl b/include/mod_muc.hrl index e31e01be0..ea096c9fe 100644 --- a/include/mod_muc.hrl +++ b/include/mod_muc.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_muc_room.hrl b/include/mod_muc_room.hrl index cc00f73c8..56eddeaa4 100644 --- a/include/mod_muc_room.hrl +++ b/include/mod_muc_room.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_offline.hrl b/include/mod_offline.hrl index 8b78f2e16..ba04f9b87 100644 --- a/include/mod_offline.hrl +++ b/include/mod_offline.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_privacy.hrl b/include/mod_privacy.hrl index 1f481eec8..99cd2310d 100644 --- a/include/mod_privacy.hrl +++ b/include/mod_privacy.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_private.hrl b/include/mod_private.hrl index 1c551a212..14e3bc8e3 100644 --- a/include/mod_private.hrl +++ b/include/mod_private.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_proxy65.hrl b/include/mod_proxy65.hrl index be2797bca..13f4d8c6a 100644 --- a/include/mod_proxy65.hrl +++ b/include/mod_proxy65.hrl @@ -2,7 +2,7 @@ %%% RFC 1928 constants. %%% %%% -%%% 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/include/mod_push.hrl b/include/mod_push.hrl index 9ad1e0405..161b68bdf 100644 --- a/include/mod_push.hrl +++ b/include/mod_push.hrl @@ -1,5 +1,5 @@ %%%---------------------------------------------------------------------- -%%% 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/include/mod_roster.hrl b/include/mod_roster.hrl index 27d2aab28..6ec05b3da 100644 --- a/include/mod_roster.hrl +++ b/include/mod_roster.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_shared_roster.hrl b/include/mod_shared_roster.hrl index 515243862..a18d37414 100644 --- a/include/mod_shared_roster.hrl +++ b/include/mod_shared_roster.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_vcard.hrl b/include/mod_vcard.hrl index 24b219ec5..14f8380b8 100644 --- a/include/mod_vcard.hrl +++ b/include/mod_vcard.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mod_vcard_xupdate.hrl b/include/mod_vcard_xupdate.hrl index 9b5bfac30..16e1d7bfc 100644 --- a/include/mod_vcard_xupdate.hrl +++ b/include/mod_vcard_xupdate.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/include/mqtt.hrl b/include/mqtt.hrl index 4d3ff5672..6458a1234 100644 --- a/include/mqtt.hrl +++ b/include/mqtt.hrl @@ -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/include/pubsub.hrl b/include/pubsub.hrl index da919e9e2..1811aa926 100644 --- a/include/pubsub.hrl +++ b/include/pubsub.hrl @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/man/ejabberd.yml.5 b/man/ejabberd.yml.5 index 8fb59c381..48c4509f4 100644 --- a/man/ejabberd.yml.5 +++ b/man/ejabberd.yml.5 @@ -52,7 +52,7 @@ YAML is indentation sensitive, so make sure you respect indentation, or otherwis .sp .5v .RE .sp -Logically, configuration options are splitted into 3 main categories: \fIModules\fR, \fIListeners\fR and everything else called \fITop Level\fR options\&. Thus this document is splitted into 3 main chapters describing each category separately\&. So, the contents of ejabberd\&.yml will typically look like this: +Logically, configuration options are split into 3 main categories: \fIModules\fR, \fIListeners\fR and everything else called \fITop Level\fR options\&. Thus this document is split into 3 main chapters describing each category separately\&. So, the contents of ejabberd\&.yml will typically look like this: .sp .if n \{\ .RS 4 @@ -443,7 +443,7 @@ The option defines in what format the users passwords are stored: .PP \fBauth_scram_hash\fR: \fIsha | sha256 | sha512\fR .RS 4 -Hash algorith that should be used to store password in SCRAM format\&. You shouldn\(cqt 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 +Hash algorithm that should be used to store password in SCRAM format\&. You shouldn\(cqt 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 \fIsha\fR\&. .RE .PP @@ -525,7 +525,7 @@ Whether to enable or disable TLS compression for c2s connections\&. The default Path to a file of CA root certificates\&. The default is to use system defined file if possible\&. .RE .sp -For server conections, this \fIca_file\fR option is overriden by the s2s_cafile option\&. +For server connections, this \fIca_file\fR option is overridden by the s2s_cafile option\&. .PP \fBcache_life_time\fR: \fItimeout()\fR .RS 4 @@ -2066,7 +2066,7 @@ The module depends on \fImod_vcard\fR, \fImod_vcard_xupdate\fR and \fImod_pubsub .PP \fBconvert\fR: \fI{From: To}\fR .RS 4 -Defines image convertion rules: the format in +Defines image conversion rules: the format in \fIFrom\fR will be converted to format in \fITo\fR\&. The value of @@ -2091,7 +2091,7 @@ convert: .PP \fBrate_limit\fR: \fINumber\fR .RS 4 -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 +Limit any given JID by the number of avatars it is able to convert per minute\&. This is to protect the server from image conversion DoS\&. The default value is \fI10\fR\&. .RE .RE @@ -5414,7 +5414,7 @@ plugin handles the default behaviour and follows standard XEP\-0060 implementati .IP \(bu 2.3 .\} \fIpep\fR -plugin adds extention to handle Personal Eventing Protocol (XEP\-0163) to the PubSub engine\&. Adding pep allows to handle PEP automatically\&. +plugin adds extension to handle Personal Eventing Protocol (XEP\-0163) to the PubSub engine\&. Adding pep allows to handle PEP automatically\&. .RE .RE .PP @@ -7397,4 +7397,4 @@ Configuration Guide: https://docs\&.ejabberd\&.im/admin/configuration Source code: https://github\&.com/processone/ejabberd .SH "COPYING" .sp -Copyright (c) 2002\-2021 ProcessOne\&. +Copyright (c) 2002\-2022 ProcessOne\&. @@ -5,7 +5,7 @@ defmodule Ejabberd.MixProject do [app: :ejabberd, version: version(), description: description(), - elixir: "~> 1.4", + elixir: elixir_required_version(), elixirc_paths: ["lib"], compile_path: ".", compilers: [:asn1] ++ Mix.compilers, @@ -26,9 +26,9 @@ defmodule Ejabberd.MixProject do '0.0' -> "0.0.0" # the full git repository wasn't downloaded 'latest.0' -> "0.0.0" # running 'docker-ejabberd/ecs/build.sh latest' [_, _, ?., _, _] = x -> - head = String.replace(:erlang.list_to_binary(x), ~r/0+([0-9])/, "\\1") + head = String.replace(:erlang.list_to_binary(x), ~r/\.0+([0-9])/, ".\\1") <<head::binary, ".0">> - vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/0+([0-9])/, "\\1") + vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/\.0+([0-9])/, ".\\1") end end @@ -43,22 +43,13 @@ defmodule Ejabberd.MixProject do extra_applications: [:mix], applications: [:idna, :inets, :kernel, :sasl, :ssl, :stdlib, :base64url, :fast_tls, :fast_xml, :fast_yaml, :jiffy, :jose, - :p1_utils, :stringprep, :stun, :yconf], - included_applications: [:lager, :mnesia, :os_mon, - :cache_tab, :eimp, :esip, :mqtree, :p1_acme, + :p1_utils, :stringprep, :yconf], + included_applications: [:mnesia, :os_mon, + :cache_tab, :eimp, :mqtree, :p1_acme, :p1_oauth2, :pkix, :xmpp] ++ cond_apps()] end - defp if_function_exported(mod, fun, arity, okResult) do - :code.ensure_loaded(mod) - if :erlang.function_exported(mod, fun, arity) do - okResult - else - [] - end - end - defp if_version_above(ver, okResult) do if :erlang.system_info(:otp_release) > ver do okResult @@ -78,18 +69,19 @@ defmodule Ejabberd.MixProject do defp erlc_options do # Use our own includes + includes from all dependencies includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"]) - result = [:debug_info, {:d, :ELIXIR_ENABLED}] ++ + result = [{:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn (path) -> {:i, path} end) ++ if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++ + if_version_above('20', [{:d, :HAVE_URI_STRING}]) ++ + if_version_above('20', [{:d, :HAVE_ERL_ERROR}]) ++ if_version_below('21', [{:d, :USE_OLD_HTTP_URI}]) ++ if_version_below('22', [{:d, :LAGER}]) ++ + if_version_below('21', [{:d, :NO_CUSTOMIZE_HOSTNAME_CHECK}]) ++ if_version_below('23', [{:d, :USE_OLD_CRYPTO_HMAC}]) ++ if_version_below('23', [{:d, :USE_OLD_PG2}]) ++ if_version_below('24', [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++ - if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++ - if_function_exported(:uri_string, :normalize, 1, [{:d, :HAVE_URI_STRING}]) - if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}]) + if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) defines = for {:d, value} <- result, do: {:d, value} result ++ [{:d, :ALL_DEFS, defines}] end @@ -97,7 +89,9 @@ defmodule Ejabberd.MixProject do defp cond_options do for {:true, option} <- [{config(:sip), {:d, :SIP}}, {config(:stun), {:d, :STUN}}, - {config(:roster_gateway_workaround), {:d, :ROSTER_GATWAY_WORKAROUND}}, + {config(:debug), :debug_info}, + {not config(:debug), {:debug_info, false}}, + {config(:roster_gateway_workaround), {:d, :ROSTER_GATEWAY_WORKAROUND}}, {config(:new_sql_schema), {:d, :NEW_SQL_SCHEMA}} ], do: option @@ -106,26 +100,19 @@ defmodule Ejabberd.MixProject do defp deps do [{:base64url, "~> 1.0"}, {:cache_tab, "~> 1.0"}, - {:distillery, "~> 2.0"}, {:eimp, "~> 1.0"}, - {:esip, "~> 1.0"}, - {:ex_doc, ">= 0.0.0", only: :dev}, {:fast_tls, "~> 1.1"}, {:fast_xml, "~> 1.1"}, {:fast_yaml, "~> 1.0"}, {:idna, "~> 6.0"}, - {:jiffy, "~> 1.0.5"}, + {:jiffy, "~> 1.1.1"}, {:jose, "~> 1.11.1"}, - {:lager, "~> 3.9.1"}, {:mqtree, "~> 1.0"}, {:p1_acme, "~> 1.0"}, - {:p1_mysql, "~> 1.0"}, {:p1_oauth2, "~> 0.6"}, - {:p1_pgsql, "~> 1.1"}, {:p1_utils, "~> 1.0"}, {:pkix, "~> 1.0"}, {:stringprep, ">= 1.0.26"}, - {:stun, "~> 1.0"}, {:xmpp, "~> 1.5"}, {:yconf, "~> 1.0"}] ++ cond_deps() @@ -146,15 +133,24 @@ defmodule Ejabberd.MixProject do defp cond_deps do for {:true, dep} <- [{config(:pam), {:epam, "~> 1.0"}}, {config(:redis), {:eredis, "~> 1.2.0"}}, + {config(:sip), {:esip, "~> 1.0"}}, {config(:zlib), {:ezlib, "~> 1.0"}}, + {if_version_below('22', true), {:lager, "~> 3.9.1"}}, {config(:lua), {:luerl, "~> 1.0"}}, - {config(:sqlite), {:sqlite3, "~> 1.1"}}], do: + {config(:mysql), {:p1_mysql, "~> 1.0"}}, + {config(:pgsql), {:p1_pgsql, "~> 1.1"}}, + {config(:sqlite), {:sqlite3, "~> 1.1"}}, + {config(:stun), {:stun, "~> 1.0"}}], do: dep end defp cond_apps do - for {:true, app} <- [{config(:redis), :eredis}, + for {:true, app} <- [{config(:pam), :epam}, + {config(:lua), :luerl}, + {config(:redis), :eredis}, + {if_version_below('22', true), :lager}, {config(:mysql), :p1_mysql}, + {config(:sip), :esip}, {config(:odbc), :odbc}, {config(:pgsql), :p1_pgsql}, {config(:sqlite), :sqlite3}], do: @@ -188,6 +184,35 @@ defmodule Ejabberd.MixProject do end end + defp elixir_required_version do + case {System.get_env("RELIVE", "false"), + MapSet.member?(MapSet.new(System.argv()), "release")} + do + {"true", _} -> + case Version.match?(System.version(), "~> 1.11") do + false -> + IO.puts("ERROR: To use 'make relive', Elixir 1.11.0 or higher is required.") + _ -> :ok + end + "~> 1.11" + {_, true} -> + case Version.match?(System.version(), "~> 1.10") do + false -> + IO.puts("ERROR: To build releases, Elixir 1.10.0 or higher is required.") + _ -> :ok + end + case Version.match?(System.version(), "< 1.11.4") + and :erlang.system_info(:otp_release) > '23' do + true -> + IO.puts("ERROR: To build releases with Elixir lower than 1.11.4, Erlang/OTP lower than 24 is required.") + _ -> :ok + end + "~> 1.10" + _ -> + "~> 1.4" + end + end + defp releases do maybe_tar = case Mix.env() do :prod -> [:tar] @@ -232,7 +257,7 @@ defmodule Ejabberd.MixProject do end # Mix/Elixir lower than 1.11.0 use config/releases.exs instead of runtime.exs - case Version.match?(System.version, ">= 1.11.0") do + case Version.match?(System.version, "~> 1.11") do true -> :ok false -> @@ -244,9 +269,10 @@ defmodule Ejabberd.MixProject do execute.("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.example2> ejabberdctl.example2a") Mix.Generator.copy_template("ejabberdctl.example2a", "ejabberdctl.example2b", assigns) execute.("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.example2b > ejabberdctl.example3") - execute.("sed -e 's|ERLANG_NODE=ejabberd@localhost|ERLANG_NODE=ejabberd|g' ejabberdctl.example3 > ejabberdctl.example4") - execute.("sed -e 's|INSTALLUSER=|ERL_OPTIONS=\"-setcookie \\$\\(cat \"\\${SCRIPT_DIR%/*}/releases/COOKIE\")\"\\nINSTALLUSER=|g' ejabberdctl.example4 > ejabberdctl.example5") - Mix.Generator.copy_template("ejabberdctl.example5", "#{ro}/bin/ejabberdctl", assigns) + execute.("sed -e 's|^ERLANG_NODE=ejabberd@localhost|ERLANG_NODE=ejabberd|g' ejabberdctl.example3 > ejabberdctl.example4") + execute.("sed -e 's|^ERLANG_OPTS=\"|ERLANG_OPTS=\"-boot ../releases/#{release.version}/start_clean -boot_var RELEASE_LIB ../lib |' ejabberdctl.example4 > ejabberdctl.example5") + execute.("sed -e 's|^INSTALLUSER=|ERL_OPTIONS=\"-setcookie \\$\\(cat \"\\${SCRIPT_DIR%/*}/releases/COOKIE\")\"\\nINSTALLUSER=|g' ejabberdctl.example5 > ejabberdctl.example6") + Mix.Generator.copy_template("ejabberdctl.example6", "#{ro}/bin/ejabberdctl", assigns) File.chmod("#{ro}/bin/ejabberdctl", 0o755) File.rm("ejabberdctl.example1") @@ -256,6 +282,7 @@ defmodule Ejabberd.MixProject do File.rm("ejabberdctl.example3") File.rm("ejabberdctl.example4") File.rm("ejabberdctl.example5") + File.rm("ejabberdctl.example6") suffix = case Mix.env() do :dev -> @@ -268,7 +295,6 @@ defmodule Ejabberd.MixProject do Mix.Generator.copy_file("ejabberd.yml.example", "#{ro}/etc/ejabberd/ejabberd.yml#{suffix}") Mix.Generator.copy_file("ejabberdctl.cfg.example", "#{ro}/etc/ejabberd/ejabberdctl.cfg#{suffix}") Mix.Generator.copy_file("inetrc", "#{ro}/etc/ejabberd/inetrc") - Mix.Generator.copy_template("rel/vm.args.mix", "#{ro}/etc/ejabberd/vm.args", assigns) Enum.each(File.ls!("sql"), fn x -> @@ -1,33 +1,26 @@ %{ - "artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"}, "base64url": {:hex, :base64url, "1.0.1", "f8c7f2da04ca9a5d0f5f50258f055e1d699f0e8bf4cfdb30b750865368403cf6", [:rebar3], [], "hexpm", "f9b3add4731a02a9b0410398b475b33e7566a695365237a6bdee1bb447719f5c"}, "cache_tab": {:hex, :cache_tab, "1.0.29", "6c161988620b788d8df28c8f6af557571609c8e4b671dbadab295a4722cd501b", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "a02a638021cce91ed1a8628dcbb4795bf5c01c9d11db8c613065923142824ce9"}, - "distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.17", "6f3c7e94170377ba45241d394389e800fb15adc5de51d0a3cd52ae766aafd63f", [:mix], [], "hexpm", "f93ac89c9feca61c165b264b5837bf82344d13bebc634cd575cb711e2e342023"}, "eimp": {:hex, :eimp, "1.0.21", "2e918a5dc9a1959ef8713a2360499e3baeee64cfd7881bd9d1f361ca9ddf07e8", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "998f58538f58aa0cff103414994d7ce56dc253e6576cd6fb40c1ead64aa73a28"}, "epam": {:hex, :epam, "1.0.12", "2a5625d4133bca4b3943791a3f723ba764455a461ae9b6ba5debb262efcf4b40", [:rebar3], [], "hexpm", "54c166c4459cef72f2990a3d89a8f0be27180fe0ab0f24b28ddcc3b815f49f7f"}, + "eredis": {:hex, :eredis, "1.2.0", "0b8e9cfc2c00fa1374cd107ea63b49be08d933df2cf175e6a89b73dd9c380de4", [:rebar3], [], "hexpm", "d9b5abef2c2c8aba8f32aa018203e0b3dc8b1157773b254ab1d4c2002317f1e1"}, "esip": {:hex, :esip, "1.0.45", "2f21fb9750f7a505e6bbd43f6d48b0e879b808aba6c2224686c83f2bcd7a34bf", [:rebar3], [{:fast_tls, "1.1.13", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}, {:stun, "1.0.47", [hex: :stun, repo: "hexpm", optional: false]}], "hexpm", "1f1eae69f2bd8d75f42c048409eabb4e3dc71ab6412fc5d998edbdade6ad5f75"}, - "ex_doc": {:hex, :ex_doc, "0.26.0", "1922164bac0b18b02f84d6f69cab1b93bc3e870e2ad18d5dacb50a9e06b542a3", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2775d66e494a9a48355db7867478ffd997864c61c65a47d31c4949459281c78d"}, "ezlib": {:hex, :ezlib, "1.0.10", "c1c24eb18944cfde55f0574e9922d5b0392fa864282f769f82b2ea15e54f6003", [:rebar3], [], "hexpm", "1d317f1d85373686199eb3b4164d3477e95033ac68e45a95ba18e7b7a8c23241"}, "fast_tls": {:hex, :fast_tls, "1.1.13", "828cdc75e1e8fce8158846d2b971d8b4fe2b2ddcc75b759e88d751079bf78afd", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "d1f422af40c7777fe534496f508ee86515cb929ad10f7d1d56aa94ce899b44a0"}, "fast_xml": {:hex, :fast_xml, "1.1.48", "d41d14015227999a2367264cc97ac1e6770285aab1dc69545ac4f822be01a2d2", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "afcf9b808c77599395d4bd22ed4560b3d82aa1a24ff5b65f3930fe72a423b3cf"}, "fast_yaml": {:hex, :fast_yaml, "1.0.32", "43f53a2c8572f2e4d66cd4e787fc6761b1c65b9132e42c511d8b9540b0989d65", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "7258e322739ff0824237ebe44cd158e0bf52cd27a15fe731cf92f4b4c70b913e"}, - "goldrush": {:hex, :goldrush, "0.1.9", "f06e5d5f1277da5c413e84d5a2924174182fb108dabb39d5ec548b27424cd106", [:rebar3], [], "hexpm", "99cb4128cffcb3227581e5d4d803d5413fa643f4eb96523f77d9e6937d994ceb"}, "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"}, - "jiffy": {:hex, :jiffy, "1.0.5", "a69b58faf7123534c20e1b0b7ae97ac52079ca02ed4b6989b4b380179cd63a54", [:rebar3], [], "hexpm", "b617a53f46ae84f20d0c38951367dc947a2cf8cff922aa5c6ac6b64b8b052289"}, + "jiffy": {:hex, :jiffy, "1.1.1", "aca10f47aa91697bf24ab9582c74e00e8e95474c7ef9f76d4f1a338d0f5de21b", [:rebar3], [], "hexpm", "62e1f0581c3c19c33a725c781dfa88410d8bff1bbafc3885a2552286b4785c4c"}, "jose": {:hex, :jose, "1.11.1", "59da64010c69aad6cde2f5b9248b896b84472e99bd18f246085b7b9fe435dcdb", [:mix, :rebar3], [], "hexpm", "078f6c9fb3cd2f4cfafc972c814261a7d1e8d2b3685c0a76eb87e158efff1ac5"}, - "lager": {:hex, :lager, "3.9.2", "4cab289120eb24964e3886bd22323cb5fefe4510c076992a23ad18cf85413d8c", [:rebar3], [{:goldrush, "0.1.9", [hex: :goldrush, repo: "hexpm", optional: false]}], "hexpm", "7f904d9e87a8cb7e66156ed31768d1c8e26eba1d54f4bc85b1aa4ac1f6340c28"}, - "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, + "luerl": {:hex, :luerl, "1.0.0", "1b68c30649323590d5339b967b419260500ffe520cd3abc1987482a82d3b5a6c", [:rebar3], [], "hexpm", "c17bc45cb4b0845ec975387f9a5d8c81ab60456698527a29c96f78992af86bd1"}, "mqtree": {:hex, :mqtree, "1.0.14", "d201a79b51a9232b80e764b4b77a866f7c30a90c7ac6205d71f391eb3ea7eb31", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "8626dac5e862b575eaf4836f0fc1be5a7c8435c378c5a309e34ee012d48b6f6e"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"}, - "p1_acme": {:hex, :p1_acme, "1.0.16", "88b84cc24c9b6eb87204ea53969ccd9b524dcd4142de632441fdd2859ccab778", [:rebar3], [{:base64url, "1.0.1", [hex: :base64url, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:jiffy, "1.0.5", [hex: :jiffy, repo: "hexpm", optional: false]}, {:jose, "1.11.1", [hex: :jose, repo: "hexpm", optional: false]}, {:yconf, "1.0.12", [hex: :yconf, repo: "hexpm", optional: false]}], "hexpm", "ec0ef380a7345c38b57899733f6fece97c337a3d44fd02cc8898f6a2491a38a8"}, + "p1_acme": {:hex, :p1_acme, "1.0.18", "3d987aabe586fd372b93b0a2604ea5b9dcf989bb0b8bf90653fb8e9b4aeea523", [:rebar3], [{:base64url, "1.0.1", [hex: :base64url, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:jiffy, "1.1.1", [hex: :jiffy, repo: "hexpm", optional: false]}, {:jose, "1.11.1", [hex: :jose, repo: "hexpm", optional: false]}, {:yconf, "1.0.12", [hex: :yconf, repo: "hexpm", optional: false]}], "hexpm", "81d757eaa5d22cdc7ea244e9d17cb8eb95ca388c2f239b8feb8b8bc927740eed"}, "p1_mysql": {:hex, :p1_mysql, "1.0.19", "22f1be58397780a7d580a954e7af66cde32a29dee1a24ab2aa196272fc654a4a", [:rebar3], [], "hexpm", "88f6cdb510e8959c14b6ae84ccda04967e3de239228f859d8341da67949622b1"}, "p1_oauth2": {:hex, :p1_oauth2, "0.6.10", "09ba1fbd447b1f480b223903e36d0415f21be592a1b00db964eea01285749028", [:rebar3], [], "hexpm", "c79cb61ababee4a8c85409b7f4932035797c093aeef1f9f53985e512b26f2a64"}, - "p1_pgsql": {:hex, :p1_pgsql, "1.1.12", "10ae79eeb35ea98c0424a8b6420542fef9e4469eb12ccf41475d10840c291e68", [:rebar3], [], "hexpm", "32203f779e01cf0353270df24833a1d831ad7cb3e3e8e35a7556dfa1f40948d5"}, + "p1_pgsql": {:hex, :p1_pgsql, "1.1.16", "0338d4c3ab42aa1d3ae312aef38f85279678d90092cfc88da899a130a9c0bf03", [:rebar3], [{:xmpp, "1.5.6", [hex: :xmpp, repo: "hexpm", optional: false]}], "hexpm", "3294d8f01115e6d0139c0959b22290d33ac21a596605b203f53a22cb7617b4b3"}, "p1_utils": {:hex, :p1_utils, "1.0.23", "7f94466ada69bd982ea7bb80fbca18e7053e7d0b82c9d9e37621fa508587069b", [:rebar3], [], "hexpm", "47f21618694eeee5006af1c88731ad86b757161e7823c29b6f73921b571c8502"}, "pkix": {:hex, :pkix, "1.0.8", "98ea05243847fd4504f7c7a0cd82cecd1010ac327a082e1c674c5384006eae75", [:rebar3], [], "hexpm", "399508819501fab9d2e586dfa601b5ee3ef22b5612d3db58204dd2d089ef45d7"}, + "sqlite3": {:hex, :sqlite3, "1.1.13", "94a6e0508936514e1493efeb9b939a9bbfa861f4b8dc93ef174ae88a1d9381d3", [:rebar3], [], "hexpm", "b77fad096d1ae9553ad8551ea75bd0d64a2f5b09923a7ca48b14215564dbfc48"}, "stringprep": {:hex, :stringprep, "1.0.27", "02808c7024bc6285ca6a8a67e7addfc16f35dda55551a582c5181d8ea960e890", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "a5967b1144ca8002a58a03d16dd109fbd0bcdb82616cead2f983944314af6a00"}, "stun": {:hex, :stun, "1.0.47", "fae94c0dc7415263297e8f07f286f3355d327d8bf78b1b0743c9a5a492381f71", [:rebar3], [{:fast_tls, "1.1.13", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "377d8487f4add85f6bc6ecdebdb4dcbcbe890e9462f27d6d31f3db1cf9b2cc9b"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"}, diff --git a/rebar.config b/rebar.config index 0c18d9e7d..6343a006c 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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 @@ -37,9 +37,16 @@ {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.48"}}}, {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.32"}}}, {idna, ".*", {git, "https://github.com/benoitc/erlang-idna", {tag, "6.0.0"}}}, - {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "1.0.5"}}}, + {if_version_below, "20", + {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "1.1.0"}}} + }, + {if_version_above, "19", + {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "1.1.1"}}} + }, {jose, ".*", {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.1"}}}, - {lager, ".*", {git, "https://github.com/erlang-lager/lager", {tag, "3.9.1"}}}, + {if_version_below, "22", + {lager, ".*", {git, "https://github.com/erlang-lager/lager", {tag, "3.9.1"}}} + }, {if_var_true, lua, {if_not_rebar3, {luerl, ".*", {git, "https://github.com/rvirding/luerl", {tag, "1.0"}}} @@ -49,7 +56,7 @@ {luerl, ".*", {git, "https://github.com/rvirding/luerl", {tag, "1.0.0"}}} }}, {mqtree, ".*", {git, "https://github.com/processone/mqtree", {tag, "1.0.14"}}}, - {p1_acme, ".*", {git, "https://github.com/processone/p1_acme", {tag, "1.0.16"}}}, + {p1_acme, ".*", {git, "https://github.com/processone/p1_acme", {tag, "1.0.18"}}}, {if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql", {tag, "1.0.19"}}}}, {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.10"}}}, @@ -100,6 +107,8 @@ {erl_opts, [nowarn_deprecated_function, {i, "include"}, {if_version_above, "20", {d, 'DEPRECATED_GET_STACKTRACE'}}, + {if_version_above, "20", {d, 'HAVE_ERL_ERROR'}}, + {if_version_above, "20", {d, 'HAVE_URI_STRING'}}, {if_version_below, "21", {d, 'USE_OLD_HTTP_URI'}}, {if_version_below, "22", {d, 'LAGER'}}, {if_version_below, "21", {d, 'NO_CUSTOMIZE_HOSTNAME_CHECK'}}, @@ -107,16 +116,13 @@ {if_version_below, "23", {d, 'USE_OLD_PG2'}}, {if_version_below, "24", {d, 'COMPILER_REPORTS_ONLY_LINES'}}, {if_version_below, "24", {d, 'SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL'}}, - {if_var_match, db_type, mssql, {d, 'mssql'}}, {if_var_false, debug, no_debug_info}, {if_var_true, debug, debug_info}, {if_var_true, elixir, {d, 'ELIXIR_ENABLED'}}, {if_var_true, new_sql_schema, {d, 'NEW_SQL_SCHEMA'}}, - {if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}}, + {if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATEWAY_WORKAROUND'}}, {if_var_true, sip, {d, 'SIP'}}, {if_var_true, stun, {d, 'STUN'}}, - {if_have_fun, {erl_error, format_exception, 6}, {d, 'HAVE_ERL_ERROR'}}, - {if_have_fun, {uri_string, normalize, 1}, {d, 'HAVE_URI_STRING'}}, {src_dirs, [src, {if_rebar3, sql}, {if_var_true, tools, tools}, @@ -215,6 +221,12 @@ {copy, "test/ejabberd_SUITE_data/cert.pem", "etc/ejabberd/"}]}]}]}, {test, [{erl_opts, [nowarn_export_all]}]}]}. +{alias, [{relive, [{shell, "--apps ejabberd \ + --config rel/relive.config \ + --script rel/relive.escript \ + --name ejabberd@localhost"}]} +]}. + %% Local Variables: %% mode: erlang %% End: diff --git a/rebar.config.script b/rebar.config.script index c83390fb5..33aeb8130 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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/rel/relive.config b/rel/relive.config new file mode 100644 index 000000000..7e3901fd4 --- /dev/null +++ b/rel/relive.config @@ -0,0 +1,3 @@ +[{mnesia, [{dir, "_build/relive/database"}]}, + {ejabberd, [{config, "_build/relive/conf/ejabberd.yml"}, + {log_path, "_build/relive/logs/ejabberd.log"}]}]. diff --git a/rel/relive.escript b/rel/relive.escript new file mode 100644 index 000000000..3ee2de0f3 --- /dev/null +++ b/rel/relive.escript @@ -0,0 +1,26 @@ +#!/usr/bin/env escript + +main(_) -> + Base = "_build/relive", + prepare(Base, "", none), + prepare(Base, "conf", {os, cmd, "rel/setup-relive.sh"}), + prepare(Base, "database", none), + prepare(Base, "logs", none), + c:erlangrc([os:cmd("echo -n $HOME")]), + ok. + +prepare(BaseDir, SuffixDir, MFA) -> + Dir = filename:join(BaseDir, SuffixDir), + case file:make_dir(Dir) of + ok -> + io:format("Preparing relive dir ~s...~n", [Dir]), + case MFA of + none -> ok; + {M, F, A} -> M:F(A) + end; + {error, eexist} -> + ok; + {error, LogsError} -> + io:format("Error creating dir ~s: ~p~n", [Dir, LogsError]), + halt(1) + end. diff --git a/rel/reltool.config.script b/rel/reltool.config.script index 951d55d28..523cf9c76 100644 --- a/rel/reltool.config.script +++ b/rel/reltool.config.script @@ -1,6 +1,6 @@ %%%------------------------------------------------------------------- %%% @author Evgeniy Khramtsov <ekhramtsov@process-one.net> -%%% @copyright (C) 2013-2021, Evgeniy Khramtsov +%%% @copyright (C) 2013-2022, Evgeniy Khramtsov %%% @doc %%% %%% @end diff --git a/rel/setup-relive.sh b/rel/setup-relive.sh new file mode 100755 index 000000000..4e726be88 --- /dev/null +++ b/rel/setup-relive.sh @@ -0,0 +1,30 @@ +PWD_DIR=`pwd` +REL_DIR=$PWD_DIR/_build/relive/ +CON_DIR=$REL_DIR/conf/ + +[ -z "$REL_DIR_TEMP" ] && REL_DIR_TEMP=$REL_DIR +CON_DIR_TEMP=$REL_DIR_TEMP/conf/ + +make ejabberdctl.relive +chmod +x ejabberdctl.relive +mv ejabberdctl.relive $REL_DIR/ejabberdctl + +cp inetrc $CON_DIR/ +cp ejabberdctl.cfg.example $CON_DIR/ejabberdctl.cfg.example +cp ejabberd.yml.example $CON_DIR/ejabberd.yml.example +cp test/ejabberd_SUITE_data/ca.pem $CON_DIR +cp test/ejabberd_SUITE_data/cert.pem $CON_DIR + +cd $CON_DIR_TEMP + +sed -i "s|# certfiles:|certfiles:\n - $CON_DIR/cert.pem|g" ejabberd.yml.example +sed -i "s|certfiles:|ca_file: $CON_DIR/ca.pem\ncertfiles:|g" ejabberd.yml.example +sed -i 's|^acl:$|acl:\n admin: [user: admin]|g' ejabberd.yml.example +[ ! -f "$CON_DIR/ejabberd.yml" ] \ + && echo -n "ejabberd.yml " \ + && mv ejabberd.yml.example ejabberd.yml + +sed -i "s|#' POLL|EJABBERD_BYPASS_WARNINGS=true\n\n#' POLL|g" ejabberdctl.cfg.example +[ ! -f "$CON_DIR/ejabberdctl.cfg" ] \ + && echo -n "ejabberdctl.cfg " \ + && mv ejabberdctl.cfg.example ejabberdctl.cfg diff --git a/rel/vm.args.mix b/rel/vm.args.mix deleted file mode 100644 index 711bd3189..000000000 --- a/rel/vm.args.mix +++ /dev/null @@ -1,14 +0,0 @@ -## Customize flags given to the VM: https://erlang.org/doc/man/erl.html -## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here - --boot ../releases/<%= @version %>/start_clean --boot_var RELEASE_LIB ../lib - -## Number of dirty schedulers doing IO work (file, sockets, and others) -##+SDio 5 - -## Increase number of concurrent ports/sockets -##+Q 65536 - -## Tweak GC to run more often -##-env ERL_FULLSWEEP_AFTER 10 diff --git a/sql/lite.new.sql b/sql/lite.new.sql index cb8add8a1..9eb34c974 100644 --- a/sql/lite.new.sql +++ b/sql/lite.new.sql @@ -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 @@ -285,6 +285,7 @@ CREATE TABLE muc_room ( ); CREATE UNIQUE INDEX i_muc_room_name_host ON muc_room (name, host); +CREATE INDEX i_muc_room_host_created_at ON muc_room (host, created_at); CREATE TABLE muc_registered ( jid text NOT NULL, diff --git a/sql/lite.sql b/sql/lite.sql index 56e8c9151..0580fcbaa 100644 --- a/sql/lite.sql +++ b/sql/lite.sql @@ -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 @@ -260,6 +260,7 @@ CREATE TABLE muc_room ( ); CREATE UNIQUE INDEX i_muc_room_name_host ON muc_room (name, host); +CREATE INDEX i_muc_room_host_created_at ON muc_room (host, created_at); CREATE TABLE muc_registered ( jid text NOT NULL, diff --git a/sql/mssql.sql b/sql/mssql.sql index f8b65edc4..e05a7b51d 100644 --- a/sql/mssql.sql +++ b/sql/mssql.sql @@ -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
@@ -32,7 +32,7 @@ CREATE TABLE [dbo].[archive] ( [kind] [varchar] (10) NULL,
[nick] [varchar] (250) NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [archive_PK] PRIMARY KEY CLUSTERED
+ CONSTRAINT [archive_PK] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -56,7 +56,7 @@ CREATE TABLE [dbo].[archive_prefs] ( [always] [text] NOT NULL,
[never] [text] NOT NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [archive_prefs_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [archive_prefs_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -76,7 +76,7 @@ CREATE TABLE [dbo].[last] ( [username] [varchar] (250) NOT NULL,
[seconds] [text] NOT NULL,
[state] [text] NOT NULL,
- CONSTRAINT [last_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [last_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -86,7 +86,7 @@ CREATE TABLE [dbo].[motd] ( [username] [varchar] (250) NOT NULL,
[xml] [text] NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [motd_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [motd_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -114,6 +114,8 @@ CREATE TABLE [dbo].[muc_room] ( CREATE UNIQUE CLUSTERED INDEX [muc_room_name_host] ON [muc_room] (name, host)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
+CREATE INDEX [muc_room_host_created_at] ON [muc_registered] (host, nick)
+ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE TABLE [dbo].[muc_online_room] (
[name] [varchar] (250) NOT NULL,
@@ -155,7 +157,7 @@ CREATE INDEX [muc_room_subscribers_jid] ON [muc_room_subscribers] (jid); CREATE TABLE [dbo].[privacy_default_list] (
[username] [varchar] (250) NOT NULL,
[name] [varchar] (250) NOT NULL,
- CONSTRAINT [privacy_default_list_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [privacy_default_list_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -166,7 +168,7 @@ CREATE TABLE [dbo].[privacy_list] ( [name] [varchar] (250) NOT NULL,
[id] [bigint] IDENTITY(1,1) NOT NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [privacy_list_PK] PRIMARY KEY CLUSTERED
+ CONSTRAINT [privacy_list_PK] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -245,7 +247,7 @@ CREATE TABLE [dbo].[pubsub_state] ( [affiliation] [char] (1) NOT NULL,
[subscriptions] [text] NOT NULL DEFAULT '',
[stateid] [bigint] IDENTITY(1,1) NOT NULL,
- CONSTRAINT [pubsub_state_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [pubsub_state_PRIMARY] PRIMARY KEY CLUSTERED
(
[stateid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -272,7 +274,7 @@ CREATE TABLE [dbo].[pubsub_node] ( [parent] [varchar] (255) NOT NULL DEFAULT '',
[plugin] [text] NOT NULL,
[nodeid] [bigint] IDENTITY(1,1) NOT NULL,
- CONSTRAINT [pubsub_node_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [pubsub_node_PRIMARY] PRIMARY KEY CLUSTERED
(
[nodeid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -287,7 +289,7 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW CREATE TABLE [dbo].[roster_version] (
[username] [varchar] (250) NOT NULL,
[version] [text] NOT NULL,
- CONSTRAINT [roster_version_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [roster_version_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -348,7 +350,7 @@ CREATE TABLE [dbo].[spool] ( [xml] [text] NOT NULL,
[seq] [bigint] IDENTITY(1,1) NOT NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [spool_PK] PRIMARY KEY CLUSTERED
+ CONSTRAINT [spool_PK] PRIMARY KEY CLUSTERED
(
[seq] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -365,7 +367,7 @@ CREATE TABLE [dbo].[sr_group] ( [name] [varchar] (250) NOT NULL,
[opts] [text] NOT NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [sr_group_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [sr_group_PRIMARY] PRIMARY KEY CLUSTERED
(
[name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -393,7 +395,7 @@ CREATE TABLE [dbo].[users] ( [salt] [text] NOT NULL DEFAULT '',
[iterationcount] [smallint] NOT NULL DEFAULT 0,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [users_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [users_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -403,7 +405,7 @@ CREATE TABLE [dbo].[vcard] ( [username] [varchar] (250) NOT NULL,
[vcard] [text] NOT NULL,
[created_at] [datetime] NOT NULL DEFAULT GETDATE(),
- CONSTRAINT [vcard_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [vcard_PRIMARY] PRIMARY KEY CLUSTERED
(
[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -434,7 +436,7 @@ CREATE TABLE [dbo].[vcard_search] ( [lorgname] [varchar] (250) NOT NULL,
[orgunit] [text] NOT NULL,
[lorgunit] [varchar] (250) NOT NULL,
- CONSTRAINT [vcard_search_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [vcard_search_PRIMARY] PRIMARY KEY CLUSTERED
(
[lusername] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -502,7 +504,7 @@ CREATE TABLE [dbo].[oauth_token] ( [jid] [text] NOT NULL,
[scope] [text] NOT NULL,
[expire] [bigint] NOT NULL,
- CONSTRAINT [oauth_token_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [oauth_token_PRIMARY] PRIMARY KEY CLUSTERED
(
[token] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -526,7 +528,7 @@ CREATE TABLE [dbo].[bosh] ( [sid] [varchar] (255) NOT NULL,
[node] [varchar] (255) NOT NULL,
[pid] [varchar](100) NOT NULL
- CONSTRAINT [bosh_PRIMARY] PRIMARY KEY CLUSTERED
+ CONSTRAINT [bosh_PRIMARY] PRIMARY KEY CLUSTERED
(
[sid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
@@ -546,7 +548,7 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW CREATE UNIQUE INDEX [i_push_ut] ON [push_session] (username, timestamp)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
-CREATE TABLE [dbo].[mqtt_pub](
+CREATE TABLE [dbo].[mqtt_pub] (
[username] [varchar](191) NOT NULL,
[server_host] [varchar](191) NOT NULL,
[resource] [varchar](191) NOT NULL,
diff --git a/sql/mysql.new.sql b/sql/mysql.new.sql index c4e021abf..dc514becf 100644 --- a/sql/mysql.new.sql +++ b/sql/mysql.new.sql @@ -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 @@ -301,6 +301,7 @@ CREATE TABLE muc_room ( ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE UNIQUE INDEX i_muc_room_name_host USING BTREE ON muc_room(name(75), host(75)); +CREATE INDEX i_muc_room_host_created_at ON muc_room(host(75), created_at); CREATE TABLE muc_registered ( jid text NOT NULL, diff --git a/sql/mysql.sql b/sql/mysql.sql index 751552e19..ae4a73312 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -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 @@ -276,6 +276,7 @@ CREATE TABLE muc_room ( ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE UNIQUE INDEX i_muc_room_name_host USING BTREE ON muc_room(name(75), host(75)); +CREATE INDEX i_muc_room_host_created_at ON muc_room(host(75), created_at); CREATE TABLE muc_registered ( jid text NOT NULL, diff --git a/sql/pg.new.sql b/sql/pg.new.sql index 5ffbedde3..6700a4771 100644 --- a/sql/pg.new.sql +++ b/sql/pg.new.sql @@ -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 @@ -161,6 +161,24 @@ -- DROP INDEX i_push_ut; -- ALTER TABLE push_session ADD PRIMARY KEY (server_host, username, timestamp); -- CREATE UNIQUE INDEX i_push_session_susn ON push_session USING btree (server_host, username, service, node); +-- ALTER TABLE push_session ALTER COLUMN server_host DROP DEFAULT; + +-- ALTER TABLE mix_pam ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; +-- DROP INDEX i_mix_pam; +-- DROP INDEX i_mix_pam_us; +-- CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service); +-- CREATE INDEX i_mix_pam_us ON mix_pam (username, server_host); +-- ALTER TABLE mix_pam ALTER COLUMN server_host DROP DEFAULT; + +-- ALTER TABLE route ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; +-- DROP INDEX i_route; +-- CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid); +-- ALTER TABLE i_route ALTER COLUMN server_host DROP DEFAULT; + +-- ALTER TABLE mqtt_pub ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; +-- DROP INDEX i_mqtt_topic; +-- CREATE UNIQUE INDEX i_mqtt_topic_server ON mqtt_pub (topic, server_host); +-- ALTER TABLE mqtt_pub ALTER COLUMN server_host DROP DEFAULT; CREATE TABLE users ( @@ -450,6 +468,7 @@ CREATE TABLE muc_room ( ); CREATE UNIQUE INDEX i_muc_room_name_host ON muc_room USING btree (name, host); +CREATE INDEX i_muc_room_host_created_at ON muc_room USING btree (host, created_at); CREATE TABLE muc_registered ( jid text NOT NULL, diff --git a/sql/pg.sql b/sql/pg.sql index 733856ede..4cf4f0cbd 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -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 @@ -278,6 +278,7 @@ CREATE TABLE muc_room ( ); CREATE UNIQUE INDEX i_muc_room_name_host ON muc_room USING btree (name, host); +CREATE INDEX i_muc_room_host_created_at ON muc_room USING btree (host, created_at); CREATE TABLE muc_registered ( jid text NOT NULL, 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 diff --git a/test/announce_tests.erl b/test/announce_tests.erl index 4b685cb3c..e1258629b 100644 --- a/test/announce_tests.erl +++ b/test/announce_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/carbons_tests.erl b/test/carbons_tests.erl index a6cde55c1..e1717be90 100644 --- a/test/carbons_tests.erl +++ b/test/carbons_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/csi_tests.erl b/test/csi_tests.erl index a2fb413fb..f1f39b49d 100644 --- a/test/csi_tests.erl +++ b/test/csi_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl index bf837d269..10b6aff69 100644 --- a/test/ejabberd_SUITE.erl +++ b/test/ejabberd_SUITE.erl @@ -3,7 +3,7 @@ %%% Created : 2 Jun 2013 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 @@ -76,7 +76,7 @@ init_per_group(Group, Config) -> %% All backends enabled do_init_per_group(Group, Config); Backends -> - %% Skipped backends that were not explicitely enabled + %% Skipped backends that were not explicitly enabled case lists:member(Group, Backends) of true -> do_init_per_group(Group, Config); diff --git a/test/ejabberd_SUITE_data/openssl.cnf b/test/ejabberd_SUITE_data/openssl.cnf index 594653b79..7003c68fc 100644 --- a/test/ejabberd_SUITE_data/openssl.cnf +++ b/test/ejabberd_SUITE_data/openssl.cnf @@ -39,7 +39,7 @@ certs = $dir/certs # Where the issued certs are kept crl_dir = $dir/crl # Where the issued crl are kept database = $dir/index.txt # database index file. #unique_subject = no # Set to 'no' to allow creation of - # several ctificates with same subject. + # several certificates with same subject. new_certs_dir = $dir/newcerts # default place for new certs. certificate = $dir/cacert.pem # The CA certificate @@ -50,7 +50,7 @@ crl = $dir/crl.pem # The current CRL private_key = $dir/private/cakey.pem# The private key RANDFILE = $dir/private/.rand # private random number file -x509_extensions = usr_cert # The extentions to add to the cert +x509_extensions = usr_cert # The extensions to add to the cert # Comment out the following two lines for the "traditional" # (and highly broken) format. @@ -102,7 +102,7 @@ default_bits = 1024 default_keyfile = privkey.pem distinguished_name = req_distinguished_name attributes = req_attributes -x509_extensions = v3_ca # The extentions to add to the self signed cert +x509_extensions = v3_ca # The extensions to add to the self signed cert # Passwords for private keys if not present they will be prompted for # input_password = secret diff --git a/test/elixir-config/config_test.exs b/test/elixir-config/config_test.exs index c359c49c3..8970e02e6 100644 --- a/test/elixir-config/config_test.exs +++ b/test/elixir-config/config_test.exs @@ -47,7 +47,7 @@ defmodule Ejabberd.ConfigTest do assert is_function(register_hook.fun) end - # TODO: When enalbed, this test causes the evaluation of a different config file, so + # TODO: When enabled, this test causes the evaluation of a different config file, so # the other tests, that uses the store, are compromised because the data is different. # So, until a good way is found, this test should remain disabed. # diff --git a/test/example_tests.erl b/test/example_tests.erl index a8fe50ad0..dab5836d7 100644 --- a/test/example_tests.erl +++ b/test/example_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/jidprep_tests.erl b/test/jidprep_tests.erl index 72bf312ae..efe7f711c 100644 --- a/test/jidprep_tests.erl +++ b/test/jidprep_tests.erl @@ -3,7 +3,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/test/ldap_srv.erl b/test/ldap_srv.erl index 966c08a1d..63d91f6c7 100644 --- a/test/ldap_srv.erl +++ b/test/ldap_srv.erl @@ -3,7 +3,7 @@ %%% Created : 21 Jun 2013 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/test/mam_tests.erl b/test/mam_tests.erl index 0de380351..ed7bbe97d 100644 --- a/test/mam_tests.erl +++ b/test/mam_tests.erl @@ -3,7 +3,7 @@ %%% Created : 14 Nov 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 @@ -454,7 +454,7 @@ recv_archived_messages(Config, From, To, QID, Range) -> MyJID = my_jid(Config), lists:foreach( fun(N) -> - ct:comment("Retreiving ~pth message in range ~p", + ct:comment("Retrieving ~pth message in range ~p", [N, Range]), Body = xmpp:mk_text(integer_to_binary(N)), #message{to = MyJID, diff --git a/test/muc_tests.erl b/test/muc_tests.erl index ea3fd1c74..f050e72ca 100644 --- a/test/muc_tests.erl +++ b/test/muc_tests.erl @@ -3,7 +3,7 @@ %%% Created : 15 Oct 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 @@ -191,7 +191,7 @@ service_disco_items(Config) -> service_vcard(Config) -> MUC = muc_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(MUC)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(MUC)]), VCard = mod_muc_opt:vcard(?config(server, Config)), #iq{type = result, sub_els = [VCard]} = send_recv(Config, #iq{type = get, to = MUC, sub_els = [#vcard_temp{}]}), @@ -1474,7 +1474,7 @@ config_voice_request_interval_slave(Config) -> denied = get_event(Config), ct:comment("Requesting voice again"), send(Config, #message{to = Room, sub_els = [X]}), - ct:comment("Receving voice request error because we're sending to fast"), + ct:comment("Receiving voice request error because we're sending to fast"), #message{from = Room, type = error} = Err = recv_message(Config), #stanza_error{reason = 'resource-constraint'} = xmpp:get_error(Err), ct:comment("Waiting for 5 seconds"), @@ -1872,7 +1872,7 @@ set_vcard(Config, VCard) -> get_vcard(Config) -> Room = muc_room_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(Room)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(Room)]), case send_recv(Config, #iq{type = get, to = Room, sub_els = [#vcard_temp{}]}) of #iq{type = result, sub_els = [VCard]} -> diff --git a/test/offline_tests.erl b/test/offline_tests.erl index b5a90e7ee..5ffe50def 100644 --- a/test/offline_tests.erl +++ b/test/offline_tests.erl @@ -3,7 +3,7 @@ %%% Created : 7 Nov 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/test/privacy_tests.erl b/test/privacy_tests.erl index f24893b16..39526e5b1 100644 --- a/test/privacy_tests.erl +++ b/test/privacy_tests.erl @@ -3,7 +3,7 @@ %%% Created : 18 Oct 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/test/private_tests.erl b/test/private_tests.erl index e17932946..fd961b8b8 100644 --- a/test/private_tests.erl +++ b/test/private_tests.erl @@ -3,7 +3,7 @@ %%% Created : 23 Nov 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/test/proxy65_tests.erl b/test/proxy65_tests.erl index 618252eb0..0a75f820e 100644 --- a/test/proxy65_tests.erl +++ b/test/proxy65_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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 @@ -48,7 +48,7 @@ feature_enabled(Config) -> service_vcard(Config) -> JID = proxy_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(JID)]), VCard = mod_proxy65_opt:vcard(?config(server, Config)), #iq{type = result, sub_els = [VCard]} = send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}), diff --git a/test/pubsub_tests.erl b/test/pubsub_tests.erl index 2bca35173..043545422 100644 --- a/test/pubsub_tests.erl +++ b/test/pubsub_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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 @@ -87,7 +87,7 @@ test_features(Config) -> test_vcard(Config) -> JID = pubsub_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(JID)]), VCard = mod_pubsub_opt:vcard(?config(server, Config)), #iq{type = result, sub_els = [VCard]} = send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}), diff --git a/test/push_tests.erl b/test/push_tests.erl index 2b367cba8..553f90968 100644 --- a/test/push_tests.erl +++ b/test/push_tests.erl @@ -3,7 +3,7 @@ %%% Created : 15 Jul 2017 by Holger Weiss <holger@zedat.fu-berlin.de> %%% %%% -%%% 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/test/replaced_tests.erl b/test/replaced_tests.erl index 9a172107e..5f3224aea 100644 --- a/test/replaced_tests.erl +++ b/test/replaced_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/roster_tests.erl b/test/roster_tests.erl index 3092b8cd8..f8d1999e6 100644 --- a/test/roster_tests.erl +++ b/test/roster_tests.erl @@ -3,7 +3,7 @@ %%% Created : 22 Oct 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/test/sm_tests.erl b/test/sm_tests.erl index 81fe39ed0..8e87c642a 100644 --- a/test/sm_tests.erl +++ b/test/sm_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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/test/stundisco_tests.erl b/test/stundisco_tests.erl index f80652df4..65569ead8 100644 --- a/test/stundisco_tests.erl +++ b/test/stundisco_tests.erl @@ -3,7 +3,7 @@ %%% Created : 22 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/test/suite.erl b/test/suite.erl index de7d64873..7669e4fe4 100644 --- a/test/suite.erl +++ b/test/suite.erl @@ -3,7 +3,7 @@ %%% Created : 27 Jun 2013 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/test/upload_tests.erl b/test/upload_tests.erl index 434d7be11..3a5885111 100644 --- a/test/upload_tests.erl +++ b/test/upload_tests.erl @@ -3,7 +3,7 @@ %%% Created : 17 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 @@ -55,7 +55,7 @@ feature_enabled(Config) -> service_vcard(Config) -> Upload = upload_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(Upload)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(Upload)]), VCard = mod_http_upload_opt:vcard(?config(server, Config)), #iq{type = result, sub_els = [VCard]} = send_recv(Config, #iq{type = get, to = Upload, sub_els = [#vcard_temp{}]}), diff --git a/test/vcard_tests.erl b/test/vcard_tests.erl index 8e16f7ac0..791a2265c 100644 --- a/test/vcard_tests.erl +++ b/test/vcard_tests.erl @@ -3,7 +3,7 @@ %%% Created : 16 Nov 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 @@ -90,7 +90,7 @@ get_set(Config) -> service_vcard(Config) -> JID = server_jid(Config), - ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]), + ct:comment("Retrieving vCard from ~s", [jid:encode(JID)]), VCard = mod_vcard_opt:vcard(?config(server, Config)), #iq{type = result, sub_els = [VCard]} = send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}), diff --git a/test/webadmin_tests.erl b/test/webadmin_tests.erl index 53a670d4e..34e2c1b86 100644 --- a/test/webadmin_tests.erl +++ b/test/webadmin_tests.erl @@ -3,7 +3,7 @@ %%% Created : 23 Mar 2020 by Pawel 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/tools/opt_types.sh b/tools/opt_types.sh index 8de6d8945..92cd943d8 100755 --- a/tools/opt_types.sh +++ b/tools/opt_types.sh @@ -524,6 +524,8 @@ fold_opt(File, Fun, Acc, AbsCode) -> Fun(File, {#state.defaults, Form}, Acc1); {attribute, {spec, {spec, {{options, 0}, Spec}}}} -> Fun(File, {#state.specs, hd(Spec)}, Acc1); + {attribute, {spec, {{options, 0}, Spec}}} -> + Fun(File, {#state.specs, hd(Spec)}, Acc1); _ -> Acc1 end @@ -539,6 +541,8 @@ fold_mod_opt(File, Fun, Acc, AbsCode) -> Fun(File, {#state.mod_defaults, Form}, Acc1); {attribute, {spec, {spec, {{mod_options, 1}, Spec}}}} -> Fun(File, {#state.mod_specs, hd(Spec)}, Acc1); + {attribute, {spec, {{mod_options, 1}, Spec}}} -> + Fun(File, {#state.mod_specs, hd(Spec)}, Acc1); _ -> Acc1 end @@ -572,6 +576,8 @@ is_behaviour(AbsCode, Mod) -> {attribute, {Attr, {_, Mod}}} when Attr == behaviour orelse Attr == behavior -> true; + {attribute, {behaviour, Mod}} -> + true; _ -> false end diff --git a/tools/update-deps-releases.pl b/tools/update-deps-releases.pl index 4f7e55972..b450bd69b 100755 --- a/tools/update-deps-releases.pl +++ b/tools/update-deps-releases.pl @@ -413,7 +413,7 @@ while (1) { my $cmd = show_commands($old_deps ? (U => "Update dependency") : (), $changed_deps ? (T => "Tag new release") : (), @operations ? (A => "Apply changes") : (), - R => "Refresh repositiories", + R => "Refresh repositories", H => "What release to Hex", E => "Exit"); last if $cmd eq "E"; diff --git a/tools/xml_compress_gen.erl b/tools/xml_compress_gen.erl index 5b43c5925..157e6cc8a 100644 --- a/tools/xml_compress_gen.erl +++ b/tools/xml_compress_gen.erl @@ -4,7 +4,7 @@ %% Created : 14 Sep 2018 Pawel Chmielowski %% %% -%% 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/vars.config.in b/vars.config.in index 04024fd73..ddfc5ddb5 100644 --- a/vars.config.in +++ b/vars.config.in @@ -1,6 +1,6 @@ %%%---------------------------------------------------------------------- %%% -%%% 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 @@ -21,7 +21,6 @@ %% Macros {roster_gateway_workaround, @roster_gateway_workaround@}. {full_xml, @full_xml@}. -{db_type, @db_type@}. {debug, @debug@}. {new_sql_schema, @new_sql_schema@}. @@ -30,6 +29,7 @@ %% Dependencies {odbc, @odbc@}. +{mssql, @mssql@}. {mysql, @mysql@}. {pgsql, @pgsql@}. {sqlite, @sqlite@}. |