From fec8578cf61696d8ca85a6fe85a55be71d7109fd Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Mon, 19 Jul 2010 15:38:48 -0700 Subject: stanza should not have setValues/getValues because that conflicts with attribute accessors --- sleekxmpp/__init__.py | 6 +++--- sleekxmpp/basexmpp.py | 12 ++++++------ sleekxmpp/plugins/xep_0045.py | 2 +- sleekxmpp/xmlstream/stanzabase.py | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py index df0af09c..3d659a85 100644 --- a/sleekxmpp/__init__.py +++ b/sleekxmpp/__init__.py @@ -145,7 +145,7 @@ class ClientXMPP(basexmpp, XMLStream): def updateRoster(self, jid, name=None, subscription=None, groups=[]): """Add or change a roster item.""" - iq = self.Iq().setValues({'type': 'set'}) + iq = self.Iq().setStanzaValues({'type': 'set'}) iq['roster']['items'] = {jid: {'name': name, 'subscription': subscription, 'groups': groups}} #self.send(iq, self.Iq().setValues({'id': iq['id']})) r = iq.send() @@ -159,7 +159,7 @@ class ClientXMPP(basexmpp, XMLStream): def getRoster(self): """Request the roster be sent.""" - iq = self.Iq().setValues({'type': 'get'}).enable('roster').send() + iq = self.Iq().setStanzaValues({'type': 'get'}).enable('roster').send() self._handleRoster(iq, request=True) def _handleStreamFeatures(self, features): @@ -254,5 +254,5 @@ class ClientXMPP(basexmpp, XMLStream): self.roster[jid] = {'groups': [], 'name': '', 'subscription': 'none', 'presence': {}, 'in_roster': True} self.roster[jid].update(iq['roster']['items'][jid]) if iq['type'] == 'set': - self.send(self.Iq().setValues({'type': 'result', 'id': iq['id']}).enable('roster')) + self.send(self.Iq().setStanzaValues({'type': 'result', 'id': iq['id']}).enable('roster')) self.event("roster_update", iq) diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index c9439ea3..12dc2a1b 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -144,26 +144,26 @@ class basexmpp(object): return waitfor.wait(timeout) def makeIq(self, id=0, ifrom=None): - return self.Iq().setValues({'id': str(id), 'from': ifrom}) + return self.Iq().setStanzaValues({'id': str(id), 'from': ifrom}) def makeIqGet(self, queryxmlns = None): - iq = self.Iq().setValues({'type': 'get'}) + iq = self.Iq().setStanzaValues({'type': 'get'}) if queryxmlns: iq.append(ET.Element("{%s}query" % queryxmlns)) return iq def makeIqResult(self, id): - return self.Iq().setValues({'id': id, 'type': 'result'}) + return self.Iq().setStanzaValues({'id': id, 'type': 'result'}) def makeIqSet(self, sub=None): - iq = self.Iq().setValues({'type': 'set'}) + iq = self.Iq().setStanzaValues({'type': 'set'}) if sub != None: iq.append(sub) return iq def makeIqError(self, id, type='cancel', condition='feature-not-implemented', text=None): - iq = self.Iq().setValues({'id': id}) - iq['error'].setValues({'type': type, 'condition': condition, 'text': text}) + iq = self.Iq().setStanzaValues({'id': id}) + iq['error'].setStanzaValues({'type': type, 'condition': condition, 'text': text}) return iq def makeIqQuery(self, iq, xmlns): diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py index 88ada19d..cc676a6f 100644 --- a/sleekxmpp/plugins/xep_0045.py +++ b/sleekxmpp/plugins/xep_0045.py @@ -134,7 +134,7 @@ class xep_0045(base.base_plugin): """ if pr['muc']['room'] not in self.rooms.keys(): return - entry = pr['muc'].getValues() + entry = pr['muc'].getStanzaValues() if pr['type'] == 'unavailable': del self.rooms[entry['room']][entry['nick']] else: diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index 6508c0af..4e6afee4 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -241,7 +241,7 @@ class ElementBase(tostring.ToString): def __eq__(self, other): if not isinstance(other, ElementBase): return False - values = self.getValues() + values = self.getStanzaValues() for key in other: if key not in values or values[key] != other[key]: return False @@ -283,21 +283,21 @@ class ElementBase(tostring.ToString): if child.tag == "{%s}%s" % (self.namespace, name): self.xml.remove(child) - def getValues(self): + def getStanzaValues(self): out = {} for interface in self.interfaces: out[interface] = self[interface] for pluginkey in self.plugins: - out[pluginkey] = self.plugins[pluginkey].getValues() + out[pluginkey] = self.plugins[pluginkey].getStanzaValues() if self.iterables: iterables = [] for stanza in self.iterables: - iterables.append(stanza.getValues()) + iterables.append(stanza.getStanzaValues()) iterables[-1].update({'__childtag__': "{%s}%s" % (stanza.namespace, stanza.name)}) out['substanzas'] = iterables return out - def setValues(self, attrib): + def setStanzaValues(self, attrib): for interface in attrib: if interface == 'substanzas': for subdict in attrib['substanzas']: @@ -305,7 +305,7 @@ class ElementBase(tostring.ToString): for subclass in self.subitem: if subdict['__childtag__'] == "{%s}%s" % (subclass.namespace, subclass.name): sub = subclass(parent=self) - sub.setValues(subdict) + sub.setStanzaValues(subdict) self.iterables.append(sub) break elif interface in self.interfaces: @@ -313,7 +313,7 @@ class ElementBase(tostring.ToString): elif interface in self.plugin_attrib_map and interface not in self.plugins: self.initPlugin(interface) if interface in self.plugins: - self.plugins[interface].setValues(attrib[interface]) + self.plugins[interface].setStanzaValues(attrib[interface]) return self def appendxml(self, xml): -- cgit v1.2.3