esl/MongooseIM — pull request #314 by pzel (2014-11-19 09:47:02+00:00)
Title: Amp repositioning

XEP-0079 specifies the following work-flow for processing AMP-tagged messages:

> 2.2 Server Processing
> Server operation is where the bulk of the work is performed. Upon receiving a message with an AMP
> extension, the server performs the following flow:

> * Validate the semantics (E1, E2).
> * Determine the default behavior.
> * Process rules until condition is met.
> * If a condition is met, execute that rule's action
> If no conditions are met, perform "default" behavior for message
> * Execute determined action (UCE) (E3).

This PR moves AMP strategy resolution from the `filter_packet` hook to a new hook in `ejabberd_c2s`.
This hook (`amp_check_packet`) is run in the transistion between the `session_established` and `session_established2` states. Checking AMP this early in the pipeline makes sure that no server-side effects (like `user_send_packet`) are triggered before the AMP strategy is decided.

Also, because http://xmpp.org/extensions/xep-0079.html#security is not implemented, `mod_amp` is disabled in the default `ejabberd.cfg`.