fixes some traceback when doing filetransfer. Fixes #1205

This commit is contained in:
Yann Leboulanger 2011-10-23 13:48:00 +02:00
parent 220aefc4b7
commit 6eedbf6e10
2 changed files with 6 additions and 2 deletions

View File

@ -3194,7 +3194,7 @@ class ChatControl(ChatControlBase):
Show an InfoBar on top of control Show an InfoBar on top of control
""" """
markup = '<b>%s:</b> %s' % (_('File transfer'), file_props['name']) markup = '<b>%s:</b> %s' % (_('File transfer'), file_props['name'])
if file_props['desc']: if 'desc' in file_props and file_props['desc']:
markup += ' (%s)' % file_props['desc'] markup += ' (%s)' % file_props['desc']
markup += '\n%s: %s' % (_('Size'), helpers.convert_bytes( markup += '\n%s: %s' % (_('Size'), helpers.convert_bytes(
file_props['size'])) file_props['size']))
@ -3223,7 +3223,7 @@ class ChatControl(ChatControlBase):
def _got_file_completed(self, file_props): def _got_file_completed(self, file_props):
markup = '<b>%s:</b> %s' % (_('File transfer completed'), markup = '<b>%s:</b> %s' % (_('File transfer completed'),
file_props['name']) file_props['name'])
if file_props['desc']: if 'desc' in file_props and file_props['desc']:
markup += ' (%s)' % file_props['desc'] markup += ' (%s)' % file_props['desc']
b1 = gtk.Button(_('_Open Containing Folder')) b1 = gtk.Button(_('_Open Containing Folder'))
b1.connect('clicked', self._on_open_ft_folder, file_props) b1.connect('clicked', self._on_open_ft_folder, file_props)

View File

@ -620,6 +620,10 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
self.send_success_connect_reply, None) self.send_success_connect_reply, None)
raise xmpp.NodeProcessed raise xmpp.NodeProcessed
if file_props is None:
log.warn('Gajim got streamhosts for unknown transfer. Ignoring it.')
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,