mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Allow Banmask.makeBanmask to work when dynamic.channel is None.
This gives back the ability to generate a banmask based on the global banmask
settings instead of per-channel settings.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 8a98653d3b
)
This commit is contained in:
parent
c53f8cd510
commit
9ddf07ce97
@ -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:
|
||||
|
@ -926,20 +926,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
|
||||
|
Loading…
Reference in New Issue
Block a user