id.py 754 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """
  3. sleekxmpp.xmlstream.matcher.id
  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. from sleekxmpp.xmlstream.matcher.base import MatcherBase
  10. class MatcherId(MatcherBase):
  11. """
  12. The ID matcher selects stanzas that have the same stanza 'id'
  13. interface value as the desired ID.
  14. """
  15. def match(self, xml):
  16. """Compare the given stanza's ``'id'`` attribute to the stored
  17. ``id`` value.
  18. :param xml: The :class:`~sleekxmpp.xmlstream.stanzabase.ElementBase`
  19. stanza to compare against.
  20. """
  21. return xml['id'] == self._criteria