mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 12:31:04 -05:00
When only --account is provided, fallback to supybot.protocols.irc.banmask before exact mask
This commit is contained in:
parent
cf63674f7c
commit
54f7b5a5b6
@ -237,7 +237,17 @@ class ChannelTestCase(ChannelPluginTestCase):
|
||||
'foobar!user@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
'*!*@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['user', 'host']):
|
||||
# falls back from --account to config
|
||||
self.assertKban('kban --account foobar',
|
||||
'*!user@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['account']):
|
||||
# falls back from --account to config, then to exact hostmask
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account --host foobar',
|
||||
'*!*@host.domain.tld')
|
||||
@ -259,7 +269,17 @@ class ChannelTestCase(ChannelPluginTestCase):
|
||||
'foobar!user@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
'*!*@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['user', 'host']):
|
||||
# falls back from --account to config
|
||||
self.assertKban('kban --account foobar',
|
||||
'*!user@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['account']):
|
||||
# falls back from --account to config, then to exact hostmask
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account --host foobar',
|
||||
'*!*@host.domain.tld')
|
||||
|
11
src/conf.py
11
src/conf.py
@ -1302,6 +1302,17 @@ class Banmask(registry.SpaceSeparatedSetOfStrings):
|
||||
if add_star_mask and (bnick, buser, bhost) != ('*', '*', '*'):
|
||||
masks.append(ircutils.joinHostmask(bnick, buser, bhost))
|
||||
|
||||
if (bnick, buser, bhost) == ('*', '*', '*') and \
|
||||
options == ['account'] and \
|
||||
not masks:
|
||||
# found no ban mask to set (because options == ['account'] and user
|
||||
# is logged out?), try again with the default ban mask
|
||||
options = supybot.protocols.irc.banmask.getSpecific(
|
||||
network, channel)()
|
||||
options = [option for option in options if option != 'account']
|
||||
return self.makeExtBanmasks(
|
||||
hostmask, options=options, channel=channel, network=network)
|
||||
|
||||
if (bnick, buser, bhost) == ('*', '*', '*') and \
|
||||
ircutils.isUserHostmask(hostmask) and \
|
||||
not masks:
|
||||
|
Loading…
x
Reference in New Issue
Block a user