2011-12-04 16:26:14 -08:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-03-26 14:32:16 -07:00
|
|
|
"""
|
2011-12-04 16:26:14 -08:00
|
|
|
sleekxmpp.xmlstream.matcher.id
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2010-03-26 14:32:16 -07:00
|
|
|
|
2011-12-04 16:26:14 -08:00
|
|
|
Part of SleekXMPP: The Sleek XMPP Library
|
|
|
|
|
|
|
|
:copyright: (c) 2011 Nathanael C. Fritz
|
|
|
|
:license: MIT, see LICENSE for more details
|
2010-03-26 14:32:16 -07:00
|
|
|
"""
|
2009-12-16 17:54:22 -08:00
|
|
|
|
2010-09-01 11:28:43 -07: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-04 16:26:14 -08:00
|
|
|
"""Compare the given stanza's ``'id'`` attribute to the stored
|
|
|
|
``id`` value.
|
2010-09-01 11:28:43 -07:00
|
|
|
|
2011-12-04 16:26:14 -08:00
|
|
|
:param xml: The :class:`~sleekxmpp.xmlstream.stanzabase.ElementBase`
|
|
|
|
stanza to compare against.
|
2010-09-01 11:28:43 -07:00
|
|
|
"""
|
|
|
|
return xml['id'] == self._criteria
|