mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +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)
|
getChannel(irc, msg, args, state)
|
||||||
channel = state.channel
|
channel = state.channel
|
||||||
banmaskstyle = conf.supybot.protocols.irc.banmask
|
banmaskstyle = conf.supybot.protocols.irc.banmask
|
||||||
try:
|
|
||||||
state.args[-1] = banmaskstyle.makeBanmask(state.args[-1])
|
state.args[-1] = banmaskstyle.makeBanmask(state.args[-1])
|
||||||
except AssertionError:
|
|
||||||
state.errorInvalid('channel', channel)
|
|
||||||
|
|
||||||
def getUser(irc, msg, args, state):
|
def getUser(irc, msg, args, state):
|
||||||
try:
|
try:
|
||||||
|
@ -926,20 +926,17 @@ class Banmask(registry.SpaceSeparatedSetOfStrings):
|
|||||||
isn't specified via options, the value of
|
isn't specified via options, the value of
|
||||||
conf.supybot.protocols.irc.banmask is used.
|
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
|
options - A list specifying which parts of the hostmask should
|
||||||
explicitly be matched: nick, user, host. If 'exact' is given, then
|
explicitly be matched: nick, user, host. If 'exact' is given, then
|
||||||
only the exact hostmask will be used."""
|
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)
|
(nick, user, host) = ircutils.splitHostmask(hostmask)
|
||||||
bnick = '*'
|
bnick = '*'
|
||||||
buser = '*'
|
buser = '*'
|
||||||
bhost = '*'
|
bhost = '*'
|
||||||
if not options:
|
if not options:
|
||||||
options = get(supybot.protocols.irc.banmask, dynamic.channel)
|
options = get(supybot.protocols.irc.banmask, channel)
|
||||||
for option in options:
|
for option in options:
|
||||||
if option == 'nick':
|
if option == 'nick':
|
||||||
bnick = nick
|
bnick = nick
|
||||||
|
Loading…
Reference in New Issue
Block a user