Follow the most basic coding standards.

This commit is contained in:
Stephan Erb 2009-12-10 22:09:37 +01:00
parent d48202d221
commit f846d51f07
1 changed files with 78 additions and 97 deletions

View File

@ -30,13 +30,14 @@
import socket import socket
import common.xmpp from common import xmpp
from common import gajim from common import gajim
from common import helpers
from common import dataforms
class ConnectionBytestream: class ConnectionBytestream:
def __init__(self): def __init__(self):
self.files_props = {} self.files_props = {}
self.awaiting_xmpp_ping_id = None self.awaiting_xmpp_ping_id = None
@ -60,11 +61,10 @@ class ConnectionBytestream:
return return
if streamhost is None: if streamhost is None:
return None return None
iq = common.xmpp.Iq(to = streamhost['initiator'], typ = 'result', iq = xmpp.Iq(to=streamhost['initiator'], typ='result',
frm = streamhost['target']) frm=streamhost['target'])
iq.setAttr('id', streamhost['id']) iq.setAttr('id', streamhost['id'])
query = iq.setTag('query') query = iq.setTag('query', namespace=xmpp.NS_BYTESTREAM)
query.setNamespace(common.xmpp.NS_BYTESTREAM)
stream_tag = query.setTag('streamhost-used') stream_tag = query.setTag('streamhost-used')
stream_tag.setAttr('jid', streamhost['jid']) stream_tag.setAttr('jid', streamhost['jid'])
self.connection.send(iq) self.connection.send(iq)
@ -91,11 +91,11 @@ class ConnectionBytestream:
Stop and remove all active connections from the socks5 pool Stop and remove all active connections from the socks5 pool
""" """
for file_props in self.files_props.values(): for file_props in self.files_props.values():
self.remove_transfer(file_props, remove_from_list = False) self.remove_transfer(file_props, remove_from_list=False)
del(self.files_props) del(self.files_props)
self.files_props = {} self.files_props = {}
def remove_transfer(self, file_props, remove_from_list = True): def remove_transfer(self, file_props, remove_from_list=True):
if file_props is None: if file_props is None:
return return
self.disconnect_transfer(file_props) self.disconnect_transfer(file_props)
@ -118,8 +118,8 @@ class ConnectionBytestream:
gajim.socks5queue.remove_receiver(host['idx']) gajim.socks5queue.remove_receiver(host['idx'])
gajim.socks5queue.remove_sender(host['idx']) gajim.socks5queue.remove_sender(host['idx'])
def send_socks5_info(self, file_props, fast = True, receiver = None, sender def send_socks5_info(self, file_props, fast=True, receiver=None, sender
= None): =None):
""" """
Send iq for the present streamhosts and proxies Send iq for the present streamhosts and proxies
""" """
@ -149,7 +149,7 @@ class ConnectionBytestream:
(host, _port, jid) = gajim.proxy65_manager.get_proxy(proxy, self.name) (host, _port, jid) = gajim.proxy65_manager.get_proxy(proxy, self.name)
if host is None: if host is None:
continue continue
host_dict={ host_dict = {
'state': 0, 'state': 0,
'target': unicode(receiver), 'target': unicode(receiver),
'id': file_props['sid'], 'id': file_props['sid'],
@ -160,8 +160,7 @@ class ConnectionBytestream:
'jid': jid 'jid': jid
} }
proxyhosts.append(host_dict) proxyhosts.append(host_dict)
sha_str = helpers.get_auth_sha(file_props['sid'], sender, sha_str = helpers.get_auth_sha(file_props['sid'], sender, receiver)
receiver)
file_props['sha_str'] = sha_str file_props['sha_str'] = sha_str
ft_add_hosts = [] ft_add_hosts = []
if ft_add_hosts_to_send: if ft_add_hosts_to_send:
@ -172,24 +171,21 @@ class ConnectionBytestream:
sha_str, self._result_socks5_sid, file_props['sid']) sha_str, self._result_socks5_sid, file_props['sid'])
if listener is None: if listener is None:
file_props['error'] = -5 file_props['error'] = -5
self.dispatch('FILE_REQUEST_ERROR', (unicode(receiver), file_props, self.dispatch('FILE_REQUEST_ERROR', (unicode(receiver), file_props, ''))
''))
self._connect_error(unicode(receiver), file_props['sid'], self._connect_error(unicode(receiver), file_props['sid'],
file_props['sid'], code = 406) file_props['sid'], code=406)
return return
iq = common.xmpp.Protocol(name = 'iq', to = unicode(receiver), iq = xmpp.Iq(name='iq', to=unicode(receiver), typ='set')
typ = 'set')
file_props['request-id'] = 'id_' + file_props['sid'] file_props['request-id'] = 'id_' + file_props['sid']
iq.setID(file_props['request-id']) iq.setID(file_props['request-id'])
query = iq.setTag('query') query = iq.setTag('query', namespace=xmpp.NS_BYTESTREAM)
query.setNamespace(common.xmpp.NS_BYTESTREAM)
query.setAttr('mode', 'plain') query.setAttr('mode', 'plain')
query.setAttr('sid', file_props['sid']) query.setAttr('sid', file_props['sid'])
for ft_host in ft_add_hosts: for ft_host in ft_add_hosts:
# The streamhost, if set # The streamhost, if set
ostreamhost = common.xmpp.Node(tag = 'streamhost') ostreamhost = xmpp.Node(tag='streamhost')
query.addChild(node = ostreamhost) query.addChild(node=ostreamhost)
ostreamhost.setAttr('port', unicode(port)) ostreamhost.setAttr('port', unicode(port))
ostreamhost.setAttr('host', ft_host) ostreamhost.setAttr('host', ft_host)
ostreamhost.setAttr('jid', sender) ostreamhost.setAttr('jid', sender)
@ -201,8 +197,8 @@ class ConnectionBytestream:
if not addr[4][0] in my_ips and not addr[4][0].startswith('127'): if not addr[4][0] in my_ips and not addr[4][0].startswith('127'):
my_ips.append(addr[4][0]) my_ips.append(addr[4][0])
for ip in my_ips: for ip in my_ips:
streamhost = common.xmpp.Node(tag = 'streamhost') streamhost = xmpp.Node(tag='streamhost')
query.addChild(node = streamhost) query.addChild(node=streamhost)
streamhost.setAttr('port', unicode(port)) streamhost.setAttr('port', unicode(port))
streamhost.setAttr('host', ip) streamhost.setAttr('host', ip)
streamhost.setAttr('jid', sender) streamhost.setAttr('jid', sender)
@ -216,7 +212,7 @@ class ConnectionBytestream:
file_props['proxy_sender'] = unicode(sender) file_props['proxy_sender'] = unicode(sender)
file_props['proxyhosts'] = proxyhosts file_props['proxyhosts'] = proxyhosts
for proxyhost in proxyhosts: for proxyhost in proxyhosts:
streamhost = common.xmpp.Node(tag = 'streamhost') streamhost = xmpp.Node(tag='streamhost')
query.addChild(node=streamhost) query.addChild(node=streamhost)
streamhost.setAttr('port', proxyhost['port']) streamhost.setAttr('port', proxyhost['port'])
streamhost.setAttr('host', proxyhost['host']) streamhost.setAttr('host', proxyhost['host'])
@ -237,8 +233,7 @@ class ConnectionBytestream:
# user response to ConfirmationDialog may come after we've disconneted # user response to ConfirmationDialog may come after we've disconneted
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:
return return
iq = common.xmpp.Protocol(name = 'iq', iq = xmpp.Iq(to=unicode(file_props['sender']), typ='error')
to = unicode(file_props['sender']), typ = 'error')
iq.setAttr('id', file_props['request-id']) iq.setAttr('id', file_props['request-id'])
if code == '400' and typ in ('stream', 'profile'): if code == '400' and typ in ('stream', 'profile'):
name = 'bad-request' name = 'bad-request'
@ -246,12 +241,12 @@ class ConnectionBytestream:
else: else:
name = 'forbidden' name = 'forbidden'
text = 'Offer Declined' text = 'Offer Declined'
err = common.xmpp.ErrorNode(code=code, typ='cancel', name=name, text=text) err = xmpp.ErrorNode(code=code, typ='cancel', name=name, text=text)
if code == '400' and typ in ('stream', 'profile'): if code == '400' and typ in ('stream', 'profile'):
if typ == 'stream': if typ == 'stream':
err.setTag('no-valid-streams', namespace=common.xmpp.NS_SI) err.setTag('no-valid-streams', namespace=xmpp.NS_SI)
else: else:
err.setTag('bad-profile', namespace=common.xmpp.NS_SI) err.setTag('bad-profile', namespace=xmpp.NS_SI)
iq.addChild(node=err) iq.addChild(node=err)
self.connection.send(iq) self.connection.send(iq)
@ -262,23 +257,19 @@ class ConnectionBytestream:
# user response to ConfirmationDialog may come after we've disconneted # user response to ConfirmationDialog may come after we've disconneted
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:
return return
iq = common.xmpp.Protocol(name = 'iq', iq = xmpp.Iq(to=unicode(file_props['sender']), typ='result')
to = unicode(file_props['sender']), typ = 'result')
iq.setAttr('id', file_props['request-id']) iq.setAttr('id', file_props['request-id'])
si = iq.setTag('si') si = iq.setTag('si', namespace=xmpp.NS_SI)
si.setNamespace(common.xmpp.NS_SI)
if 'offset' in file_props and file_props['offset']: if 'offset' in file_props and file_props['offset']:
file_tag = si.setTag('file') file_tag = si.setTag('file', namespace=xmpp.NS_FILE)
file_tag.setNamespace(common.xmpp.NS_FILE)
range_tag = file_tag.setTag('range') range_tag = file_tag.setTag('range')
range_tag.setAttr('offset', file_props['offset']) range_tag.setAttr('offset', file_props['offset'])
feature = si.setTag('feature') feature = si.setTag('feature', namespace=xmpp.NS_FEATURE)
feature.setNamespace(common.xmpp.NS_FEATURE) _feature = xmpp.DataForm(typ='submit')
_feature = common.xmpp.DataForm(typ='submit')
feature.addChild(node=_feature) feature.addChild(node=_feature)
field = _feature.setField('stream-method') field = _feature.setField('stream-method')
field.delAttr('type') field.delAttr('type')
field.setValue(common.xmpp.NS_BYTESTREAM) field.setValue(xmpp.NS_BYTESTREAM)
self.connection.send(iq) self.connection.send(iq)
def _ft_get_our_jid(self): def _ft_get_our_jid(self):
@ -297,29 +288,25 @@ class ConnectionBytestream:
return return
file_props['sender'] = self._ft_get_our_jid() file_props['sender'] = self._ft_get_our_jid()
fjid = self._ft_get_receiver_jid(file_props) fjid = self._ft_get_receiver_jid(file_props)
iq = common.xmpp.Protocol(name = 'iq', to = fjid, iq = xmpp.Iq(to=fjid, typ='set')
typ = 'set')
iq.setID(file_props['sid']) iq.setID(file_props['sid'])
self.files_props[file_props['sid']] = file_props self.files_props[file_props['sid']] = file_props
si = iq.setTag('si') si = iq.setTag('si', namespace=xmpp.NS_SI)
si.setNamespace(common.xmpp.NS_SI) si.setAttr('profile', xmpp.NS_FILE)
si.setAttr('profile', common.xmpp.NS_FILE)
si.setAttr('id', file_props['sid']) si.setAttr('id', file_props['sid'])
file_tag = si.setTag('file') file_tag = si.setTag('file', namespace=xmpp.NS_FILE)
file_tag.setNamespace(common.xmpp.NS_FILE)
file_tag.setAttr('name', file_props['name']) file_tag.setAttr('name', file_props['name'])
file_tag.setAttr('size', file_props['size']) file_tag.setAttr('size', file_props['size'])
desc = file_tag.setTag('desc') desc = file_tag.setTag('desc')
if 'desc' in file_props: if 'desc' in file_props:
desc.setData(file_props['desc']) desc.setData(file_props['desc'])
file_tag.setTag('range') file_tag.setTag('range')
feature = si.setTag('feature') feature = si.setTag('feature', namespace=xmpp.NS_FEATURE)
feature.setNamespace(common.xmpp.NS_FEATURE) _feature = xmpp.DataForm(typ='form')
_feature = common.xmpp.DataForm(typ='form')
feature.addChild(node=_feature) feature.addChild(node=_feature)
field = _feature.setField('stream-method') field = _feature.setField('stream-method')
field.setAttr('type', 'list-single') field.setAttr('type', 'list-single')
field.addOption(common.xmpp.NS_BYTESTREAM) field.addOption(xmpp.NS_BYTESTREAM)
self.connection.send(iq) self.connection.send(iq)
def _result_socks5_sid(self, sid, hash_id): def _result_socks5_sid(self, sid, hash_id):
@ -345,9 +332,7 @@ class ConnectionBytestream:
406: 'Not acceptable', 406: 'Not acceptable',
} }
msg = msg_dict[code] msg = msg_dict[code]
iq = None iq = xmpp.Iq(to=to, typ='error')
iq = common.xmpp.Protocol(name = 'iq', to = to,
typ = 'error')
iq.setAttr('id', _id) iq.setAttr('id', _id)
err = iq.setTag('error') err = iq.setTag('error')
err.setAttr('code', unicode(code)) err.setAttr('code', unicode(code))
@ -367,12 +352,10 @@ class ConnectionBytestream:
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:
return return
file_props = self.files_props[proxy['sid']] file_props = self.files_props[proxy['sid']]
iq = common.xmpp.Protocol(name = 'iq', to = proxy['initiator'], iq = xmpp.Iq(to=proxy['initiator'], typ='set')
typ = 'set')
auth_id = "au_" + proxy['sid'] auth_id = "au_" + proxy['sid']
iq.setID(auth_id) iq.setID(auth_id)
query = iq.setTag('query') query = iq.setTag('query', namespace=xmpp.NS_BYTESTREAM)
query.setNamespace(common.xmpp.NS_BYTESTREAM)
query.setAttr('sid', proxy['sid']) query.setAttr('sid', proxy['sid'])
activate = query.setTag('activate') activate = query.setTag('activate')
activate.setData(file_props['proxy_receiver']) activate.setData(file_props['proxy_receiver'])
@ -393,7 +376,7 @@ class ConnectionBytestream:
file_props = self.files_props[id_] file_props = self.files_props[id_]
file_props['error'] = -4 file_props['error'] = -4
self.dispatch('FILE_REQUEST_ERROR', (jid, file_props, '')) self.dispatch('FILE_REQUEST_ERROR', (jid, file_props, ''))
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _ft_get_from(self, iq_obj): def _ft_get_from(self, iq_obj):
return helpers.get_full_jid_from_iq(iq_obj) return helpers.get_full_jid_from_iq(iq_obj)
@ -404,12 +387,11 @@ class ConnectionBytestream:
id_ = unicode(iq_obj.getAttr('id')) id_ = unicode(iq_obj.getAttr('id'))
query = iq_obj.getTag('query') query = iq_obj.getTag('query')
sid = unicode(query.getAttr('sid')) sid = unicode(query.getAttr('sid'))
file_props = gajim.socks5queue.get_file_props( file_props = gajim.socks5queue.get_file_props(self.name, sid)
self.name, sid) streamhosts = []
streamhosts=[]
for item in query.getChildren(): for item in query.getChildren():
if item.getName() == 'streamhost': if item.getName() == 'streamhost':
host_dict={ host_dict = {
'state': 0, 'state': 0,
'target': target, 'target': target,
'id': id_, 'id': id_,
@ -425,7 +407,6 @@ class ConnectionBytestream:
file_props['fast'] = streamhosts file_props['fast'] = streamhosts
if file_props['type'] == 's': # FIXME: remove fast xmlns if file_props['type'] == 's': # FIXME: remove fast xmlns
# only psi do this # only psi do this
if 'streamhosts' in file_props: if 'streamhosts' in file_props:
file_props['streamhosts'].extend(streamhosts) file_props['streamhosts'].extend(streamhosts)
else: else:
@ -434,13 +415,13 @@ class ConnectionBytestream:
gajim.socks5queue.add_file_props(self.name, file_props) gajim.socks5queue.add_file_props(self.name, file_props)
gajim.socks5queue.connect_to_hosts(self.name, sid, gajim.socks5queue.connect_to_hosts(self.name, sid,
self.send_success_connect_reply, None) self.send_success_connect_reply, None)
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
file_props['streamhosts'] = streamhosts file_props['streamhosts'] = streamhosts
if file_props['type'] == 'r': if file_props['type'] == 'r':
gajim.socks5queue.connect_to_hosts(self.name, sid, gajim.socks5queue.connect_to_hosts(self.name, sid,
self.send_success_connect_reply, self._connect_error) self.send_success_connect_reply, self._connect_error)
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _ResultCB(self, con, iq_obj): def _ResultCB(self, con, iq_obj):
log.debug('_ResultCB') log.debug('_ResultCB')
@ -460,7 +441,7 @@ class ConnectionBytestream:
for host in file_props['proxyhosts']: for host in file_props['proxyhosts']:
if host['initiator'] == frm and 'idx' in host: if host['initiator'] == frm and 'idx' in host:
gajim.socks5queue.activate_proxy(host['idx']) gajim.socks5queue.activate_proxy(host['idx'])
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _ft_get_streamhost_jid_attr(self, streamhost): def _ft_get_streamhost_jid_attr(self, streamhost):
return helpers.parse_jid(streamhost.getAttr('jid')) return helpers.parse_jid(streamhost.getAttr('jid'))
@ -480,32 +461,32 @@ class ConnectionBytestream:
if id_ in self.files_props: if id_ in self.files_props:
file_props = self.files_props[id_] file_props = self.files_props[id_]
else: else:
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
if streamhost is None: if streamhost is None:
# proxy approves the activate query # proxy approves the activate query
if real_id.startswith('au_'): if real_id.startswith('au_'):
if 'streamhost-used' not in file_props or \ if 'streamhost-used' not in file_props or \
file_props['streamhost-used'] is False: file_props['streamhost-used'] is False:
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
if 'proxyhosts' not in file_props: if 'proxyhosts' not in file_props:
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
for host in file_props['proxyhosts']: for host in file_props['proxyhosts']:
if host['initiator'] == frm and \ if host['initiator'] == frm and \
unicode(query.getAttr('sid')) == file_props['sid']: unicode(query.getAttr('sid')) == file_props['sid']:
gajim.socks5queue.activate_proxy(host['idx']) gajim.socks5queue.activate_proxy(host['idx'])
break break
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
jid = self._ft_get_streamhost_jid_attr(streamhost) jid = self._ft_get_streamhost_jid_attr(streamhost)
if 'streamhost-used' in file_props and \ if 'streamhost-used' in file_props and \
file_props['streamhost-used'] is True: file_props['streamhost-used'] is True:
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
if real_id.startswith('au_'): if real_id.startswith('au_'):
if 'stopped' in file and file_props['stopped']: if 'stopped' in file and file_props['stopped']:
self.remove_transfer(file_props) self.remove_transfer(file_props)
else: else:
gajim.socks5queue.send_file(file_props, self.name) gajim.socks5queue.send_file(file_props, self.name)
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
proxy = None proxy = None
if 'proxyhosts' in file_props: if 'proxyhosts' in file_props:
@ -524,7 +505,7 @@ class ConnectionBytestream:
gajim.socks5queue.add_receiver(self.name, receiver) gajim.socks5queue.add_receiver(self.name, receiver)
proxy['idx'] = receiver.queue_idx proxy['idx'] = receiver.queue_idx
gajim.socks5queue.on_success = self._proxy_auth_ok gajim.socks5queue.on_success = self._proxy_auth_ok
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
else: else:
if 'stopped' in file_props and file_props['stopped']: if 'stopped' in file_props and file_props['stopped']:
@ -535,9 +516,9 @@ class ConnectionBytestream:
fasts = file_props['fast'] fasts = file_props['fast']
if len(fasts) > 0: if len(fasts) > 0:
self._connect_error(frm, fasts[0]['id'], file_props['sid'], self._connect_error(frm, fasts[0]['id'], file_props['sid'],
code = 406) code=406)
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _siResultCB(self, con, iq_obj): def _siResultCB(self, con, iq_obj):
log.debug('_siResultCB') log.debug('_siResultCB')
@ -566,15 +547,15 @@ class ConnectionBytestream:
if length: if length:
file_props['length'] = int(length) file_props['length'] = int(length)
feature = si.setTag('feature') feature = si.setTag('feature')
if feature.getNamespace() != common.xmpp.NS_FEATURE: if feature.getNamespace() != xmpp.NS_FEATURE:
return return
form_tag = feature.getTag('x') form_tag = feature.getTag('x')
form = common.xmpp.DataForm(node=form_tag) form = xmpp.DataForm(node=form_tag)
field = form.getField('stream-method') field = form.getField('stream-method')
if field.getValue() != common.xmpp.NS_BYTESTREAM: if field.getValue() != xmpp.NS_BYTESTREAM:
return return
self.send_socks5_info(file_props, fast = True) self.send_socks5_info(file_props, fast=True)
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _siSetCB(self, con, iq_obj): def _siSetCB(self, con, iq_obj):
log.debug('_siSetCB') log.debug('_siSetCB')
@ -585,24 +566,24 @@ class ConnectionBytestream:
si = iq_obj.getTag('si') si = iq_obj.getTag('si')
profile = si.getAttr('profile') profile = si.getAttr('profile')
mime_type = si.getAttr('mime-type') mime_type = si.getAttr('mime-type')
if profile != common.xmpp.NS_FILE: if profile != xmpp.NS_FILE:
self.send_file_rejection(file_props, code='400', typ='profile') self.send_file_rejection(file_props, code='400', typ='profile')
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
feature_tag = si.getTag('feature', namespace=common.xmpp.NS_FEATURE) feature_tag = si.getTag('feature', namespace=xmpp.NS_FEATURE)
if not feature_tag: if not feature_tag:
return return
form_tag = feature_tag.getTag('x', namespace=common.xmpp.NS_DATA) form_tag = feature_tag.getTag('x', namespace=xmpp.NS_DATA)
if not form_tag: if not form_tag:
return return
form = common.dataforms.ExtendForm(node=form_tag) form = dataforms.ExtendForm(node=form_tag)
for f in form.iter_fields(): for f in form.iter_fields():
if f.var == 'stream-method' and f.type == 'list-single': if f.var == 'stream-method' and f.type == 'list-single':
values = [o[1] for o in f.options] values = [o[1] for o in f.options]
if common.xmpp.NS_BYTESTREAM in values: if xmpp.NS_BYTESTREAM in values:
break break
else: else:
self.send_file_rejection(file_props, code='400', typ='stream') self.send_file_rejection(file_props, code='400', typ='stream')
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
file_tag = si.getTag('file') file_tag = si.getTag('file')
for attribute in file_tag.getAttrs(): for attribute in file_tag.getAttrs():
if attribute in ('name', 'size', 'hash', 'date'): if attribute in ('name', 'size', 'hash', 'date'):
@ -623,13 +604,13 @@ class ConnectionBytestream:
file_props['transfered_size'] = [] file_props['transfered_size'] = []
gajim.socks5queue.add_file_props(self.name, file_props) gajim.socks5queue.add_file_props(self.name, file_props)
self.dispatch('FILE_REQUEST', (jid, file_props)) self.dispatch('FILE_REQUEST', (jid, file_props))
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
def _siErrorCB(self, con, iq_obj): def _siErrorCB(self, con, iq_obj):
log.debug('_siErrorCB') log.debug('_siErrorCB')
si = iq_obj.getTag('si') si = iq_obj.getTag('si')
profile = si.getAttr('profile') profile = si.getAttr('profile')
if profile != common.xmpp.NS_FILE: if profile != xmpp.NS_FILE:
return return
id_ = iq_obj.getAttr('id') id_ = iq_obj.getAttr('id')
if id_ not in self.files_props: if id_ not in self.files_props:
@ -642,11 +623,11 @@ class ConnectionBytestream:
jid = self._ft_get_from(iq_obj) jid = self._ft_get_from(iq_obj)
file_props['error'] = -3 file_props['error'] = -3
self.dispatch('FILE_REQUEST_ERROR', (jid, file_props, '')) self.dispatch('FILE_REQUEST_ERROR', (jid, file_props, ''))
raise common.xmpp.NodeProcessed raise xmpp.NodeProcessed
class ConnectionBytestreamZeroconf(ConnectionBytestream): class ConnectionBytestreamZeroconf(ConnectionBytestream):
def _ft_get_from(self, iq_obj): def _ft_get_from(self, iq_obj):
return unicode(iq_obj.getFrom()) return unicode(iq_obj.getFrom())
@ -658,5 +639,5 @@ class ConnectionBytestreamZeroconf(ConnectionBytestream):
def _ft_get_streamhost_jid_attr(self, streamhost): def _ft_get_streamhost_jid_attr(self, streamhost):
return streamhost.getAttr('jid') return streamhost.getAttr('jid')
# vim: se ts=3: # vim: se ts=3: