def send_file(self, account, contact, file_path, file_desc=''): """ Start the real transfer(upload) of the file """ if gtkgui_helpers.file_is_locked(file_path): pritext = _('Gajim can not read this file') sextext = _('Another process is using this file.') ErrorDialog(pritext, sextext) return if isinstance(contact, str): if contact.find('/') == -1: return (jid, resource) = contact.split('/', 1) contact = app.contacts.create_contact(jid=jid, account=account, resource=resource) file_name = os.path.split(file_path)[1] file_props = self.get_send_file_props(account, contact, file_path, file_name, file_desc) if file_props is None: return False if contact.supports(NS_JINGLE_FILE_TRANSFER_5): log.info("contact %s supports jingle file transfer" % (contact.get_full_jid())) app.connections[account].start_file_transfer( contact.get_full_jid(), file_props) self.add_transfer(account, contact, file_props) else: log.info("contact does not support jingle file transfer") file_props.transport_sid = file_props.sid app.connections[account].send_file_request(file_props) self.add_transfer(account, contact, file_props) return True
def send_file(self, account, contact, file_path, file_desc=''): """ Start the real transfer(upload) of the file """ if gtkgui_helpers.file_is_locked(file_path): pritext = _('Gajim can not read this file') sextext = _('Another process is using this file.') ErrorDialog(pritext, sextext) return if isinstance(contact, str): if contact.find('/') == -1: return (jid, resource) = contact.split('/', 1) contact = app.contacts.create_contact(jid=jid, account=account, resource=resource) file_name = os.path.split(file_path)[1] file_props = self.get_send_file_props(account, contact, file_path, file_name, file_desc) if file_props is None: return False app.connections[account].get_module('Jingle').start_file_transfer( contact.get_full_jid(), file_props) self.add_transfer(account, contact, file_props) return True