mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-26 13:01:06 -05:00
supybot.defaultIgnore shouldn't ignore registered users.
Even if they are not trusted. This fixes a regression in 97016b9c55e144ce234fdf67880b57dffc12aac3. This happens because 'user._checkCapability' raises a KeyError when the user has neither this cap or the anticap; which was mistakenly caught here by the 'except KeyError' expecting to catch non-existing users. (And that why 'try' blocks should be limited to as few lines as possible.)
This commit is contained in:
parent
160bcc8b6b
commit
76b5a42428
19
src/ircdb.py
19
src/ircdb.py
@ -1172,18 +1172,25 @@ def checkIgnored(hostmask, recipient='', users=users, channels=channels):
|
|||||||
try:
|
try:
|
||||||
id = users.getUserId(hostmask)
|
id = users.getUserId(hostmask)
|
||||||
user = users.getUser(id)
|
user = users.getUser(id)
|
||||||
if user._checkCapability('trusted'):
|
|
||||||
# Trusted users (including owners) shouldn't ever be ignored.
|
|
||||||
return False
|
|
||||||
elif user.ignore:
|
|
||||||
log.debug('Ignoring %s due to their IrcUser ignore flag.', hostmask)
|
|
||||||
return True
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# If there's no user...
|
# If there's no user...
|
||||||
if conf.supybot.defaultIgnore():
|
if conf.supybot.defaultIgnore():
|
||||||
log.debug('Ignoring %s due to conf.supybot.defaultIgnore',
|
log.debug('Ignoring %s due to conf.supybot.defaultIgnore',
|
||||||
hostmask)
|
hostmask)
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
is_trusted = user._checkCapability('trusted')
|
||||||
|
except KeyError:
|
||||||
|
# neither explicitly trusted or -trusted -> consider them not
|
||||||
|
# trusted
|
||||||
|
is_trusted = False
|
||||||
|
if is_trusted:
|
||||||
|
# Trusted users (including owners) shouldn't ever be ignored.
|
||||||
|
return False
|
||||||
|
elif user.ignore:
|
||||||
|
log.debug('Ignoring %s due to their IrcUser ignore flag.', hostmask)
|
||||||
|
return True
|
||||||
if ignores.checkIgnored(hostmask):
|
if ignores.checkIgnored(hostmask):
|
||||||
log.debug('Ignoring %s due to ignore database.', hostmask)
|
log.debug('Ignoring %s due to ignore database.', hostmask)
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user