I need lots of MUC chats with additional functionality:
Change user's room manually from code
Handle special "system" calls (for example calls like /changeroom must be not transported to everybody, but handeled by system)
Store lots of additional data about user in mnesia table
Store all history somewhere in db on hdd and return it on a request.
The only thing that comes to mind (about the second point) is catching every package handling package_fillter event. But that seems too heavy.
What could you advise?
I confirm that your approach is overkill. Processing all the packets seems unnecessary.
You need to write a custom MUC module extension, if the feature of the MUC XMPP extension are not enough for you (XEP-0045).
Since ejabberd 15.07, a new hook API has been introduced called
muc_filter_packet
. It allows you to easily write an ejabberd module to extend only the MUC packet processing, without listening to all server wide packets.