summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0297/stanza.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-09-28 11:02:57 -0700
committerLance Stout <lancestout@gmail.com>2012-09-28 11:02:57 -0700
commita2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3 (patch)
tree40d99fd4b547e4f81e2c9c2b29682c6bb7ac7a06 /sleekxmpp/plugins/xep_0297/stanza.py
parent73ce9a5eccb5fea6f9a6dd72410cdada2a43347f (diff)
parentee9c4abd08db06fd6dc808d48c43cd6d57bd1aa1 (diff)
downloadslixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.gz
slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.bz2
slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.xz
slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0297/stanza.py')
-rw-r--r--sleekxmpp/plugins/xep_0297/stanza.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/sleekxmpp/plugins/xep_0297/stanza.py b/sleekxmpp/plugins/xep_0297/stanza.py
index 1cf02f74..8b97accc 100644
--- a/sleekxmpp/plugins/xep_0297/stanza.py
+++ b/sleekxmpp/plugins/xep_0297/stanza.py
@@ -6,6 +6,7 @@
See the file LICENSE for copying permission.
"""
+from sleekxmpp.stanza import Message, Presence, Iq
from sleekxmpp.xmlstream import ElementBase
@@ -16,12 +17,9 @@ class Forwarded(ElementBase):
interfaces = set(['stanza'])
def get_stanza(self):
- if self.xml.find('{jabber:client}message') is not None:
- return self['message']
- elif self.xml.find('{jabber:client}presence') is not None:
- return self['presence']
- elif self.xml.find('{jabber:client}iq') is not None:
- return self['iq']
+ for stanza in self:
+ if isinstance(stanza, (Message, Presence, Iq)):
+ return stanza
return ''
def set_stanza(self, value):
@@ -29,6 +27,10 @@ class Forwarded(ElementBase):
self.append(value)
def del_stanza(self):
- del self['message']
- del self['presence']
- del self['iq']
+ found_stanzas = []
+ for stanza in self:
+ if isinstance(stanza, (Message, Presence, Iq)):
+ found_stanzas.append(stanza)
+ for stanza in found_stanzas:
+ self.iterables.remove(stanza)
+ self.xml.remove(stanza.xml)