destroy dialogs on delete event
don't send streamhosts if they have been already sent
This commit is contained in:
parent
6319e59e8b
commit
927b6d09bc
3 changed files with 23 additions and 11 deletions
|
@ -246,6 +246,8 @@ class ConnectionBytestream:
|
||||||
|
|
||||||
def send_file_request(self, file_props):
|
def send_file_request(self, file_props):
|
||||||
''' send iq for new FT request '''
|
''' send iq for new FT request '''
|
||||||
|
if not self.connection or self.connected < 2:
|
||||||
|
return
|
||||||
our_jid = gajim.get_jid_from_account(self.name)
|
our_jid = gajim.get_jid_from_account(self.name)
|
||||||
resource = self.server_resource
|
resource = self.server_resource
|
||||||
frm = our_jid + '/' + resource
|
frm = our_jid + '/' + resource
|
||||||
|
@ -396,7 +398,7 @@ class ConnectionBytestream:
|
||||||
file_props = self.files_props[id]
|
file_props = self.files_props[id]
|
||||||
if file_props['streamhost-used']:
|
if file_props['streamhost-used']:
|
||||||
for host in file_props['proxyhosts']:
|
for host in file_props['proxyhosts']:
|
||||||
if host['initiator'] == frm:
|
if host['initiator'] == frm and host.has_key('idx'):
|
||||||
gajim.socks5queue.activate_proxy(host['idx'])
|
gajim.socks5queue.activate_proxy(host['idx'])
|
||||||
raise common.xmpp.NodeProcessed
|
raise common.xmpp.NodeProcessed
|
||||||
|
|
||||||
|
@ -478,6 +480,9 @@ class ConnectionBytestream:
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
# file properties for jid is none
|
# file properties for jid is none
|
||||||
return
|
return
|
||||||
|
if file_props.has_key('request-id'):
|
||||||
|
# we have already sent streamhosts info
|
||||||
|
return
|
||||||
file_props['receiver'] = helpers.get_full_jid_from_iq(iq_obj)
|
file_props['receiver'] = helpers.get_full_jid_from_iq(iq_obj)
|
||||||
si = iq_obj.getTag('si')
|
si = iq_obj.getTag('si')
|
||||||
file_tag = si.getTag('file')
|
file_tag = si.getTag('file')
|
||||||
|
|
|
@ -740,6 +740,8 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
|
|
||||||
def send_file(self):
|
def send_file(self):
|
||||||
''' start sending the file over verified connection '''
|
''' start sending the file over verified connection '''
|
||||||
|
if self.file_props['started']:
|
||||||
|
return
|
||||||
self.file_props['error'] = 0
|
self.file_props['error'] = 0
|
||||||
self.file_props['disconnect_cb'] = self.disconnect
|
self.file_props['disconnect_cb'] = self.disconnect
|
||||||
self.file_props['started'] = True
|
self.file_props['started'] = True
|
||||||
|
|
|
@ -312,12 +312,13 @@ _('Connection with peer cannot be established.'))
|
||||||
if file_props.has_key('desc'):
|
if file_props.has_key('desc'):
|
||||||
sec_text += '\n\t' + _('Description: %s') % file_props['desc']
|
sec_text += '\n\t' + _('Description: %s') % file_props['desc']
|
||||||
prim_text = _('%s wants to send you a file:') % contact.jid
|
prim_text = _('%s wants to send you a file:') % contact.jid
|
||||||
|
dialog, dialog2 = None, None
|
||||||
|
|
||||||
def on_response_ok(widget, account, contact, file_props):
|
def on_response_ok(widget, account, contact, file_props):
|
||||||
self.dialog.destroy()
|
dialog.destroy()
|
||||||
|
|
||||||
def on_ok(widget, account, contact, file_props):
|
def on_ok(widget, account, contact, file_props):
|
||||||
file_path = self.dialog2.get_filename()
|
file_path = dialog2.get_filename()
|
||||||
file_path = gtkgui_helpers.decode_filechooser_file_paths(
|
file_path = gtkgui_helpers.decode_filechooser_file_paths(
|
||||||
(file_path,))[0]
|
(file_path,))[0]
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
|
@ -329,18 +330,18 @@ _('Connection with peer cannot be established.'))
|
||||||
_('This file already exists'), _('What do you want to do?'),
|
_('This file already exists'), _('What do you want to do?'),
|
||||||
not dl_finished)
|
not dl_finished)
|
||||||
response = dialog.get_response()
|
response = dialog.get_response()
|
||||||
if response == gtk.RESPONSE_CANCEL:
|
if response < 0:
|
||||||
return
|
return
|
||||||
elif response == 100:
|
elif response == 100:
|
||||||
file_props['offset'] = dl_size
|
file_props['offset'] = dl_size
|
||||||
self.dialog2.destroy()
|
dialog2.destroy()
|
||||||
self._start_receive(file_path, account, contact, file_props)
|
self._start_receive(file_path, account, contact, file_props)
|
||||||
|
|
||||||
def on_cancel(widget, account, contact, file_props):
|
def on_cancel(widget, account, contact, file_props):
|
||||||
self.dialog2.destroy()
|
dialog2.destroy()
|
||||||
gajim.connections[account].send_file_rejection(file_props)
|
gajim.connections[account].send_file_rejection(file_props)
|
||||||
|
|
||||||
self.dialog2 = dialogs.FileChooserDialog(
|
dialog2 = dialogs.FileChooserDialog(
|
||||||
title_text = _('Save File as...'),
|
title_text = _('Save File as...'),
|
||||||
action = gtk.FILE_CHOOSER_ACTION_SAVE,
|
action = gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||||
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||||
|
@ -350,16 +351,20 @@ _('Connection with peer cannot be established.'))
|
||||||
on_response_ok = (on_ok, account, contact, file_props),
|
on_response_ok = (on_ok, account, contact, file_props),
|
||||||
on_response_cancel = (on_cancel, account, contact, file_props))
|
on_response_cancel = (on_cancel, account, contact, file_props))
|
||||||
|
|
||||||
self.dialog2.set_current_name(file_props['name'])
|
dialog2.set_current_name(file_props['name'])
|
||||||
|
dialog2.connect('delete-event', lambda widget, event:
|
||||||
|
on_cancel(widget, account, contact, file_props))
|
||||||
|
|
||||||
def on_response_cancel(widget, account, file_props):
|
def on_response_cancel(widget, account, file_props):
|
||||||
self.dialog.destroy()
|
dialog.destroy()
|
||||||
gajim.connections[account].send_file_rejection(file_props)
|
gajim.connections[account].send_file_rejection(file_props)
|
||||||
|
|
||||||
self.dialog = dialogs.NonModalConfirmationDialog(prim_text, sec_text,
|
dialog = dialogs.NonModalConfirmationDialog(prim_text, sec_text,
|
||||||
on_response_ok = (on_response_ok, account, contact, file_props),
|
on_response_ok = (on_response_ok, account, contact, file_props),
|
||||||
on_response_cancel = (on_response_cancel, account, file_props))
|
on_response_cancel = (on_response_cancel, account, file_props))
|
||||||
self.dialog.popup()
|
dialog.connect('delete-event', lambda widget, event:
|
||||||
|
on_response_cancel(widget, account, file_props))
|
||||||
|
dialog.popup()
|
||||||
|
|
||||||
def set_images(self):
|
def set_images(self):
|
||||||
''' create pixbufs for status images in transfer rows'''
|
''' create pixbufs for status images in transfer rows'''
|
||||||
|
|
Loading…
Add table
Reference in a new issue