Add a couple more options to supybot.unix.fortune

This commit is contained in:
James Vega 2004-08-31 16:20:01 +00:00
parent ec3a76c607
commit bb4d3cda49

View File

@ -93,6 +93,13 @@ conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'command',
conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'short', conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'short',
registry.Boolean(True, """Determines whether only short fortunes will be registry.Boolean(True, """Determines whether only short fortunes will be
used if possible.""")) used if possible."""))
conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'equalWeight',
registry.Boolean(True, """Determines whether fortune will give equal
weight to the different fortune databases. If false, then larger
databases will be given more weight."""))
conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'offensive',
registry.Boolean(False, """Determines whether fortune will retrieve
offensive fortunes along with the normal fortunes."""))
conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'files', conf.registerGlobalValue(conf.supybot.plugins.Unix.fortune, 'files',
registry.SpaceSeparatedListOfStrings([], """Determines what specific file registry.SpaceSeparatedListOfStrings([], """Determines what specific file
(if any) will be used with the fortune command; if none is given, the (if any) will be used with the fortune command; if none is given, the
@ -222,7 +229,11 @@ class Unix(callbacks.Privmsg):
args = [fortuneCmd] args = [fortuneCmd]
if self.registryValue('fortune.short'): if self.registryValue('fortune.short'):
args.append('-s') args.append('-s')
args.extend(self.registryValue('fortune.files'))) if self.registryValue('fortune.equalWeight'):
args.append('-e')
if self.registryValue('fortune.offensive'):
args.append('-a')
args.extend(self.registryValue('fortune.files'))
(r, w) = popen2.popen4(args) (r, w) = popen2.popen4(args)
try: try:
lines = r.readlines() lines = r.readlines()