diff --git a/src/commands.py b/src/commands.py index f1e4fd591..483d3151d 100644 --- a/src/commands.py +++ b/src/commands.py @@ -280,10 +280,7 @@ def getBanmask(irc, msg, args, state): getChannel(irc, msg, args, state) channel = state.channel banmaskstyle = conf.supybot.protocols.irc.banmask - try: - state.args[-1] = banmaskstyle.makeBanmask(state.args[-1]) - except AssertionError: - state.errorInvalid('channel', channel) + state.args[-1] = banmaskstyle.makeBanmask(state.args[-1]) def getUser(irc, msg, args, state): try: diff --git a/src/conf.py b/src/conf.py index 2ca991fd7..b343b08c5 100644 --- a/src/conf.py +++ b/src/conf.py @@ -929,20 +929,17 @@ class Banmask(registry.SpaceSeparatedSetOfStrings): isn't specified via options, the value of conf.supybot.protocols.irc.banmask is used. - A variable named 'channel' (defining the channel the ban is taking - place in) is expected to be in the environment of the caller of this - function. - options - A list specifying which parts of the hostmask should explicitly be matched: nick, user, host. If 'exact' is given, then only the exact hostmask will be used.""" - assert ircutils.isChannel(dynamic.channel) + channel = dynamic.channel + assert channel is None or ircutils.isChannel(channel) (nick, user, host) = ircutils.splitHostmask(hostmask) bnick = '*' buser = '*' bhost = '*' if not options: - options = get(supybot.protocols.irc.banmask, dynamic.channel) + options = get(supybot.protocols.irc.banmask, channel) for option in options: if option == 'nick': bnick = nick