diff options
author | Tom Nichols <tmnichols@gmail.com> | 2010-07-07 15:06:39 -0400 |
---|---|---|
committer | Tom Nichols <tmnichols@gmail.com> | 2010-07-07 15:06:39 -0400 |
commit | f7273affc552fbe38cc7e00095de8d3378619010 (patch) | |
tree | 2ae2688c0a33c8376428ca5743a0b7d11f5841dd | |
parent | 34eb88f19919ae3891a2b1581f6cb4eccb6d6b47 (diff) | |
download | slixmpp-f7273affc552fbe38cc7e00095de8d3378619010.tar.gz slixmpp-f7273affc552fbe38cc7e00095de8d3378619010.tar.bz2 slixmpp-f7273affc552fbe38cc7e00095de8d3378619010.tar.xz slixmpp-f7273affc552fbe38cc7e00095de8d3378619010.zip |
notes on the usefulness of some of the 'makeIq' methods. In particular, they seem to duplicate behavior or be largely unused for their intended purpose.
-rw-r--r-- | sleekxmpp/basexmpp.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index a0dca9d9..91bccdf5 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -159,34 +159,48 @@ class basexmpp(object): return waitfor.wait(timeout) def makeIq(self, id=0, ifrom=None): + # FIXME this will always assign an ID of 0 instead of allowing `getNewId` + # to assign a unique ID to the new IQ packet. This method is only called + # from xep_0199 and should probably be deprecated. return self.Iq().setValues({'id': id, 'from': ifrom}) def makeIqGet(self, queryxmlns = None): + # TODO this should take a 'to' param since more often than not you set + # iq['to']=whatever immediately after. iq = self.Iq().setValues({'type': 'get'}) if queryxmlns: iq.append(ET.Element("{%s}query" % queryxmlns)) return iq def makeIqResult(self, id): + # TODO this should take a 'to' param since more often than not you set + # iq['to']=whatever immediately after. return self.Iq().setValues({'id': id, 'type': 'result'}) def makeIqSet(self, sub=None): + # TODO this should take a 'to' param since more often than not you set + # iq['to']=whatever immediately after. iq = self.Iq().setValues({'type': 'set'}) if sub != None: iq.append(sub) return iq def makeIqError(self, id, type='cancel', condition='feature-not-implemented', text=None): + # TODO not used. iq = self.Iq().setValues({'id': id}) iq['error'].setValues({'type': type, 'condition': condition, 'text': text}) return iq def makeIqQuery(self, iq, xmlns): + # FIXME this looks like it essentially duplicates the `makeIqGet` + # and is only used in xep_009 (in two places) and gmail_notify (once). + # Probably safe to deprecate and replace with `makeIqGet.` query = ET.Element("{%s}query" % xmlns) iq.append(query) return iq def makeQueryRoster(self, iq=None): + # FIXME unused. Remove; any user of this code can replace it by `makeIqGet('jabber:iq:roster')` query = ET.Element("{jabber:iq:roster}query") if iq: iq.append(query) |