From f7273affc552fbe38cc7e00095de8d3378619010 Mon Sep 17 00:00:00 2001 From: Tom Nichols Date: Wed, 7 Jul 2010 15:06:39 -0400 Subject: 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. --- sleekxmpp/basexmpp.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sleekxmpp') 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) -- cgit v1.2.3