Channel: prevent mass-highlights with 'nicks' by defaulting the output to private

This adds a new config variable plugins.Channel.nicksInPrivate.

Cherry-picked from commit GLolol@2cc9e9d.
This commit is contained in:
James Lu 2015-02-01 20:52:00 -05:00 committed by GLolol
parent 681bd5d85d
commit c06ed45983
2 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,10 @@ Channel = conf.registerPlugin('Channel')
conf.registerChannelValue(Channel, 'alwaysRejoin', conf.registerChannelValue(Channel, 'alwaysRejoin',
registry.Boolean(True, _("""Determines whether the bot will always try to registry.Boolean(True, _("""Determines whether the bot will always try to
rejoin a channel whenever it's kicked from the channel."""))) rejoin a channel whenever it's kicked from the channel.""")))
conf.registerChannelValue(Channel, 'nicksInPrivate',
registry.Boolean(True, _("""Determines whether the output of 'nicks' will
be sent in private. This prevents mass-highlights of a channel's users,
accidental or on purpose.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -910,7 +910,8 @@ class Channel(callbacks.Plugin):
keys = [option for (option, arg) in optlist] keys = [option for (option, arg) in optlist]
if 'count' not in keys: if 'count' not in keys:
utils.sortBy(str.lower, L) utils.sortBy(str.lower, L)
irc.reply(utils.str.commaAndify(L)) private = self.registryValue("nicksInPrivate", channel)
irc.reply(utils.str.commaAndify(L), private=private)
else: else:
irc.reply(str(len(L))) irc.reply(str(len(L)))
nicks = wrap(nicks, ['inChannel', nicks = wrap(nicks, ['inChannel',