From d709f8db657aa1d1314082d842dd29e2546739c4 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 14 Feb 2011 13:50:59 -0500 Subject: [PATCH] Use the _build_stanza method. --- sleekxmpp/xmlstream/xmlstream.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 87771adf..a5151d7b 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -813,13 +813,7 @@ class XMLStream(object): # Convert the raw XML object into a stanza object. If no registered # stanza type applies, a generic StanzaBase stanza will be used. - stanza_type = StanzaBase - for stanza_class in self.__root_stanza: - if xml.tag == "{%s}%s" % (self.default_ns, stanza_class.name) or \ - xml.tag == stanza_class.tag_name(): - stanza_type = stanza_class - break - stanza = stanza_type(self, xml) + stanza = self._build_stanza(xml) # Match the stanza against registered handlers. Handlers marked # to run "in stream" will be executed immediately; the rest will @@ -827,7 +821,7 @@ class XMLStream(object): unhandled = True for handler in self.__handlers: if handler.match(stanza): - stanza_copy = stanza_type(self, copy.deepcopy(xml)) + stanza_copy = copy.copy(stanza) handler.prerun(stanza_copy) self.event_queue.put(('stanza', handler, stanza_copy)) try: