diff options
author | Lance Stout <lancestout@gmail.com> | 2011-07-05 09:22:17 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-07-05 09:22:17 -0700 |
commit | 1d22a0472193a543129875ac9a412de4d11fb8b0 (patch) | |
tree | f3b5dbe89df9cb9140780ca57a1d62ea3245414b /sleekxmpp/roster | |
parent | 5efb170e1d7d210304d5bc31f343743770d82e13 (diff) | |
download | slixmpp-1d22a0472193a543129875ac9a412de4d11fb8b0.tar.gz slixmpp-1d22a0472193a543129875ac9a412de4d11fb8b0.tar.bz2 slixmpp-1d22a0472193a543129875ac9a412de4d11fb8b0.tar.xz slixmpp-1d22a0472193a543129875ac9a412de4d11fb8b0.zip |
Added support for custom OOB transfer handlers.
Accepting download requests can be done using:
self['xep_0066'].register_url_handler(handler=self.oob_download)
# Add jid=... to specify a handler for a particular JID for a
# componenent.
def oob_download(self, iq):
if iq['from'] not in self.custom_oob_whitelist:
raise XMPPError('not-authorized')
try:
data = urllib2.urlopen(iq['oob_transfer']['url'])
file = open('oob_download', 'w+')
file.write(data.read())
file.close()
data.close()
except:
raise XMPPError('item-not-found')
Diffstat (limited to 'sleekxmpp/roster')
0 files changed, 0 insertions, 0 deletions