Fix tests and running without glib on python 3
Reported by sphalerite:
This patch changes python2-specific syntax to remain compatible with python2 while also working in python3.
It also adds "or not HAVE_GLIB" to several conditionals that switch between constants and values defined through glib, allowing nbxmpp to work in python3 without glib (not tested beyond the test suite, however).