fix previous commit, Ban objects are never going to be of other type than ban and quiet.
This commit is contained in:
parent
800a228d92
commit
b8225fd507
|
@ -245,16 +245,7 @@ class Ban(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
mask = self.mask
|
return guessBanType(self.mask)
|
||||||
if mask[0] == '%':
|
|
||||||
return 'quiet'
|
|
||||||
elif ircutils.isUserHostmask(mask) or mask.endswith('(realname)'):
|
|
||||||
if not ('*' in mask or '?' in mask or '$' in mask):
|
|
||||||
# XXX hack over hack, we are supposing these are marks as normal
|
|
||||||
# bans aren't usually set to exact match, while marks are.
|
|
||||||
return 'mark'
|
|
||||||
return 'ban'
|
|
||||||
return 'removal'
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
id = self.id
|
id = self.id
|
||||||
|
@ -274,6 +265,18 @@ class Ban(object):
|
||||||
self.ascwhen = time.asctime(time.gmtime(self.when))
|
self.ascwhen = time.asctime(time.gmtime(self.when))
|
||||||
|
|
||||||
|
|
||||||
|
def guessBanType(mask):
|
||||||
|
if mask[0] == '%':
|
||||||
|
return 'quiet'
|
||||||
|
elif ircutils.isUserHostmask(mask) or mask.endswith('(realname)'):
|
||||||
|
if not ('*' in mask or '?' in mask or '$' in mask):
|
||||||
|
# XXX hack over hack, we are supposing these are marks as normal
|
||||||
|
# bans aren't usually set to exact match, while marks are.
|
||||||
|
return 'mark'
|
||||||
|
return 'ban'
|
||||||
|
return 'removal'
|
||||||
|
|
||||||
|
|
||||||
class ReviewStore(dict):
|
class ReviewStore(dict):
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
self.filename = conf.supybot.directories.data.dirize(filename)
|
self.filename = conf.supybot.directories.data.dirize(filename)
|
||||||
|
@ -1455,6 +1458,11 @@ class Bantracker(callbacks.Plugin):
|
||||||
return
|
return
|
||||||
|
|
||||||
mask, channel, removal = L[0]
|
mask, channel, removal = L[0]
|
||||||
|
type = guessBanType(mask)
|
||||||
|
if type not in ('ban', 'quiet'):
|
||||||
|
irc.reply("Id %s is a %s, only bans or quiets can be autoremoved." % (id, type))
|
||||||
|
return
|
||||||
|
|
||||||
if removal:
|
if removal:
|
||||||
irc.reply("Ban '%s' was already removed in %s." % (mask, channel))
|
irc.reply("Ban '%s' was already removed in %s." % (mask, channel))
|
||||||
return
|
return
|
||||||
|
@ -1469,10 +1477,6 @@ class Bantracker(callbacks.Plugin):
|
||||||
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
|
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
|
||||||
return
|
return
|
||||||
|
|
||||||
if ban.type not in ('ban', 'quiet'):
|
|
||||||
irc.reply("Id %s is a %s, only bans or quiets can be autoremoved." \
|
|
||||||
% (id, ban.type))
|
|
||||||
return
|
|
||||||
|
|
||||||
self.managedBans.add(BanRemoval(ban, seconds))
|
self.managedBans.add(BanRemoval(ban, seconds))
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
|
Loading…
Reference in New Issue