User.list: add config value plugins.User.listInPrivate to force user list response to be sent in private

This prevents mass-highlights of people who use their IRC nick as their bot username.
This commit is contained in:
jacksonmj 2015-08-22 15:49:14 +00:00
parent b375390bca
commit 3b1c56bbcd
2 changed files with 6 additions and 4 deletions

View File

@ -43,8 +43,9 @@ def configure(advanced):
User = conf.registerPlugin('User')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(User, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
conf.registerGlobalValue(User, 'listInPrivate',
registry.Boolean(True, _("""Determines whether the output of 'user list'
will be sent in private. This prevents mass-highlights of people who use
their nick as their bot username.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -88,7 +88,8 @@ class User(callbacks.Plugin):
users.append(u.name)
if users:
utils.sortBy(str.lower, users)
irc.reply(format('%L', users))
private = self.registryValue("listInPrivate")
irc.reply(format('%L', users), private=private)
else:
if predicates:
irc.reply(_('There are no matching registered users.'))