don't try to send if connection is down

(this check should be done in all functions
 that may come from user response to dialogs)
This commit is contained in:
Dimitur Kirov 2006-04-08 16:40:43 +00:00
parent a49e89c6b5
commit 29852a931f
1 changed files with 6 additions and 0 deletions

View File

@ -208,6 +208,9 @@ class ConnectionBytestream:
def send_file_rejection(self, file_props):
''' informs sender that we refuse to download the file '''
# user response to ConfirmationDialog may come after we've disconneted
if not self.connection or self.connected < 2:
return
iq = common.xmpp.Protocol(name = 'iq',
to = unicode(file_props['sender']), typ = 'error')
iq.setAttr('id', file_props['request-id'])
@ -218,6 +221,9 @@ class ConnectionBytestream:
def send_file_approval(self, file_props):
''' send iq, confirming that we want to download the file '''
# user response to ConfirmationDialog may come after we've disconneted
if not self.connection or self.connected < 2:
return
iq = common.xmpp.Protocol(name = 'iq',
to = unicode(file_props['sender']), typ = 'result')
iq.setAttr('id', file_props['request-id'])