disconnect transfers for contact which goes

offline
This commit is contained in:
Dimitur Kirov 2006-03-21 23:43:26 +00:00
parent f7dd517030
commit 92691fa6f6
2 changed files with 14 additions and 0 deletions

View File

@ -68,6 +68,19 @@ class ConnectionBytestream:
stream_tag.setAttr('jid', streamhost['jid']) stream_tag.setAttr('jid', streamhost['jid'])
self.connection.send(iq) self.connection.send(iq)
def remove_transfers_for_contact(self, contact):
''' stop all active transfer for contact '''
for file_props in self.files_props.values():
receiver_jid = unicode(file_props['receiver']).split('/')[0]
if contact.jid == receiver_jid:
file_props['error'] = -5
self.remove_transfer(file_props)
self.dispatch('FILE_REQUEST_ERROR', (contact.jid, file_props))
sender_jid = unicode(file_props['sender']).split('/')[0]
if contact.jid == sender_jid:
file_props['error'] = -3
self.remove_transfer(file_props)
def remove_all_transfers(self): def remove_all_transfers(self):
''' stops and removes all active connections from the socks5 pool ''' ''' stops and removes all active connections from the socks5 pool '''
for file_props in self.files_props.values(): for file_props in self.files_props.values():

View File

@ -391,6 +391,7 @@ class Interface:
# (when contact signs out or has errors) # (when contact signs out or has errors)
if array[1] in ('offline', 'error'): if array[1] in ('offline', 'error'):
contact1.our_chatstate = contact1.chatstate = contact1.composing_jep = None contact1.our_chatstate = contact1.chatstate = contact1.composing_jep = None
gajim.connections[account].remove_transfers_for_contact(contact1)
self.roster.chg_contact_status(contact1, array[1], array[2], account) self.roster.chg_contact_status(contact1, array[1], array[2], account)
# play sound # play sound
if old_show < 2 and new_show > 1: if old_show < 2 and new_show > 1: