mod_amp
Module Description
This module enables support for a subset of the functionality described under
XEP-0079: Advanced Message
Processing. It currently does not
provide features related to timed delivery, i.e the expire-at
condition.
The error
and notify
actions are supported, while alert
and drop
are
not. See more below, under XEP Support.
Options
None.
Example Configuration
1 |
|
XEP Support
What follows is a short description of which parts of the XEP-0079 specification mod_amp supports.
2.1.1 Service Discovery
- Both the service discovery information response (Ex.1, 2) and the request/response for individual actions and conditions (Ex.3, 4) are supported.
2.1.2 Specifying Semantics
- "Per-hop" rule semantics are not supported, i.e. ignored.
2.2 Server Processing
- 2.2.1 Validating Semantics: Performed as in the XEP. The first message to fail validation determines the error message.
- 2.2.2 supported to spec.
- 2.2.3 supported to spec.
- 2.2.4 supported for actions:
error
andnotify
. - 2.2.5 supported for events:
error
andnotify
.
3.3 Defined Conditions
- 3.3.1 deliver: supported for values:
direct
,stored
, andnone
. Thestored
condition works withmod_mam
andmod_offline
. Note: if bothmod_mam
andmod_offline
are enabled, some delivery conditions may not work correctly. - 3.3.2 expire-at: not supported
- 3.3.3 match-resource: supported
3.4 Defined Actions
- 3.4.1 alert: not supported
- 3.4.2 drop: not supported
- 3.4.3 error: supported
- 3.4.4 notify: supported. Notifications for the
stored
anddirect
conditions are sent as soon as the message has been stored or sent to the recipient.
6. Error Handling
- 6.2.1 Unsupported Action: supported
- 6.2.2 Unsupported Condition: supported
- 6.2.3 Not Acceptable: supported
- 6.2.4 Service Unavailable is not supported, as it pertains to "per-hop" rule processing
- 6.2.5 Undefined Condition: supported
8. Stream Feature
- supported
9. Security Considerations
- Currently, the security measures described in this section have not been
implemented. It follows that
mod_amp
, in its current state, should only be enabled for servers/domains where user presence leaks are not a threat, i.e services where all users can see each other's presence by default.
Modifications
The following behaviour differs from or extends the guidelines provided in the XEP.
- The action for the
deliver
condition with valuestored
is deferred until the message is stored bymod_mam
ormod_offline
. - The action for the
deliver
condition with valuedirect
is deferred until the message is sent to the recipient's socket.
Server Processing Details
When a message with AMP rules is being processed by the server, several system events may occur. For a given event, the rules are processed and each of them can get the matched or undecided status or, if the conditions are not met, it gets no status. If any rules get the matched status, the action for the first of them is performed. After that, the rule list is filtered so that only the undecided ones are left in the message, as they may be matched later.
The following system events are defined:
- initial check - always occurs first, when the message enters the system.
- mod_mam failed -
mod_mam
is enabled but fails to store the message. - mod_offline failed - the recipient is offline and
mod_offline
is enabled but fails to store the message. - archived - either
mod_mam
ormod_offline
has successfully stored the message. - delivery failed - the message was about to be delivered, but it could not be sent.
- delivered - the message has been sent to the recipient. Mutually exclusive with delivery failed.
Rule status is determined for each system event in the following way:
-
initial check
- If the recipient is online, rules for the
direct
andnone
values of thedeliver
condition become undecided, except rules for thedirect
value with actionerror
ordrop
, which become matched. Ifmod_mam
is enabled, rules for thestored
value of thedeliver
condition become undecided.- If the recipient has a session for the target resource, rules for the
exact
andany
values of thematch-resource
condition become matched. - Otherwise, rules for the
other
andany
values of thematch-resource
condition become matched.
- If the recipient has a session for the target resource, rules for the
- If the recipient is offline:
- If
mod_mam
ormod_offline
is enabled, rules for thestored
andnone
values of thedeliver
conditions become undecided, except rules for thestored
value with actionerror
ordrop
, which become matched. - If both
mod_mam
andmod_offline
are disabled, rules for thenone
delivery condition become matched.
- If
- If the recipient is online, rules for the
-
mod_mam failed
- If the recipient is online, rules for
direct
andnone
values of thedeliver
condition become undecided. - If the recipient is offline, rules for the
none
value of thedeliver
condition become matched.
- If the recipient is online, rules for
-
mod_offline failed
- Rules for the
none
value of thedeliver
condition become matched.
- Rules for the
-
archived
- If the recipient is online, rules for
direct
andstored
values of thedeliver
condition become undecided. - If the recipient is offline, rules for the
stored
value of thedeliver
condition become matched.
- If the recipient is online, rules for
-
delivery failed
- Rules for the
none
andstored
value of thedeliver
condition become matched.
- Rules for the
-
delivered
- Rules for the
direct
value of thedeliver
condition become matched.
- Rules for the