mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
More ignorance can never hurt.
Added supybot.plugins.Relay.ignores, a channel configuration variable that allows people to specify hostmasks that are ignored.
This commit is contained in:
parent
203491e7c3
commit
3a7202bfbe
@ -44,6 +44,10 @@ def configure(advanced):
|
|||||||
use the 'start' command followed by the 'connect' command. Use the 'help'
|
use the 'start' command followed by the 'connect' command. Use the 'help'
|
||||||
command to see how these two commands should be used.""")
|
command to see how these two commands should be used.""")
|
||||||
|
|
||||||
|
class Ignores(registry.SpaceSeparatedListOf):
|
||||||
|
List = ircutils.IrcSet
|
||||||
|
Value = conf.ValidHostmask
|
||||||
|
|
||||||
class Networks(registry.SpaceSeparatedListOf):
|
class Networks(registry.SpaceSeparatedListOf):
|
||||||
List = ircutils.IrcSet
|
List = ircutils.IrcSet
|
||||||
Value = registry.String
|
Value = registry.String
|
||||||
@ -69,10 +73,13 @@ conf.registerChannelValue(Relay, 'punishOtherRelayBots',
|
|||||||
conf.registerGlobalValue(Relay, 'channels',
|
conf.registerGlobalValue(Relay, 'channels',
|
||||||
conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot
|
conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot
|
||||||
will relay in."""))
|
will relay in."""))
|
||||||
conf.registerChannelValue(Relay.channels,
|
conf.registerChannelValue(Relay.channels, 'joinOnAllNetworks',
|
||||||
'joinOnAllNetworks', registry.Boolean(True, """Determines whether the bot
|
registry.Boolean(True, """Determines whether the bot
|
||||||
will always join the channel(s) it relays for on all networks the bot is
|
will always join the channel(s) it relays for on all networks the bot is
|
||||||
connected to."""))
|
connected to."""))
|
||||||
|
conf.registerChannelValue(Relay, 'ignores',
|
||||||
|
Ignores([], """Determines what hostmasks will not be relayed on a
|
||||||
|
channel."""))
|
||||||
conf.registerChannelValue(Relay, 'noticeNonPrivmsgs',
|
conf.registerChannelValue(Relay, 'noticeNonPrivmsgs',
|
||||||
registry.Boolean(False, """Determines whether the bot will used NOTICEs
|
registry.Boolean(False, """Determines whether the bot will used NOTICEs
|
||||||
rather than PRIVMSGs for non-PRIVMSG relay messages (i.e., joins, parts,
|
rather than PRIVMSGs for non-PRIVMSG relay messages (i.e., joins, parts,
|
||||||
|
@ -344,6 +344,12 @@ class Relay(callbacks.Privmsg):
|
|||||||
irc = self._getRealIrc(irc)
|
irc = self._getRealIrc(irc)
|
||||||
if channel not in self.registryValue('channels'):
|
if channel not in self.registryValue('channels'):
|
||||||
return
|
return
|
||||||
|
ignores = self.registryValue('ignores', channel)
|
||||||
|
for ignore in ignores:
|
||||||
|
if ircutils.hostmaskPatternEqual(ignore, msg.prefix):
|
||||||
|
self.log.debug('Refusing to relay %s, ignored by %s.',
|
||||||
|
msg.prefix, ignore)
|
||||||
|
return
|
||||||
if ircmsgs.isCtcp(msg) and \
|
if ircmsgs.isCtcp(msg) and \
|
||||||
'AWAY' not in text and 'ACTION' not in text:
|
'AWAY' not in text and 'ACTION' not in text:
|
||||||
return
|
return
|
||||||
|
@ -176,6 +176,13 @@ class ValidChannel(registry.String):
|
|||||||
else:
|
else:
|
||||||
registry.String.setValue(self, v)
|
registry.String.setValue(self, v)
|
||||||
|
|
||||||
|
class ValidHostmask(registry.String):
|
||||||
|
"""Value must be a valid user hostmask."""
|
||||||
|
def setValue(self, v):
|
||||||
|
if not ircutils.isUserHostmask(v):
|
||||||
|
self.error()
|
||||||
|
super(ValidHostmask, self).setValue(v)
|
||||||
|
|
||||||
registerGlobalValue(supybot, 'nick',
|
registerGlobalValue(supybot, 'nick',
|
||||||
ValidNick('supybot', """Determines the bot's default nick."""))
|
ValidNick('supybot', """Determines the bot's default nick."""))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user