Bump to 1.3.1
[slixmpp.git] / sleekxmpp / plugins / xep_0297 / stanza.py
blob8b97acccfea8ea0018e0c827adb2db1323d0f0bb
1 """
2 SleekXMPP: The Sleek XMPP Library
3 Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
4 This file is part of SleekXMPP.
6 See the file LICENSE for copying permission.
7 """
9 from sleekxmpp.stanza import Message, Presence, Iq
10 from sleekxmpp.xmlstream import ElementBase
13 class Forwarded(ElementBase):
14 name = 'forwarded'
15 namespace = 'urn:xmpp:forward:0'
16 plugin_attrib = 'forwarded'
17 interfaces = set(['stanza'])
19 def get_stanza(self):
20 for stanza in self:
21 if isinstance(stanza, (Message, Presence, Iq)):
22 return stanza
23 return ''
25 def set_stanza(self, value):
26 self.del_stanza()
27 self.append(value)
29 def del_stanza(self):
30 found_stanzas = []
31 for stanza in self:
32 if isinstance(stanza, (Message, Presence, Iq)):
33 found_stanzas.append(stanza)
34 for stanza in found_stanzas:
35 self.iterables.remove(stanza)
36 self.xml.remove(stanza.xml)