diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-26 22:04:06 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-26 22:06:32 -0700 |
commit | 2d90deb96a86af6d8365994caa26a1ec1474a065 (patch) | |
tree | d099e1e63f89896d6609566e895b1052f4827b8f /sleekxmpp | |
parent | 3fb3f63e5130dff83fe44a94b5849b919baa89ef (diff) | |
download | slixmpp-2d90deb96a86af6d8365994caa26a1ec1474a065.tar.gz slixmpp-2d90deb96a86af6d8365994caa26a1ec1474a065.tar.bz2 slixmpp-2d90deb96a86af6d8365994caa26a1ec1474a065.tar.xz slixmpp-2d90deb96a86af6d8365994caa26a1ec1474a065.zip |
The ifrom parameter doesn't need special treatment.
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/plugins/xep_0050/adhoc.py | 8 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0060/pubsub.py | 62 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0066/oob.py | 3 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0092/version.py | 3 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0199/ping.py | 3 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0202/time.py | 5 |
6 files changed, 37 insertions, 47 deletions
diff --git a/sleekxmpp/plugins/xep_0050/adhoc.py b/sleekxmpp/plugins/xep_0050/adhoc.py index 54be1f86..5095f874 100644 --- a/sleekxmpp/plugins/xep_0050/adhoc.py +++ b/sleekxmpp/plugins/xep_0050/adhoc.py @@ -431,8 +431,7 @@ class xep_0050(base_plugin): iq = self.xmpp.Iq() iq['type'] = 'set' iq['to'] = jid - if ifrom: - iq['from'] = ifrom + iq['from'] = ifrom iq['command']['node'] = node iq['command']['action'] = action if sessionid is not None: @@ -482,9 +481,8 @@ class xep_0050(base_plugin): iq = self.xmpp.Iq() iq['type'] = 'set' iq['to'] = jid - if ifrom: - iq['from'] = ifrom - session['from'] = ifrom + iq['from'] = ifrom + session['from'] = ifrom iq['command']['node'] = node iq['command']['action'] = 'execute' sessionid = 'client:pending_' + iq['id'] diff --git a/sleekxmpp/plugins/xep_0060/pubsub.py b/sleekxmpp/plugins/xep_0060/pubsub.py index 6b981ead..e1107325 100644 --- a/sleekxmpp/plugins/xep_0060/pubsub.py +++ b/sleekxmpp/plugins/xep_0060/pubsub.py @@ -58,9 +58,7 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='set') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') iq['pubsub']['create']['node'] = node if config is not None: @@ -105,10 +103,8 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='set') + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') iq['pubsub']['subscribe']['node'] = node - if ifrom: - iq['from'] = ifrom if subscribee is None: if ifrom: @@ -153,10 +149,8 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='set') + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') iq['pubsub']['unsubscribe']['node'] = node - if ifrom: - iq['from'] = ifrom if subscribee is None: if ifrom: @@ -194,9 +188,8 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='get') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get') + if node is None: iq['pubsub_owner']['default'] else: @@ -220,9 +213,7 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='get') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get') iq['pubsub_owner']['subscriptions']['node'] = node return iq.send(block=block, callback=callback, timeout=timeout) @@ -243,34 +234,41 @@ class xep_0060(base_plugin): callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ - iq = self.xmpp.Iq(sto=jid, stype='get') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get') iq['pubsub_owner']['affiliations']['node'] = node return iq.send(block=block, callback=callback, timeout=timeout) def delete_node(self, jid, node, ifrom=None, block=True, callback=None, timeout=None): - iq = self.xmpp.Iq(sto=jid, stype='get') - if ifrom: - iq['from'] = ifrom + """ + Delete a a pubsub node. + + Arguments: + jid -- The JID of the pubsub service. + node -- The node to delete. + ifrom -- Specify the sender's JID. + block -- Specify if the send call will block until a response + is received, or a timeout occurs. Defaults to True. + timeout -- The length of time (in seconds) to wait for a response + before exiting the send call if blocking is used. + Defaults to sleekxmpp.xmlstream.RESPONSE_TIMEOUT + callback -- Optional reference to a stream handler function. Will + be executed when a reply stanza is received. + """ + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get') iq['pubsub_owner']['delete']['node'] = node return iq.send(block=block, callback=callback, timeout=timeout) def set_node_config(self, jid, node, config, ifrom=None, block=True, callback=None, timeout=None): - iq = self.xmpp.Iq(sto=jid, stype='set') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') iq['pubsub_owner']['configure']['node'] = node iq['pubsub_owner']['configure']['config'] = config return iq.send(block=block, callback=callback, timeout=timeout) def publish(self, jid, node, items=[], ifrom=None, block=True, callback=None, timeout=None): - iq = self.xmpp.Iq(sto=jid, stype='set') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') iq['pubsub']['publish']['node'] = node for id, payload in items: item = stanza.pubsub.Item() @@ -282,9 +280,8 @@ class xep_0060(base_plugin): def retract(self, jid, node, item, ifrom=None, block=True, callback=None, timeout=None): - iq = self.xmpp.Iq(sto=jid, stype='set') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') + iq['pubsub']['retract']['node'] = node item = stanza.pubsub.Item() item['id'] = item @@ -311,9 +308,8 @@ class xep_0060(base_plugin): def modify_affiliation(self, jid, node, affiliation, user_jid=None, ifrom=None, block=True, callback=None, timeout=None): - iq = self.xmpp.Iq(sto=jid, stype='set') - if ifrom: - iq['from'] = ifrom + iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set') + iq['pubsub_owner']['affiliations'] aff = stanza.pubsub.Affiliation() aff['node'] = node diff --git a/sleekxmpp/plugins/xep_0066/oob.py b/sleekxmpp/plugins/xep_0066/oob.py index 98cb81cd..d1f4b3ff 100644 --- a/sleekxmpp/plugins/xep_0066/oob.py +++ b/sleekxmpp/plugins/xep_0066/oob.py @@ -108,8 +108,7 @@ class xep_0066(base_plugin): iq = self.xmpp.Iq() iq['type'] = 'set' iq['to'] = to - if ifrom: - iq['from'] = ifrom + iq['from'] = ifrom iq['oob_transfer']['url'] = url iq['oob_transfer']['desc'] = desc return iq.send(**iqargs) diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py index ac0924b8..ba72a9c3 100644 --- a/sleekxmpp/plugins/xep_0092/version.py +++ b/sleekxmpp/plugins/xep_0092/version.py @@ -76,8 +76,7 @@ class xep_0092(base_plugin): """ iq = self.xmpp.Iq() iq['to'] = jid - if ifrom: - iq['from'] = ifrom + iq['from'] = ifrom iq['type'] = 'get' iq['query'] = Version.namespace diff --git a/sleekxmpp/plugins/xep_0199/ping.py b/sleekxmpp/plugins/xep_0199/ping.py index b0304b09..1baf6f4d 100644 --- a/sleekxmpp/plugins/xep_0199/ping.py +++ b/sleekxmpp/plugins/xep_0199/ping.py @@ -143,8 +143,7 @@ class xep_0199(base_plugin): iq = self.xmpp.Iq() iq['type'] = 'get' iq['to'] = jid - if ifrom: - iq['from'] = ifrom + iq['from'] = ifrom iq.enable('ping') start_time = time.clock() diff --git a/sleekxmpp/plugins/xep_0202/time.py b/sleekxmpp/plugins/xep_0202/time.py index bcad8bc8..2c6faa4b 100644 --- a/sleekxmpp/plugins/xep_0202/time.py +++ b/sleekxmpp/plugins/xep_0202/time.py @@ -85,8 +85,7 @@ class xep_0202(base_plugin): """
iq = self.xmpp.Iq()
iq['type'] = 'get'
- iq['to'] = 'to'
- if ifrom:
- iq['from'] = 'ifrom'
+ iq['to'] = to
+ iq['from'] = ifrom
iq.enable('entity_time')
return iq.send(**iqargs)
|