XEP-0198: Replace guards with pattern matching

This is just a cosmetic change.

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