Fix the iq.send() function, and a bunch of places where it is called

This is a big-and-dirty commit with a bunch of cleanup, maybe breaking a few
things, and not fixing all iq.send() calls yet.
This commit is contained in:
Florent Le Coz
2014-07-30 17:52:59 +02:00
parent 2e571ac950
commit ab03ad54aa
22 changed files with 267 additions and 395 deletions
+36 -19
View File
@@ -29,55 +29,70 @@ class XEP_0016(BasePlugin):
def session_bind(self, jid):
self.xmpp['xep_0030'].add_feature(Privacy.namespace)
def get_privacy_lists(self, block=True, timeout=None, callback=None):
def get_privacy_lists(self, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq.enable('privacy')
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def get_list(self, name, block=True, timeout=None, callback=None):
def get_list(self, name, timeout=None, callback=None, timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['privacy']['list']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def get_active(self, block=True, timeout=None, callback=None):
def get_active(self, timeout=None, callback=None, timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['privacy'].enable('active')
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def get_default(self, block=True, timeout=None, callback=None):
def get_default(self, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['privacy'].enable('default')
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def activate(self, name, block=True, timeout=None, callback=None):
def activate(self, name, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy']['active']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def deactivate(self, block=True, timeout=None, callback=None):
def deactivate(self, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy'].enable('active')
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def make_default(self, name, block=True, timeout=None, callback=None):
def make_default(self, name, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy']['default']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def remove_default(self, block=True, timeout=None, callback=None):
def remove_default(self, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy'].enable('default')
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
def edit_list(self, name, rules, block=True, timeout=None, callback=None):
def edit_list(self, name, rules, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy']['list']['name'] = name
@@ -103,8 +118,10 @@ class XEP_0016(BasePlugin):
presence_out=rule.get('presence_out',
rule.get('presence-out', None)))
def remove_list(self, name, block=True, timeout=None, callback=None):
def remove_list(self, name, timeout=None, callback=None,
timeout_callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['privacy']['list']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)