refactor ejabberd_sm:route_message/3