24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00
Commit Graph

161 Commits

Author SHA1 Message Date
Holger Weiss
83e2462853 mod_mam: Don't strip offline message stanza IDs
As mod_offline currently doesn't preserve metadata, add an explicit
check for messages retrieved from offline storage to avoid stripping
their stanza IDs.

Thanks to Zuglufttier for spotting this.
2018-07-27 00:27:10 +02:00
Holger Weiss
cdfd0cce7b mod_mam: Make sure stanza IDs aren't reused
Strip the stanza ID from the metadata of outgoing messages to make sure
it's not reused for the (local) recipient's MAM archive.
2018-07-27 00:14:48 +02:00
Evgeniy Khramtsov
77163c43d2 Simplify the default configuration file
After some discussion with the community it was decided to
clean the configuration file from excessive comments and
explicitly configured default values. Also, mod_mam and
mod_http_upload have been added.

The rationale for this is to have a clean and not bloated
configuration file which doesn't scare away newcomers and
which has all features from the Compliance Suite 2018 (XEP-0387)
enabled by default.

For further configuration an admin is encouraged to read the
documentation at https://docs.ejabberd.im/admin/configuration
2018-07-01 23:57:27 +03:00
Holger Weiss
bb76da03ea mod_mam: Don't replace existing stanza ID
Preserve the original stanza ID for resent messages.  This avoids
storing duplicates in the MAM archive.
2018-06-16 00:43:22 +02: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
Paweł Chmielowski
3fc0eb4f5b Use correct db backend for remove_mam_for_user_with_peer 2018-04-20 14:06:23 +02:00
Paweł Chmielowski
3bfa683586 Fix mnesia call in mam archive management function 2018-04-20 13:36:54 +02:00
Paweł Chmielowski
5be49cc0fa Add commands for cleaning up mam archive 2018-04-20 13:27:46 +02:00
Evgeniy Khramtsov
4632f5520f Really run use_cache/1 and cache_nodes/1 callbacks for mod_mam 2018-02-13 11:38:41 +03:00
Evgeniy Khramtsov
66fc1bf3b6 Remove 'iqdisc' option
Since we got rid of all bottle-neck processes and we have
a connection pool for every database, the option is no longer
needed and in fact is detrimental: in practice what you get
is just a bunch of overloaded processes in the IQ handlers pool
no matter how much you increase the `iqdisc` value.

Given that there are close to zero operators understanding
the meaning of the option and, hence, not using it all,
it's not simply deprecated but completely removed.

The commit also deprecates the following functions:
- gen_iq_handler:add_iq_handler/6
- gen_iq_handler:handle/5
- gen_iq_handler:iqdisc/1
2018-02-11 12:54:15 +03:00
Evgeniy Khramtsov
672c2f75d3 Introduce option 'validate_stream'
If set to `true`, all incoming XML packets are fully validated
against known schemas. If an error occurs, the packet will be bounced
with the corresponding error reason. The default value is `false`.
The option might be useful to protect client software from sofisticated
bugs related to XML validation as well as for client developers
who want to catch validation errors at early stage of development.

Note that the option might have slight performance impact, so use it
with care on loaded machines.
2018-02-09 18:12:50 +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
Evgeniy Khramtsov
2269d290d8 Switch to newer fast_xml and xmpp and update record fields in the code 2018-01-25 20:02:47 +03: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
0b1a6d7e79 mod_mam: Never store MUC messages in user archives
Even if a groupchat message is tagged with a <store/> hint, don't store
it in a user archive.  The hint should only be honored by the MUC
archive.
2017-11-30 22:15:33 +01:00
Evgeniy Khramtsov
ebb97bec44 Fix mod_mam reloading 2017-11-15 11:23:22 +03:00
Holger Weiss
75f150f7ae mod_mam: Simplify 'message_is_archived' callback 2017-11-15 00:36:07 +01:00
Holger Weiss
98419c6662 mod_mam: Improve handling of forked messages
Make sure a message that was forked in ejabberd_sm will really only be
tagged with a stanza ID if (another copy of) it was stored in MAM.
2017-11-15 00:30:38 +01:00
Holger Weiss
2b3890f1b0 Announce support for stanza IDs
Announce the namespace for stanza IDs as per XEP-0359 v0.5.0.
2017-11-15 00:18:25 +01:00
Holger Weiss
06d4f1ff33 mod_mam: Add a few function specifications 2017-11-14 22:58:16 +01:00
Holger Weiss
5ae23a7301 mod_mam: Apply minor cosmetic changes 2017-11-14 22:36:46 +01:00
Holger Weiss
8376370ae1 mod_mam: Don't store from 'sm_receive_packet' hook
Let mod_mam use the 'sm_receive_packet' hook to generate stanza IDs for
incoming messages, but not to actually store them.  The latter would
require additional changes to make sure modules such as mod_privacy and
mod_block_strangers continue to affect MAM.
2017-11-14 22:02:48 +01:00
Evgeniy Khramtsov
f953621ed2 Use xmpp:io_format_error/1 wherever possible 2017-11-14 09:02:43 +03:00
Holger Weiss
54c8ae4d2b mod_mam: Make sure archived message isn't bounced
If mod_offline is disabled but a message is archived by mod_mam, no
error bounce should be generated.  This functionality got lost when
mod_mam stopped using the 'offline_message_hook'.
2017-11-10 18:09:33 +01:00
Christophe Romain
5c6a37b20f Cleanup some headers 2017-11-10 17:51:22 +01:00
Holger Weiss
d1df522fd9 mod_push: Avoid notification duplicates (again)
Now that mod_mam no longer uses the 'offline_message_hook', avoid
duplicating notifications for messages written to both MAM and offline
storage in another way.
2017-11-10 01:11:24 +01:00
Holger Weiss
28661d20bd mod_mam: Always strip stanza IDs
XEP-0359 v0.5.0 says: "Stanza ID generating entities, which encounter a
<stanza-id/> element where the 'by' attribute matches the 'by' attribute
they would otherwise set, MUST delete that element even if they are not
adding their own stanza ID."
2017-11-09 01:10:24 +01:00
Holger Weiss
9c174e30b2 mod_mam: Fix indentation 2017-11-09 01:00:15 +01:00
Holger Weiss
40d725e9c1 mod_mam: Ignore non-message stanzas earlier
Let mod_mam's hook callbacks ignore non-message stanzas using pattern
matching.
2017-11-09 00:48:19 +01:00
Holger Weiss
5cf4e200ba mod_mam: Make sure a stanza ID is always added
Let mod_mam store incoming messages from a new hook in ejabberd_sm.
This makes sure all messages are tagged with a stanza ID, including
those that are forked to multiple resources in ejabberd_sm.

Closes #1344.
2017-11-09 00:21:40 +01:00
Evgeniy Khramtsov
902c6d476b Prepare version 0.6.1 of XEP-0313 (MAM) support 2017-11-08 15:15:39 +03:00
Badlop
cbbfe32d8b Unregister commands when stopping node only if it's last one (#2083) 2017-11-06 16:53:49 +01:00
Holger Weiss
59ec3d36f4 mod_mam: Simplify check for anon MUC JID filtering
Refuse filtering anon MUC MAM queries by JID even if it's the client's
own JID.  Clients probably won't perform such queries in practice, so
the additional complexity is unnecessary.
2017-09-24 15:04:09 +02:00
Holger Weiss
48f2adde98 mod_mam: Refuse filtering anon MUC queries by JID
Return an empty result set if a non-moderator attempts to filter by JID
while querying the archive of an anonymous MUC room.
2017-09-24 02:05:50 +02:00
Christophe Romain
766b7c65a6 Merge pull request #1881 from weiss/push
Support XEP-0357: Push Notifications
2017-08-04 12:58:06 +02:00
Badlop
1a0db3de3a Describe commands arguments and results in ejabberd_sm, ext_mod, mod_mam 2017-07-21 11:26:53 +02:00
Holger Weiss
d6f1d3df5b Support XEP-0357: Push Notifications
Closes #1379.
2017-07-20 20:22:50 +02:00
Evgeniy Khramtsov
f782955c06 Implement cache for roster 2017-05-17 14:47:35 +03:00
Lamtei W
a0908ba393 Added export function for mam module 2017-05-10 11:22:07 +02:00
Evgeniy Khramtsov
cf53d834e9 Introduce 'iqdisc' global option 2017-05-04 12:24:47 +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
Evgeniy Khramtsov
5444475b1d Correct option validation 2017-04-20 18:55:16 +03:00
Evgeniy Khramtsov
264a40f217 Use new cache API in mod_mam 2017-04-20 18:52:16 +03:00
Christophe Romain
b1acd1183f Rename aux.erl as misc.erl
Thanks Microsoft Windows to not support some filenames
2017-04-11 12:13:58 +02:00
Evgeniy Khramtsov
ad948d33c0 Add description to feature-not-implemented error 2017-04-05 15:19:00 +03:00
Evgeniy Khramtsov
7bcbea2108 Deprecate jlib.erl in favor of aux.erl
Since the main goal of jlib.erl is lost, all auxiliary functions
are now moved to aux.erl, and the whole jlib.erl is now deprecated.
2017-03-30 14:17:13 +03:00
Evgeniy Khramtsov
02064ae12a Add support for file-based queues
It's now possible to use files as internal packet queues.
The following options are introduced:

* queue_type: the option can be set to `ram` (default) or `file`.
  The option can be set per virtual host.
* queue_dir: path to the directory where queues will be allocated.
  The default is 'queue' directory inside Mnesia directory.
  This is a global option and cannot be set per virtual host.
2017-03-10 15:12:43 +03:00
Evgeniy Khramtsov
c1439ddd5b Get rid of jid:to_string/1 and jid:from_string/1 2017-02-26 10:07:12 +03:00
Evgeniy Khramtsov
485aae8134 Don't pass 'from' and 'to' along with stanza in hooks' arguments 2017-02-24 21:25:25 +03:00