mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
core: make sure owner is never ignored. also simplify the logic flow in ignore checking.
Thanks m4v for the patch!
This commit is contained in:
parent
6d1cf739ab
commit
a98b2df392
34
src/ircdb.py
34
src/ircdb.py
@ -946,45 +946,29 @@ def checkIgnored(hostmask, recipient='', users=users, channels=channels):
|
|||||||
|
|
||||||
Checks if the user is ignored by the recipient of the message.
|
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:
|
try:
|
||||||
id = users.getUserId(hostmask)
|
id = users.getUserId(hostmask)
|
||||||
user = users.getUser(id)
|
user = users.getUser(id)
|
||||||
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'):
|
if user._checkCapability('owner'):
|
||||||
# Owners shouldn't ever be ignored.
|
# Owners shouldn't ever be ignored.
|
||||||
return False
|
return False
|
||||||
elif user.ignore:
|
elif user.ignore:
|
||||||
log.debug('Ignoring %s due to his IrcUser ignore flag.', hostmask)
|
log.debug('Ignoring %s due to his IrcUser ignore flag.', hostmask)
|
||||||
return True
|
return True
|
||||||
elif recipient:
|
except KeyError:
|
||||||
|
# If there's no user...
|
||||||
|
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
|
||||||
if ircutils.isChannel(recipient):
|
if ircutils.isChannel(recipient):
|
||||||
channel = channels.getChannel(recipient)
|
channel = channels.getChannel(recipient)
|
||||||
if channel.checkIgnored(hostmask):
|
if channel.checkIgnored(hostmask):
|
||||||
log.debug('Ignoring %s due to the channel ignores.', hostmask)
|
log.debug('Ignoring %s due to the channel ignores.', hostmask)
|
||||||
return True
|
return True
|
||||||
else:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _x(capability, ret):
|
def _x(capability, ret):
|
||||||
|
Loading…
Reference in New Issue
Block a user