XEP-0198: Apply minor fixes and improvements

Apply a few small improvements and cosmetic changes to the XEP-0198
code.

THIS COMMIT IS MEANT TO BE SQUASHED INTO A PREVIOUS ONE WHEN THE HISTORY
OF THIS FEATURE BRANCH IS REWRITTEN.