mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-23 19:19:53 +00:00
The ifrom parameter doesn't need special treatment.
This commit is contained in:
parent
3fb3f63e51
commit
2d90deb96a
6 changed files with 37 additions and 47 deletions
|
@ -431,8 +431,7 @@ class xep_0050(base_plugin):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['command']['node'] = node
|
iq['command']['node'] = node
|
||||||
iq['command']['action'] = action
|
iq['command']['action'] = action
|
||||||
if sessionid is not None:
|
if sessionid is not None:
|
||||||
|
@ -482,9 +481,8 @@ class xep_0050(base_plugin):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = ifrom
|
session['from'] = ifrom
|
||||||
session['from'] = ifrom
|
|
||||||
iq['command']['node'] = node
|
iq['command']['node'] = node
|
||||||
iq['command']['action'] = 'execute'
|
iq['command']['action'] = 'execute'
|
||||||
sessionid = 'client:pending_' + iq['id']
|
sessionid = 'client:pending_' + iq['id']
|
||||||
|
|
|
@ -58,9 +58,7 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
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')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub']['create']['node'] = node
|
iq['pubsub']['create']['node'] = node
|
||||||
|
|
||||||
if config is not None:
|
if config is not None:
|
||||||
|
@ -105,10 +103,8 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
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
|
iq['pubsub']['subscribe']['node'] = node
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
|
|
||||||
if subscribee is None:
|
if subscribee is None:
|
||||||
if ifrom:
|
if ifrom:
|
||||||
|
@ -153,10 +149,8 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
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
|
iq['pubsub']['unsubscribe']['node'] = node
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
|
|
||||||
if subscribee is None:
|
if subscribee is None:
|
||||||
if ifrom:
|
if ifrom:
|
||||||
|
@ -194,9 +188,8 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
be executed when a reply stanza is received.
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='get')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
if node is None:
|
if node is None:
|
||||||
iq['pubsub_owner']['default']
|
iq['pubsub_owner']['default']
|
||||||
else:
|
else:
|
||||||
|
@ -220,9 +213,7 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
be executed when a reply stanza is received.
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='get')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub_owner']['subscriptions']['node'] = node
|
iq['pubsub_owner']['subscriptions']['node'] = node
|
||||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
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
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
be executed when a reply stanza is received.
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='get')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub_owner']['affiliations']['node'] = node
|
iq['pubsub_owner']['affiliations']['node'] = node
|
||||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||||
|
|
||||||
def delete_node(self, jid, node, ifrom=None, block=True,
|
def delete_node(self, jid, node, ifrom=None, block=True,
|
||||||
callback=None, timeout=None):
|
callback=None, timeout=None):
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='get')
|
"""
|
||||||
if ifrom:
|
Delete a a pubsub node.
|
||||||
iq['from'] = ifrom
|
|
||||||
|
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
|
iq['pubsub_owner']['delete']['node'] = node
|
||||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||||
|
|
||||||
def set_node_config(self, jid, node, config, ifrom=None, block=True,
|
def set_node_config(self, jid, node, config, ifrom=None, block=True,
|
||||||
callback=None, timeout=None):
|
callback=None, timeout=None):
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='set')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub_owner']['configure']['node'] = node
|
iq['pubsub_owner']['configure']['node'] = node
|
||||||
iq['pubsub_owner']['configure']['config'] = config
|
iq['pubsub_owner']['configure']['config'] = config
|
||||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||||
|
|
||||||
def publish(self, jid, node, items=[], ifrom=None, block=True,
|
def publish(self, jid, node, items=[], ifrom=None, block=True,
|
||||||
callback=None, timeout=None):
|
callback=None, timeout=None):
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='set')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub']['publish']['node'] = node
|
iq['pubsub']['publish']['node'] = node
|
||||||
for id, payload in items:
|
for id, payload in items:
|
||||||
item = stanza.pubsub.Item()
|
item = stanza.pubsub.Item()
|
||||||
|
@ -282,9 +280,8 @@ class xep_0060(base_plugin):
|
||||||
|
|
||||||
def retract(self, jid, node, item, ifrom=None, block=True,
|
def retract(self, jid, node, item, ifrom=None, block=True,
|
||||||
callback=None, timeout=None):
|
callback=None, timeout=None):
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='set')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub']['retract']['node'] = node
|
iq['pubsub']['retract']['node'] = node
|
||||||
item = stanza.pubsub.Item()
|
item = stanza.pubsub.Item()
|
||||||
item['id'] = item
|
item['id'] = item
|
||||||
|
@ -311,9 +308,8 @@ class xep_0060(base_plugin):
|
||||||
def modify_affiliation(self, jid, node, affiliation, user_jid=None,
|
def modify_affiliation(self, jid, node, affiliation, user_jid=None,
|
||||||
ifrom=None, block=True, callback=None,
|
ifrom=None, block=True, callback=None,
|
||||||
timeout=None):
|
timeout=None):
|
||||||
iq = self.xmpp.Iq(sto=jid, stype='set')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
|
||||||
if ifrom:
|
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['pubsub_owner']['affiliations']
|
iq['pubsub_owner']['affiliations']
|
||||||
aff = stanza.pubsub.Affiliation()
|
aff = stanza.pubsub.Affiliation()
|
||||||
aff['node'] = node
|
aff['node'] = node
|
||||||
|
|
|
@ -108,8 +108,7 @@ class xep_0066(base_plugin):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
iq['to'] = to
|
iq['to'] = to
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['oob_transfer']['url'] = url
|
iq['oob_transfer']['url'] = url
|
||||||
iq['oob_transfer']['desc'] = desc
|
iq['oob_transfer']['desc'] = desc
|
||||||
return iq.send(**iqargs)
|
return iq.send(**iqargs)
|
||||||
|
|
|
@ -76,8 +76,7 @@ class xep_0092(base_plugin):
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = ifrom
|
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq['query'] = Version.namespace
|
iq['query'] = Version.namespace
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,7 @@ class xep_0199(base_plugin):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = ifrom
|
|
||||||
iq.enable('ping')
|
iq.enable('ping')
|
||||||
|
|
||||||
start_time = time.clock()
|
start_time = time.clock()
|
||||||
|
|
|
@ -85,8 +85,7 @@ class xep_0202(base_plugin):
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq['to'] = 'to'
|
iq['to'] = to
|
||||||
if ifrom:
|
iq['from'] = ifrom
|
||||||
iq['from'] = 'ifrom'
|
|
||||||
iq.enable('entity_time')
|
iq.enable('entity_time')
|
||||||
return iq.send(**iqargs)
|
return iq.send(**iqargs)
|
||||||
|
|
Loading…
Reference in a new issue