Commit Graph

82 Commits

Author SHA1 Message Date
Evgeniy Khramtsov 6a3691ef7c Add xdata generator and make some code using it 2016-10-07 10:31:03 +03:00
Evgeniy Khramtsov 58969fb854 Improve namespace handling 2016-09-24 14:17:21 +03:00
Evgeniy Khramtsov 151668ac10 Fix dialyzer warnings for mod_mam 2016-09-13 16:56:34 +03:00
Evgeniy Khramtsov e987b88848 Make common tests working again 2016-09-13 12:30:05 +03:00
Evgeniy Khramtsov 31faa4eb9a Add more type specs 2016-08-12 13:17:42 +03:00
Evgeniy Khramtsov 522a186a38 Improve some type specs 2016-08-09 10:56:32 +03:00
Evgeniy Khramtsov 4ff8d7918a Change code to reflect recent changes in fxml_gen 2016-08-05 08:41:08 +03:00
Evgeniy Khramtsov 8275e95a16 Swap variables in their correct places 2016-07-27 18:06:34 +03:00
Evgeniy Khramtsov 179fcd9521 Rewrite mod_mam and mod_muc to use XML generator 2016-07-25 13:50:30 +03:00
Evgeniy Khramtsov f6e960d326 Fix compilation error 2016-07-10 08:45:24 +03:00
Evgeniy Khramtsov 786bd4f26c Use hooks instead of direct calls to mod_mam 2016-07-09 12:43:01 +03:00
Evgeniy Khramtsov 4220a2b98c Make modules loading in a dependent order (#1191) 2016-07-06 14:58:48 +03:00
Christophe Romain cd0244eb71 Merge pull request #1120 from anagromataf/feature/archive-id-in-message-carbons
Send unique stanza id and archived tag also in the message carbons
2016-06-22 15:47:27 +02:00
Christophe Romain 7744339347 Update supported xep version 2016-06-22 11:24:01 +02:00
Holger Weiss 26bce5dee3 mod_mam: Fix "assume_mam_usage: if_enabled" 2016-06-14 16:40:46 +02:00
Tobias Kräntzer 2529acc36c Send unique stanza id and archived tag also in the message carbons
- Change order of the hooks in mod_mam for sending and receiving packets. Messages are archived before a carbon copy is send to the other recourcces.
- Add archived tag and unique stanza id to the outgoing packet to have message carbons with the archive information.
- Add additional hook (in mod_mam) to strip the archive tag for outgoing packets after message carbons have been send.
2016-05-15 20:13:25 +02:00
Holger Wei 6cb60aaff5 Cosmetic change: Make variable names consistent
Use the same variable names in both mod_mam:select/8 clauses to avoid
confusion.
2016-05-03 19:12:57 +02:00
Evgeniy Khramtsov 3493a87469 Fix typo in mod_mam:select() (#1098) 2016-04-30 21:37:18 +03:00
Evgeniy Khramtsov 9c369b7a8c Improve detection of databases supported by modules (#1092) 2016-04-27 17:10:50 +03:00
Evgeniy Khramtsov 1aae8a9fda Rename odbc to sql everywhere 2016-04-20 13:25:42 +03:00
Evgeniy Khramtsov 52571e8624 Clean mod_mam.erl from DB specific code 2016-04-15 15:11:31 +03:00
Evgeniy Khramtsov fced8dc3d9 Replace some ?ERR_* macros with ?ERRT_* 2016-03-31 11:00:29 +03:00
Evgeniy Khramtsov 7a9e93839a Fix some LIMIT related problems with MSSQL 2016-03-29 11:34:00 +03:00
Holger Weiss 17be70339c mod_mam: Send new preferences when they are set
If a client updates the archiving preferences, include the new
preferences with the IQ result (as mandated by XEP-0313).
2016-02-10 23:06:31 +01:00
Evgeny Khramtsov 2bfb619d19 Merge pull request #914 from weiss/mam-expose-jid
Expose occupant JID in MUC MAM messages whenever possible
2016-02-08 14:23:19 +03:00
Holger Weiss 8098f7d9a8 mod_mam: Don't let outcasts access MUC archive
XEP-0313 says: "A MUC archive MUST check that the user requesting the
archive has the right to enter it at the time of the query [...].  In
the case of open MUC rooms, the MUC archives can generally be accessed
by any users [...] who do not have an affiliation of 'outcast'".
2016-02-08 00:16:02 +01:00
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 b62607037a mod_mam: Expose MUC occupant JID in more cases
Include the occupant JID with MUC MAM messages if the room is not
anonymous, and also when the MAM user sent the MUC message himself (not
just in the case where he is a room moderator).
2016-01-20 00:02:40 +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