diff options
author | Lance Stout <lancestout@gmail.com> | 2010-11-17 14:33:09 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-11-17 14:33:09 -0500 |
commit | debf90935981622c7b23009b7edeb311fd57ee5c (patch) | |
tree | 6c2ba5c7c82a03830bcb1a1eb9352d1556009f9b /sleekxmpp/xmlstream/matcher/xmlmask.py | |
parent | 0d4d84b2fa3587c01db0764651105b3cc9cd00f9 (diff) | |
parent | b8114b25ed28437248322aad50209f737faa392c (diff) | |
download | slixmpp-debf90935981622c7b23009b7edeb311fd57ee5c.tar.gz slixmpp-debf90935981622c7b23009b7edeb311fd57ee5c.tar.bz2 slixmpp-debf90935981622c7b23009b7edeb311fd57ee5c.tar.xz slixmpp-debf90935981622c7b23009b7edeb311fd57ee5c.zip |
Merge branch 'develop' into roster
Diffstat (limited to 'sleekxmpp/xmlstream/matcher/xmlmask.py')
-rw-r--r-- | sleekxmpp/xmlstream/matcher/xmlmask.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/matcher/xmlmask.py b/sleekxmpp/xmlstream/matcher/xmlmask.py index 6ebb437d..60e19495 100644 --- a/sleekxmpp/xmlstream/matcher/xmlmask.py +++ b/sleekxmpp/xmlstream/matcher/xmlmask.py @@ -117,7 +117,7 @@ class MatchXMLMask(MatcherBase): return False # If the mask includes text, compare it. - if mask.text and source.text != mask.text: + if mask.text and source.text and source.text.strip() != mask.text.strip(): return False # Compare attributes. The stanza must include the attributes @@ -127,10 +127,17 @@ class MatchXMLMask(MatcherBase): return False # Recursively check subelements. + matched_elements = {} for subelement in mask: if use_ns: - if not self._mask_cmp(source.find(subelement.tag), - subelement, use_ns): + matched = False + for other in source.findall(subelement.tag): + matched_elements[other] = False + if self._mask_cmp(other, subelement, use_ns): + if not matched_elements.get(other, False): + matched_elements[other] = True + matched = True + if not matched: return False else: if not self._mask_cmp(self._get_child(source, subelement.tag), |