2011-12-05 00:26:14 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-03-26 21:32:16 +00:00
|
|
|
"""
|
2011-12-05 00:26:14 +00:00
|
|
|
sleekxmpp.xmlstream.matcher.id
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2010-03-26 21:32:16 +00:00
|
|
|
|
2011-12-05 00:26:14 +00:00
|
|
|
Part of SleekXMPP: The Sleek XMPP Library
|
|
|
|
|
|
|
|
:copyright: (c) 2011 Nathanael C. Fritz
|
|
|
|
:license: MIT, see LICENSE for more details
|
2010-03-26 21:32:16 +00:00
|
|
|
"""
|
2009-12-17 01:54:22 +00:00
|
|
|
|
2010-09-01 18:28:43 +00:00
|
|
|
from sleekxmpp.xmlstream.matcher.base import MatcherBase
|
|
|
|
|
|
|
|
|
|
|
|
class MatcherId(MatcherBase):
|
|
|
|
|
|
|
|
"""
|
|
|
|
The ID matcher selects stanzas that have the same stanza 'id'
|
|
|
|
interface value as the desired ID.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def match(self, xml):
|
2011-12-05 00:26:14 +00:00
|
|
|
"""Compare the given stanza's ``'id'`` attribute to the stored
|
|
|
|
``id`` value.
|
2010-09-01 18:28:43 +00:00
|
|
|
|
2011-12-05 00:26:14 +00:00
|
|
|
:param xml: The :class:`~sleekxmpp.xmlstream.stanzabase.ElementBase`
|
|
|
|
stanza to compare against.
|
2010-09-01 18:28:43 +00:00
|
|
|
"""
|
|
|
|
return xml['id'] == self._criteria
|