Mentions generation moved to server side

This is so that texts from multiple gateways can share the same
function.

If the client side sends a mentions array, this array is merged with the
array generated on the server.