Doing some rewriting on XMPP client after re-reading the XMPP protocol documents.