WIP: Ported base routing logic to xmppd