summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-06-27 17:32:16 -0400
committerLance Stout <lancestout@gmail.com>2010-06-27 17:32:16 -0400
commit059cc9ccc4c41942f6a9b2ba3baab443a91d2a60 (patch)
tree3728e208112b87566662e61436b8b6311ca1cca7 /sleekxmpp/plugins
parent309c9e74eb906af42841d2ab783aa18843c08878 (diff)
downloadslixmpp-059cc9ccc4c41942f6a9b2ba3baab443a91d2a60.tar.gz
slixmpp-059cc9ccc4c41942f6a9b2ba3baab443a91d2a60.tar.bz2
slixmpp-059cc9ccc4c41942f6a9b2ba3baab443a91d2a60.tar.xz
slixmpp-059cc9ccc4c41942f6a9b2ba3baab443a91d2a60.zip
Fixed several errors in xep_0033 plugin.
The method getAddresses was removing addresses by mistake. Several instances of using self.attrib instead of self.xml.attrib.
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0033.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/sleekxmpp/plugins/xep_0033.py b/sleekxmpp/plugins/xep_0033.py
index 76bea6ab..80d58a40 100644
--- a/sleekxmpp/plugins/xep_0033.py
+++ b/sleekxmpp/plugins/xep_0033.py
@@ -34,14 +34,14 @@ class Addresses(ElementBase):
addresses = []
for addrXML in self.xml.findall('{%s}address' % Address.namespace):
# ElementTree 1.2.6 does not support [@attr='value'] in findall
- if atype is not None and addrXML.get('type') == atype:
- self.xml.remove(addrXML)
- addresses.append(Address(xml=addrXML, parent=None))
+ if atype is None or addrXML.attrib.get('type') == atype:
+ addresses.append(Address(xml=addrXML, parent=None))
return addresses
def setAddresses(self, addresses, set_type=None):
self.delAddresses(set_type)
for addr in addresses:
+ addr = dict(addr)
# Remap 'type' to 'atype' to match the add method
if set_type is not None:
addr['type'] = set_type
@@ -52,9 +52,11 @@ class Addresses(ElementBase):
self.addAddress(**addr)
def delAddresses(self, atype=None):
+ if atype is None:
+ return
for addrXML in self.xml.findall('{%s}address' % Address.namespace):
# ElementTree 1.2.6 does not support [@attr='value'] in findall
- if atype is not None and addrXML.get('type') == atype:
+ if addrXML.attrib.get('type') == atype:
self.xml.remove(addrXML)
# --------------------------------------------------------------
@@ -126,7 +128,7 @@ class Address(ElementBase):
address_types = set(('bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to'))
def getDelivered(self):
- return self.attrib.get('delivered', False)
+ return self.xml.attrib.get('delivered', False)
def setDelivered(self, delivered):
if delivered: