def _remove_transfer(self, iter_, sid, file_props): self.model.remove(iter_) if not file_props: return if file_props.tt_account: # file transfer is set account = file_props.tt_account if account in app.connections: # there is a connection to the account app.connections[account].remove_transfer(file_props) if file_props.type_ == 'r': # we receive a file other = file_props.sender else: # we send a file other = file_props.receiver if isinstance(other, str): jid = app.get_jid_without_resource(other) else: # It's a Contact instance jid = other.jid for ev_type in ('file-error', 'file-completed', 'file-request-error', 'file-send-error', 'file-stopped'): for event in app.events.get_events(account, jid, [ev_type]): if event.file_props.sid == file_props.sid: app.events.remove_events(account, jid, event) app.interface.roster.draw_contact(jid, account) app.interface.roster.show_title() FilesProp.deleteFileProp(file_props) del (file_props)
def disconnect(self, connection): if self.host_tester: self.host_tester.disconnect() FilesProp.deleteFileProp(self.host_tester.file_props) self.host_tester = None if self.receiver_tester: self.receiver_tester.disconnect() FilesProp.deleteFileProp(self.receiver_tester.file_props) self.receiver_tester = None try: self.connections.remove(connection) except ValueError: pass if connection == self.active_connection: self.active_connection = None if self.state != S_FINISHED: self.state = S_INITIAL self.try_next_connection()