Migrated xmpp connection implementation code to XMPPClass, added connection listeners to handle unexcpected disconnections.