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.base
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2009-06-03 22:56:51 +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
|
|
|
"""
|
2010-09-01 18:28:43 +00:00
|
|
|
|
|
|
|
|
2009-06-03 22:56:51 +00:00
|
|
|
class MatcherBase(object):
|
|
|
|
|
2010-09-01 18:28:43 +00:00
|
|
|
"""
|
|
|
|
Base class for stanza matchers. Stanza matchers are used to pick
|
|
|
|
stanzas out of the XML stream and pass them to the appropriate
|
|
|
|
stream handlers.
|
2011-12-05 00:26:14 +00:00
|
|
|
|
|
|
|
:param criteria: Object to compare some aspect of a stanza against.
|
2010-09-01 18:28:43 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, criteria):
|
|
|
|
self._criteria = criteria
|
|
|
|
|
|
|
|
def match(self, xml):
|
2011-12-05 00:26:14 +00:00
|
|
|
"""Check if a stanza matches the stored criteria.
|
2010-09-01 18:28:43 +00:00
|
|
|
|
|
|
|
Meant to be overridden.
|
|
|
|
"""
|
|
|
|
return False
|