Commit Graph

37 Commits

Author SHA1 Message Date
Stu Tomlinson bd11a00f8f
Use include_lib() to include headers from dependencies (#3369) 2020-09-03 13:45:57 +02:00
Badlop 2d32c66fd7 Update copyright to 2020 (#3149) 2020-01-28 15:49:23 +01:00
Evgeny Khramtsov 97da380acd Generate ejabberd.yml.5 man page from source code directly
Several documentation callbacks (doc/0 and mod_doc/0) are implemented
and `ejabberdctl man` command is added to generate a man page. Note
that the command requires a2x to be installed (which is a part of
asciidoc package).
2020-01-08 12:24:51 +03:00
Evgeny Khramtsov 5770946f03 Correctly handle unicode in log messages 2019-09-23 15:17:20 +03:00
Evgeny Khramtsov 722864666d Add/improve type specs 2019-07-10 10:31:51 +03:00
Evgeny Khramtsov 00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Evgeny Khramtsov b07b10bdaa Drop some macros related to OTP<19 2018-11-29 13:01:00 +03:00
Evgeniy Khramtsov 8879d1d533 Avoid code duplication when checking presence subscription 2018-06-28 10:37:20 +03:00
Evgeniy Khramtsov 644873dae9 Don't check packets sent to self 2018-06-27 15:02:03 +03:00
Evgeniy Khramtsov fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Evgeniy Khramtsov 5704a980c5 Introduce 'access' option for mod_block_stranger
The option is supposed to be used when `allow_local_users`
and `allow_transports` are not enough. It's an ACL where `deny`
means the message will be rejected (or a CAPTCHA would be
generated for a presence), and `allow` means the sender is
whitelisted and the stanza will pass through.

The default value is `none`, which means nothing is whitelisted.
2018-02-17 18:53:35 +03:00
Evgeniy Khramtsov 5d582080be Fix a typo in call to create_captcha()
Thanks to Paul Schaub for spotting this
2018-01-26 22:56:49 +03:00
Evgeniy Khramtsov 4b012a99d2 Introduce option 'captcha' for mod_block_strangers
When the option is set to `true`, the module will generate
CAPTCHA challenges for incoming subscription requests. The option
also implies that option `drop` is set to `true`. Note that
the module won't generate CAPTCHA challenges for messages: they
will still be rejected if `drop` is set to `true`.

Fixes #2246
2018-01-26 15:02:06 +03:00
Holger Weiss e8f1de8785 mod_block_strangers: Bounce groupchat to bare JID
If a blocked message is of type 'groupchat', address the error message
to the bare JID (rather than sending it as MUC PM).
2018-01-24 11:49:31 +01:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Holger Weiss 835360733b mod_block_strangers: Bounce an error message
Return a stanza error when a message is rejected, in order to make
legitimate users aware of the issue.

Closes #2197.
2018-01-03 15:41:30 +01:00
Evgeniy Khramtsov dfd2045523 Introduce option 'allow_transports'
This is a boolean option. If set to `true` and some server's JID
is in user's roster, then messages from any user of this server are
accepted even if no subscription present.

The option is enabled by default.
2017-09-08 23:10:01 +03:00
Evgeniy Khramtsov 803c31f760 Always accept messages from local (sub)domains 2017-09-07 13:53:42 +03:00
Evgeniy Khramtsov 978c92f5e1 Fix a typo and improve logging message 2017-09-07 13:41:51 +03:00
Evgeniy Khramtsov 1a58a201f8 Block messages from strangers before mod_mam/mod_offline processing
Fixes #1713
2017-09-02 22:54:46 +03:00
Christophe Romain 35a11526f9 Revert "Fix get_module_opt call in mod_block_strangers"
This reverts commit e5f64bc24a.
2017-07-27 18:23:10 +02:00
Alexey Shchepin e5f64bc24a Fix get_module_opt call in mod_block_strangers 2017-07-27 17:48:41 +02:00
Alexey Shchepin fcf672c50e Add allow_local_users to mod_block_strangers (#1804, #1809) 2017-06-29 14:55:24 +03:00
Evgeniy Khramtsov f782955c06 Implement cache for roster 2017-05-17 14:47:35 +03:00
Evgeniy Khramtsov fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Alexey Shchepin 9fb188afbc Don't block contacts with subscription=to in mod_block_strangers (#1609) 2017-03-21 15:42:38 +03:00
Evgeniy Khramtsov 3c4057ff55 Reload modules when reloading configuration file 2017-02-22 19:46:47 +03:00
Alexey Shchepin 8b5e6e4a13 Compatibility with R17 in mod_block_strangers 2017-01-23 19:04:22 +03:00
Alexey Shchepin 43bfa0efbc Check message subject in mod_block_strangers 2017-01-23 17:10:28 +03:00
Alexey Shchepin a23c76fb82 Drop only messages with <body/> in mod_block_strangers 2017-01-17 01:34:40 +03:00
Alexey Shchepin fd4f5c0996 Stop hook on message drop in mod_block_strangers 2017-01-16 18:45:26 +03:00
Alexey Shchepin b080b8f54d Use user_receive_packet hook in mod_block_strangers 2017-01-16 18:40:30 +03:00
Alexey Shchepin 5a8dea1591 Remove stub in mob_block_strangers 2017-01-16 18:21:36 +03:00
Alexey Shchepin fedfe5427c Add mod_block_strangers 2017-01-16 18:14:14 +03:00