refactor default xmpp handler

I was having a hard time reading the connect() method, so I decided to clean it up.  It seems to work, and the tests pass (well, at least as well as they did before).