Refactor authentication code
Make sure we're storing the display JID as Unicode
Merge pull request #659 from SamWhited/jidfixes

Make sure we're storing the display JID as Unicode
Merge pull request #656 from SamWhited/authrefactor

Refactor authentication code