base.py 742 B

12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. """
  3. sleekxmpp.xmlstream.matcher.base
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. Part of SleekXMPP: The Sleek XMPP Library
  6. :copyright: (c) 2011 Nathanael C. Fritz
  7. :license: MIT, see LICENSE for more details
  8. """
  9. class MatcherBase(object):
  10. """
  11. Base class for stanza matchers. Stanza matchers are used to pick
  12. stanzas out of the XML stream and pass them to the appropriate
  13. stream handlers.
  14. :param criteria: Object to compare some aspect of a stanza against.
  15. """
  16. def __init__(self, criteria):
  17. self._criteria = criteria
  18. def match(self, xml):
  19. """Check if a stanza matches the stored criteria.
  20. Meant to be overridden.
  21. """
  22. return False