From 751a3ef921a515726c5b43a51fd8f9a77802813d Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Sun, 18 Dec 2011 14:21:46 +0100 Subject: [PATCH 1/2] Unix: Make configuration variable fortune.short channel-specific --- plugins/Unix/config.py | 2 +- plugins/Unix/plugin.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Unix/config.py b/plugins/Unix/config.py index f37cf37e1..1fd8e7196 100644 --- a/plugins/Unix/config.py +++ b/plugins/Unix/config.py @@ -58,7 +58,7 @@ conf.registerGroup(Unix, 'fortune') conf.registerGlobalValue(Unix.fortune, 'command', registry.String(utils.findBinaryInPath('fortune') or '', _("""Determines what command will be called for the fortune command."""))) -conf.registerGlobalValue(Unix.fortune, 'short', +conf.registerChannelValue(Unix.fortune, 'short', registry.Boolean(True, _("""Determines whether only short fortunes will be used if possible. This sends the -s option to the fortune program."""))) conf.registerGlobalValue(Unix.fortune, 'equal', diff --git a/plugins/Unix/plugin.py b/plugins/Unix/plugin.py index ef46eacbc..c70d86f13 100644 --- a/plugins/Unix/plugin.py +++ b/plugins/Unix/plugin.py @@ -196,10 +196,11 @@ class Unix(callbacks.Plugin): Returns a fortune from the *nix fortune program. """ + channel = msg.args[0] fortuneCmd = self.registryValue('fortune.command') if fortuneCmd: args = [fortuneCmd] - if self.registryValue('fortune.short'): + if self.registryValue('fortune.short', channel): args.append('-s') if self.registryValue('fortune.equal'): args.append('-e') From 8af27f4f64944eeb6dcc50a59f48ecb10a71e3d6 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Sun, 18 Dec 2011 14:24:35 +0100 Subject: [PATCH 2/2] Unix: Make configuration variable fortune.offensive channel-specific --- plugins/Unix/config.py | 2 +- plugins/Unix/plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Unix/config.py b/plugins/Unix/config.py index 1fd8e7196..0da4ec10b 100644 --- a/plugins/Unix/config.py +++ b/plugins/Unix/config.py @@ -66,7 +66,7 @@ conf.registerGlobalValue(Unix.fortune, 'equal', weight to the different fortune databases. If false, then larger databases will be given more weight. This sends the -e option to the fortune program."""))) -conf.registerGlobalValue(Unix.fortune, 'offensive', +conf.registerChannelValue(Unix.fortune, 'offensive', registry.Boolean(False, _("""Determines whether fortune will retrieve offensive fortunes along with the normal fortunes. This sends the -a option to the fortune program."""))) diff --git a/plugins/Unix/plugin.py b/plugins/Unix/plugin.py index c70d86f13..0f5a8c07c 100644 --- a/plugins/Unix/plugin.py +++ b/plugins/Unix/plugin.py @@ -204,7 +204,7 @@ class Unix(callbacks.Plugin): args.append('-s') if self.registryValue('fortune.equal'): args.append('-e') - if self.registryValue('fortune.offensive'): + if self.registryValue('fortune.offensive', channel): args.append('-a') args.extend(self.registryValue('fortune.files')) try: