WIP: Ported router logic to xmppd