pass "" in os.system after command (so shell dont touch the argument) Also added a fixme for when we go 2.4+ so we can use subproccess module
This commit is contained in:
		
							parent
							
								
									fd0bfbc59b
								
							
						
					
					
						commit
						3dbe1ccd23
					
				
					 1 changed files with 22 additions and 19 deletions
				
			
		
							
								
								
									
										41
									
								
								src/gajim.py
									
										
									
									
									
								
							
							
						
						
									
										41
									
								
								src/gajim.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -129,26 +129,27 @@ class Interface:
 | 
			
		|||
		#kind = 'url' or 'mail'
 | 
			
		||||
		if os.name == 'nt':
 | 
			
		||||
			try:
 | 
			
		||||
				os.startfile(url) # if pywin32 is installed we open
 | 
			
		||||
				os.startfile(uri) # if pywin32 is installed we open
 | 
			
		||||
			except:
 | 
			
		||||
				pass
 | 
			
		||||
		else:
 | 
			
		||||
			if gajim.config.get('openwith') == 'gnome-open':
 | 
			
		||||
				command = 'gnome-open'
 | 
			
		||||
			elif gajim.config.get('openwith') == 'kfmclient exec':
 | 
			
		||||
				command = 'kfmclient exec'
 | 
			
		||||
			elif gajim.config.get('openwith') == 'custom':
 | 
			
		||||
				if kind == 'url':
 | 
			
		||||
					command = gajim.config.get('custombrowser')
 | 
			
		||||
				if kind == 'mail':
 | 
			
		||||
					command = gajim.config.get('custommailapp')
 | 
			
		||||
				if command == '': # if no app is configured
 | 
			
		||||
					return
 | 
			
		||||
			# we add the uri in "" so we have good parsing from shell
 | 
			
		||||
			command = command + ' "' + uri + '" &'
 | 
			
		||||
			try: #FIXME: when we require 2.4+ use subprocess module
 | 
			
		||||
				os.system(command)
 | 
			
		||||
			except:
 | 
			
		||||
				pass
 | 
			
		||||
			return
 | 
			
		||||
		if gajim.config.get('openwith') == 'gnome-open':
 | 
			
		||||
			command = 'gnome-open'
 | 
			
		||||
		elif gajim.config.get('openwith') == 'kfmclient exec':
 | 
			
		||||
			command = 'kfmclient exec'
 | 
			
		||||
		elif gajim.config.get('openwith') == 'custom':
 | 
			
		||||
			if kind == 'url':
 | 
			
		||||
				command = gajim.config.get('custombrowser')
 | 
			
		||||
			if kind == 'mail':
 | 
			
		||||
				command = gajim.config.get('custommailapp')
 | 
			
		||||
			if command == '': # if no app is configured
 | 
			
		||||
				return
 | 
			
		||||
		command = command + ' ' + uri + ' &'
 | 
			
		||||
		try:
 | 
			
		||||
			os.system(command)
 | 
			
		||||
		except:
 | 
			
		||||
			pass
 | 
			
		||||
 | 
			
		||||
	def play_sound(self, event):
 | 
			
		||||
		if not gajim.config.get('sounds_on'):
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +167,9 @@ class Interface:
 | 
			
		|||
			if gajim.config.get('soundplayer') == '':
 | 
			
		||||
				return
 | 
			
		||||
			player = gajim.config.get('soundplayer')
 | 
			
		||||
			command = player + ' ' + path_to_soundfile + ' &'
 | 
			
		||||
			# we add the path in "" so we have good parsing from shell
 | 
			
		||||
			command = player + ' "' + path_to_soundfile + '" &'
 | 
			
		||||
			#FIXME: when we require 2.4+ use subprocess module
 | 
			
		||||
			os.system(command)
 | 
			
		||||
 | 
			
		||||
	def handle_event_roster(self, account, data):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue