Rewritten using simple-xmpp