Let mod_mam use the 'sm_receive_packet' hook to generate stanza IDs for
incoming messages, but not to actually store them. The latter would
require additional changes to make sure modules such as mod_privacy and
mod_block_strangers continue to affect MAM.
The VM fails to collect the garbage generated during MAM lookups
automatically, so mod_mam_mnesia's memory usage easily goes up to
several gigabytes if we don't force garbage collection.
Don't write MAM messages into an Mnesia archive if the size of the table
comes close to the 2 GB limit for tables with disc-only copies. That
way, the table is at least not corrupted when the limit is reached.
Let mod_mam_mnesia use transactions when storing or deleting messages.
If old messages of a user are to be removed, delete the user's archive
and rewrite it from scratch, as that seems to be much faster than
removing individual records with delete_object/1.
Closes#1065.