Commit 7ac75de1 authored by Lance Stout's avatar Lance Stout

Make XMLMasks match properly for components.

parent 0a2737dc
......@@ -37,11 +37,11 @@ class MatchXMLMask(MatcherBase):
object or XML string to use as a mask.
"""
def __init__(self, criteria):
def __init__(self, criteria, default_ns='jabber:client'):
MatcherBase.__init__(self, criteria)
if isinstance(criteria, str):
self._criteria = ET.fromstring(self._criteria)
self.default_ns = 'jabber:client'
self.default_ns = default_ns
def setDefaultNS(self, ns):
"""Set the default namespace to use during comparisons.
......
......@@ -1017,8 +1017,12 @@ class XMLStream(object):
if name is None:
name = 'add_handler_%s' % self.new_id()
self.register_handler(XMLCallback(name, MatchXMLMask(mask), pointer,
once=disposable, instream=instream))
self.register_handler(
XMLCallback(name,
MatchXMLMask(mask, self.default_ns),
pointer,
once=disposable,
instream=instream))
def register_handler(self, handler, before=None, after=None):
"""Add a stream event handler that will be executed when a matching
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment