Ejemplo n.º 1
0
 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 gajim.connections:
             # there is a connection to the account
             gajim.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 = gajim.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 gajim.events.get_events(account, jid, [ev_type]):
                 if event.file_props.sid == file_props.sid:
                     gajim.events.remove_events(account, jid, event)
                     gajim.interface.roster.draw_contact(jid, account)
                     gajim.interface.roster.show_title()
     FilesProp.deleteFileProp(file_props)
     del(file_props)
Ejemplo n.º 2
0
 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 gajim.connections:
             # there is a connection to the account
             gajim.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 = gajim.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 gajim.events.get_events(account, jid, [ev_type]):
                 if event.parameters.sid == file_props.sid:
                     gajim.events.remove_events(account, jid, event)
                     gajim.interface.roster.draw_contact(jid, account)
                     gajim.interface.roster.show_title()
     FilesProp.deleteFileProp(file_props)
     del(file_props)
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
 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()