Adding code to support XEP-0085. Fixes #7.