From e68704a0fc98a47dccbeae2bacb3bfcf4ad36b1c Mon Sep 17 00:00:00 2001 From: Daniel Folkinshteyn Date: Sun, 11 Apr 2010 12:48:08 -0400 Subject: [PATCH] topic now checks for +t mode before denying topic changes, and also allows halfops in addition to ops. default required capabilities for topic changes (if topic is +t and user is not an op or halfop), are chan,op and chan,halfop thanks jemfinch for the suggestions. --- plugins/Topic/config.py | 2 +- plugins/Topic/plugin.py | 2 +- plugins/Topic/test.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/Topic/config.py b/plugins/Topic/config.py index 3ddfff93b..4a3712ed6 100644 --- a/plugins/Topic/config.py +++ b/plugins/Topic/config.py @@ -66,7 +66,7 @@ conf.registerChannelValue(Topic.undo, 'max', registry.NonNegativeInteger(10, _("""Determines the number of previous topics to keep around in case the undo command is called."""))) conf.registerChannelValue(Topic, 'requireManageCapability', - registry.String('admin; channel,op', _("""Determines the + registry.String('channel,op; channel,halfop', _("""Determines the capabilities required (if any) to make any topic changes, (everything except for read-only operations). Use 'channel,capab' for channel-level capabilities. diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index 221919b6b..0ef60cb31 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -219,7 +219,7 @@ class Topic(callbacks.Plugin): manually anyway. """ c = irc.state.channels[channel] - if msg.nick in c.ops: + if msg.nick in c.ops or msg.nick in c.halfops or 't' not in c.modes: return True capabilities = self.registryValue('requireManageCapability') if capabilities: diff --git a/plugins/Topic/test.py b/plugins/Topic/test.py index bb41662da..d6b7be816 100644 --- a/plugins/Topic/test.py +++ b/plugins/Topic/test.py @@ -73,6 +73,10 @@ class TopicTestCase(ChannelPluginTestCase): def testManageCapabilities(self): try: + self.irc.feedMsg(ircmsgs.mode(self.channel, args=('+o', self.nick), + prefix=self.prefix)) + self.irc.feedMsg(ircmsgs.mode(self.channel, args=('+t'), + prefix=self.prefix)) world.testing = False origuser = self.prefix self.prefix = 'stuff!stuff@stuff'