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:
		
							parent
							
								
									a49e89c6b5
								
							
						
					
					
						commit
						29852a931f
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -208,6 +208,9 @@ class ConnectionBytestream:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def send_file_rejection(self, file_props):
 | 
						def send_file_rejection(self, file_props):
 | 
				
			||||||
		''' informs sender that we refuse to download the file '''
 | 
							''' 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',
 | 
							iq = common.xmpp.Protocol(name = 'iq',
 | 
				
			||||||
			to = unicode(file_props['sender']), typ = 'error')
 | 
								to = unicode(file_props['sender']), typ = 'error')
 | 
				
			||||||
		iq.setAttr('id', file_props['request-id'])
 | 
							iq.setAttr('id', file_props['request-id'])
 | 
				
			||||||
| 
						 | 
					@ -218,6 +221,9 @@ class ConnectionBytestream:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def send_file_approval(self, file_props):
 | 
						def send_file_approval(self, file_props):
 | 
				
			||||||
		''' send iq, confirming that we want to download the file '''
 | 
							''' 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',
 | 
							iq = common.xmpp.Protocol(name = 'iq',
 | 
				
			||||||
			to = unicode(file_props['sender']), typ = 'result')
 | 
								to = unicode(file_props['sender']), typ = 'result')
 | 
				
			||||||
		iq.setAttr('id', file_props['request-id'])
 | 
							iq.setAttr('id', file_props['request-id'])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue