summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/matcher
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-01-25 10:40:50 -0800
committerNathan Fritz <fritzy@netflint.net>2010-01-25 10:40:50 -0800
commit65dd83d4e174fc5f88ea90b32dd9e3ebf1787294 (patch)
tree9710ceeebb74d49c6ae1926bae7be5188c4a9066 /sleekxmpp/xmlstream/matcher
parent6e4c1128ec8f01d31c7714c13db02ff20c7a0a40 (diff)
parent6b130eb94775da8675750a0a9aed75fa6f328137 (diff)
downloadslixmpp-65dd83d4e174fc5f88ea90b32dd9e3ebf1787294.tar.gz
slixmpp-65dd83d4e174fc5f88ea90b32dd9e3ebf1787294.tar.bz2
slixmpp-65dd83d4e174fc5f88ea90b32dd9e3ebf1787294.tar.xz
slixmpp-65dd83d4e174fc5f88ea90b32dd9e3ebf1787294.zip
Merge branch 'master' of github.com:fritzy/SleekXMPP
Diffstat (limited to 'sleekxmpp/xmlstream/matcher')
-rw-r--r--sleekxmpp/xmlstream/matcher/id.py2
-rw-r--r--sleekxmpp/xmlstream/matcher/stanzapath.py7
-rw-r--r--sleekxmpp/xmlstream/matcher/xmlmask.py2
-rw-r--r--sleekxmpp/xmlstream/matcher/xpath.py2
4 files changed, 12 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/matcher/id.py b/sleekxmpp/xmlstream/matcher/id.py
index ec7597d4..44fad15c 100644
--- a/sleekxmpp/xmlstream/matcher/id.py
+++ b/sleekxmpp/xmlstream/matcher/id.py
@@ -3,4 +3,4 @@ from . import base
class MatcherId(base.MatcherBase):
def match(self, xml):
- return xml.get('id') == self._criteria
+ return xml['id'] == self._criteria
diff --git a/sleekxmpp/xmlstream/matcher/stanzapath.py b/sleekxmpp/xmlstream/matcher/stanzapath.py
new file mode 100644
index 00000000..d036d0b8
--- /dev/null
+++ b/sleekxmpp/xmlstream/matcher/stanzapath.py
@@ -0,0 +1,7 @@
+from . import base
+from xml.etree import cElementTree
+
+class StanzaPath(base.MatcherBase):
+
+ def match(self, stanza):
+ return stanza.match(self._criteria)
diff --git a/sleekxmpp/xmlstream/matcher/xmlmask.py b/sleekxmpp/xmlstream/matcher/xmlmask.py
index e8e4df02..e4a22faa 100644
--- a/sleekxmpp/xmlstream/matcher/xmlmask.py
+++ b/sleekxmpp/xmlstream/matcher/xmlmask.py
@@ -16,6 +16,8 @@ class MatchXMLMask(base.MatcherBase):
self.default_ns = ns
def match(self, xml):
+ if hasattr(xml, 'xml'):
+ xml = xml.xml
return self.maskcmp(xml, self._criteria, True)
def maskcmp(self, source, maskobj, use_ns=False, default_ns='__no_ns__'):
diff --git a/sleekxmpp/xmlstream/matcher/xpath.py b/sleekxmpp/xmlstream/matcher/xpath.py
index 060d5df3..fe18a655 100644
--- a/sleekxmpp/xmlstream/matcher/xpath.py
+++ b/sleekxmpp/xmlstream/matcher/xpath.py
@@ -6,6 +6,8 @@ ignore_ns = False
class MatchXPath(base.MatcherBase):
def match(self, xml):
+ if hasattr(xml, 'xml'):
+ xml = xml.xml
x = cElementTree.Element('x')
x.append(xml)
if not ignore_ns: