Holger Weiss [Sun, 7 Feb 2016 23:46:33 +0000 (00:46 +0100)]
Omit redundant check for overcrowded MUC room
The send_update_presence/4 function already checked whether the room is
overcrowded before calling send_update_presence1/4, so there's no need
to have send_new_presence/4 perform the same check.
Holger Weiss [Sun, 7 Feb 2016 23:16:02 +0000 (00:16 +0100)]
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'".
Holger Weiss [Sat, 6 Feb 2016 21:28:55 +0000 (22:28 +0100)]
XEP-0198: Fix session timeout corner case
If the "resend_on_timeout" option is set to 'if_offline' and a pending
stream management session is terminated because a new session is opened
by the same resource (while no other resource is online), resend
unacknowledged messages rather than bouncing error messages.
Holger Weiss [Mon, 18 Jan 2016 23:39:10 +0000 (00:39 +0100)]
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.
Holger Weiss [Fri, 15 Jan 2016 00:08:22 +0000 (01:08 +0100)]
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.
Holger Weiss [Thu, 14 Jan 2016 01:27:02 +0000 (02:27 +0100)]
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.
Holger Weiss [Thu, 14 Jan 2016 01:12:28 +0000 (02:12 +0100)]
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."
Holger Weiss [Thu, 14 Jan 2016 00:39:19 +0000 (01:39 +0100)]
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."
Holger Weiss [Wed, 13 Jan 2016 22:01:51 +0000 (23:01 +0100)]
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.
Holger Weiss [Wed, 13 Jan 2016 21:46:30 +0000 (22:46 +0100)]
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.)
Holger Weiss [Wed, 13 Jan 2016 20:38:08 +0000 (21:38 +0100)]
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.