mirror of
				https://github.com/Mikaela/Limnoria.git
				synced 2025-10-31 15:47:25 +01:00 
			
		
		
		
	core: make sure owner is never ignored. also simplify the logic flow in ignore checking.
Thanks m4v for the patch! Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
		
							parent
							
								
									18ec61842c
								
							
						
					
					
						commit
						dfdfd00b04
					
				
							
								
								
									
										52
									
								
								src/ircdb.py
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								src/ircdb.py
									
									
									
									
									
								
							| @ -937,46 +937,30 @@ def checkIgnored(hostmask, recipient='', users=users, channels=channels): | ||||
| 
 | ||||
|     Checks if the user is ignored by the recipient of the message. | ||||
|     """ | ||||
|     if ignores.checkIgnored(hostmask): | ||||
|         log.debug('Ignoring %s due to ignore database.', hostmask) | ||||
|         return True | ||||
|     try: | ||||
|         id = users.getUserId(hostmask) | ||||
|         user = users.getUser(id) | ||||
|         if user._checkCapability('owner'): | ||||
|             # Owners shouldn't ever be ignored. | ||||
|             return False | ||||
|         elif user.ignore: | ||||
|             log.debug('Ignoring %s due to his IrcUser ignore flag.', hostmask) | ||||
|             return True | ||||
|     except KeyError: | ||||
|         # If there's no user... | ||||
|         if ircutils.isChannel(recipient): | ||||
|             channel = channels.getChannel(recipient) | ||||
|             if channel.checkIgnored(hostmask): | ||||
|                 log.debug('Ignoring %s due to the channel ignores.', hostmask) | ||||
|                 return True | ||||
|             else: | ||||
|                 return False | ||||
|         else: | ||||
|             if conf.supybot.defaultIgnore(): | ||||
|                 log.debug('Ignoring %s due to conf.supybot.defaultIgnore', | ||||
|                          hostmask) | ||||
|                 return True | ||||
|             else: | ||||
|                 return False | ||||
|     if user._checkCapability('owner'): | ||||
|         # Owners shouldn't ever be ignored. | ||||
|         return False | ||||
|     elif user.ignore: | ||||
|         log.debug('Ignoring %s due to his IrcUser ignore flag.', hostmask) | ||||
|         if conf.supybot.defaultIgnore(): | ||||
|             log.debug('Ignoring %s due to conf.supybot.defaultIgnore', | ||||
|                      hostmask) | ||||
|             return True | ||||
|     if ignores.checkIgnored(hostmask): | ||||
|         log.debug('Ignoring %s due to ignore database.', hostmask) | ||||
|         return True | ||||
|     elif recipient: | ||||
|         if ircutils.isChannel(recipient): | ||||
|             channel = channels.getChannel(recipient) | ||||
|             if channel.checkIgnored(hostmask): | ||||
|                 log.debug('Ignoring %s due to the channel ignores.', hostmask) | ||||
|                 return True | ||||
|             else: | ||||
|                 return False | ||||
|         else: | ||||
|             return False | ||||
|     else: | ||||
|         return False | ||||
|     if ircutils.isChannel(recipient): | ||||
|         channel = channels.getChannel(recipient) | ||||
|         if channel.checkIgnored(hostmask): | ||||
|             log.debug('Ignoring %s due to the channel ignores.', hostmask) | ||||
|             return True | ||||
|     return False | ||||
| 
 | ||||
| def _x(capability, ret): | ||||
|     if isAntiCapability(capability): | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Daniel Folkinshteyn
						Daniel Folkinshteyn