Commit Graph

55 Commits

Author SHA1 Message Date
Mickael Remond dfc29ea03c Switch to Fast XML module 2016-02-03 19:03:17 +01:00
Paweł Chmielowski bdeb4a7e32 Add a way to get all ejabberd_commands, not only those that was registered
This is part of (TECH-1828).
2016-01-26 10:00:28 +01:00
Holger Weiss 5e4ed4266d mod_mam: Strip existing JID tags from MUC messages
Strip any pre-existing <x/> tags which have an <item/> child with a
'jid' attribute from MUC MAM messages.  This way, if such a tag exists,
clients can be sure it was added by mod_mam.
2016-01-19 00:39:10 +01:00
Holger Weiss bd383fb8c1 mod_mam: Remove unused code
This mod_mam version doesn't store groupchat messages in user archives,
and it also doesn't support the "store_body_only" option.
2016-01-18 13:27:29 +01:00
Holger Weiss ddaa409ee2 XEP-0198: Let MAM take care of pending messages
If a stream management session times out for a user who appears to be
using MAM, drop any unacknowledged messages rather than resending or
bouncing them.  This avoids duplicates or bogus error messages.

However, this is only done if the new mod_mam option "assume_mam_usage"
is set to 'if_enabled' or 'on_request'.  In the former case, a user is
assumed to be using MAM if archiving is enabled for his account.  In the
latter case, MAM usage is assumed only if archiving was explicitly
requested by the client, or if archiving was enabled by means of
mod_mam's "request_activates_archiving" option.
2016-01-15 01:08:22 +01:00
Holger Weiss db04cdf2ca mod_mam: Sort messages returned by Mnesia
Sort the messages retrieved from an Mnesia archive before selecting the
subset limited by the <max/> value.  This makes sure the desired subset
of messages is sent to the client.
2016-01-14 02:27:02 +01:00
Holger Weiss 58c8fc5770 mod_mam: Limit result set page size
If the client doesn't specify a maximum number of messages to retrieve
per page, set a limit of 50 messages.  If the client specifies a limit
larger than 250, cap the number to 250 messages.

These limits aren't enforced for MAM v0.2 requests though, as that
version of the XEP doesn't require clients to support RSM.  The newer
revisions say that "a server MAY place a reasonable limit on how many
stanzas may be pushed to a client in one request.  Whether or not the
client query included a <set/> element, the server MAY simply return its
limited results, modifying the <set/> element it returns appropriately."
2016-01-14 02:12:28 +01:00
Holger Weiss 35ec0d58a4 mod_mam: Reject <index/>-based paging
If an <index/> is specified in the MAM request, reject the request
rather than ignoring the desired index and returning wrong results.
XEP-0059 says that the server "MAY return a <feature-not-implemented/>
error."
2016-01-14 01:39:19 +01:00
Holger Weiss 11afa45646 mod_mam: Remove unused variable 2016-01-14 01:15:11 +01:00
Holger Weiss 89f63a4fdf mod_mam: Check whether MUC message is desired 2016-01-14 01:13:16 +01:00
Holger Weiss 85f4f90b45 mod_mam: Support XEP-0313 v0.2 MUC archive queries 2016-01-14 00:58:48 +01:00
Holger Weiss 8117092e6a mod_mam: Respond to form requests
If the client requests a data form with the supported filters, return it
as per XEP-0313 v0.3 and newer.
2016-01-13 23:56:05 +01:00
Holger Weiss 89b1700279 mod_mam: Add 'from' attribute to <delay/> tag 2016-01-13 23:17:23 +01:00
Holger Weiss 9cd048c442 mod_mam: Improve binary comparison of message UIDs
Make sure the binary comparison performed when clients use message UIDs
to page through Mnesia archives yields correct results even if the
specified UIDs don't have the same number of digits as the UIDs of the
stored messages.  This way, MAM will continue to work as expected after
migrating from mod_mam_mnesia to mod_mam.
2016-01-13 23:01:51 +01:00
Holger Weiss 3dccc20d8b mod_mam: Add "delete_old_mam_messages" command
The new "delete_old_mam_messages" command allows for purging all MAM
messages of the specified type older than the specified number of days.
(Currently only implemented for Mnesia archives.)
2016-01-13 22:46:30 +01:00
Holger Weiss a61b0c303d mod_mam: Add "request_activates_archiving" option
Enabling "request_activates_archiving" tells mod_mam not to store any
messages for a user until his client issued a MAM request, regardless of
mod_mam's "default" option.  Once a MAM request is issued, messages are
archived as usual.
2016-01-13 21:38:08 +01:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Evgeniy Khramtsov 776fe8b32a Fix MAM MUC for v0.4.1 2016-01-13 11:45:08 +03:00
Evgeniy Khramtsov 65e6dfb9dd Do not fail on incorrect data coming from SQL (898) 2016-01-11 14:35:11 +03:00
Holger Weiss 4cdb30d59e mod_mam: Use <stanza-id/> tags for deduplication
Use <stanza-id/> elements instead of <delay/> tags to check for messages
resent by the stream management code.  The <stanza-id/> element is
preferable, as it is added by mod_mam itself.
2015-12-29 09:54:48 +01:00
Evgeniy Khramtsov babb484cfc Restrict access to MAM archives for members-only rooms 2015-12-24 15:04:06 +03:00
Holger Weiss 8cf0d31ee9 Revert "mod_mam: Keep 'to' attribute for MUC MAM messages"
This reverts commit 0e330da2a6.  XEP-0313
says: "When sending out the archives to a requesting client, the 'to' of
the forwarded stanza MUST be empty".
2015-12-22 13:20:23 +01:00
Holger Weiss 5fd1aa0d04 Advertise MAM in disco info for account/room JID
As per XEP-0313 version 0.2 and newer, advertise the MAM feature in the
service discovery information for the bare account (or MUC room) JID.

Some clients check the server's discovery information instead, so we'll
continue to advertise the feature there as well.
2015-12-16 00:08:23 +01:00
Holger Weiss 11ad96fced Use MUC domain for 'by' attribute of <stanza-id/>
Let mod_mam specify only the domain part of the room JID in the 'by'
attribute of <stanza-id/> tags.
2015-12-15 21:37:41 +01:00
Holger Weiss 0e330da2a6 mod_mam: Keep 'to' attribute for MUC MAM messages 2015-12-15 21:05:04 +01:00
Holger Weiss 469e93f37b mod_mam: Don't store resent messages
Make sure messages that were resent by the stream management code aren't
stored in MAM.
2015-12-09 22:44:45 +01:00
Holger Weiss e09afe367f Document XEP-0334 support 2015-12-09 22:28:44 +01:00
Evgeniy Khramtsov 4c47ee63f2 Do not forget to include xmlns in mam prefs response (#859) 2015-12-09 12:53:02 +03:00
Paweł Chmielowski be4d687a86 Fix problem with handling of old db entries in mod_mam 2015-12-09 09:47:03 +01:00
Holger Weiss 325c17f277 mod_mam: Update record field type 2015-12-08 22:21:39 +01:00
Holger Weiss 14609dbfa2 mod_mam: Remove unused code 2015-12-08 22:15:55 +01:00
Holger Weiss 5ce0b062ff mod_mam: Honor Message Processing Hints (XEP-0334) 2015-12-08 00:10:00 +01:00
Paweł Chmielowski 29db302808 More now() replacements 2015-12-07 16:09:48 +01:00
Evgeniy Khramtsov f1ecbf80fb Fix archive preference retreiving (#848) 2015-12-01 14:06:23 +03:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Holger Weiss 43e7814714 mod_mam: Update supported XEP version 2015-10-28 23:53:53 +01:00
Christophe Romain 6aeb9dcb38 cosmetic cleanup 2015-10-07 14:18:38 +02:00
Evgeniy Khramtsov 6378c673df Avoid MAM dups when routing to multiple resources 2015-10-02 16:09:55 +02:00
Evgeniy Khramtsov 89b3471742 Add <stanza-id/> (XEP-0359) to archived messages 2015-09-22 21:15:34 +03:00
Evgeniy Khramtsov 70b1dc479c Add MAM (XEP-0313) v0.4 support 2015-09-22 12:23:36 +03:00
Evgeniy Khramtsov eebd4bbd8f Remove unused function now_to_iso/1 2015-09-02 14:13:23 +03:00
Evgeniy Khramtsov 14ddbce3a9 Do not forget to set from/to when fetching from MUC history 2015-09-01 12:35:51 +03:00
Evgeniy Khramtsov 190f76c676 Fetch MUC MAM messages from room history directly if it's not enabled in room configuration 2015-09-01 11:52:08 +03:00
Evgeniy Khramtsov 832f6d39f9 Always include RSM in final message 2015-08-24 13:29:15 +03:00
Evgeniy Khramtsov 94444c87e8 Remove MAM archives on MUC room destroy 2015-08-24 13:28:58 +03:00
Evgeniy Khramtsov 775cf2d459 Change namespace from muc#admin to muc#user 2015-08-19 15:31:35 +03:00
Evgeniy Khramtsov 40feed723d Add support for MUC MAM 2015-08-08 22:15:36 +03:00
Christophe Romain dc0934bff7 Update FSF address 2015-08-05 09:52:54 +02:00
Evgeniy Khramtsov a53191fed5 Add "complete" attribute to MAM final response (EJABS-2484) 2015-07-10 14:05:47 +03:00
Evgeniy Khramtsov 8e27decdfd Fix mod_mam compatibility with RSM for other backends 2015-07-10 13:59:33 +03:00