From 54a6425e553fbe7c7d3943bc31ffb7b2f94b9c35 Mon Sep 17 00:00:00 2001 From: resistivecorpse Date: Sat, 22 Sep 2012 16:01:29 -0400 Subject: [PATCH] adds an on off config option for logging of joins parts and quits in ChannelLogger plugin --- plugins/ChannelLogger/config.py | 2 ++ plugins/ChannelLogger/plugin.py | 35 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/plugins/ChannelLogger/config.py b/plugins/ChannelLogger/config.py index c191f987c..2fe5b0cb4 100644 --- a/plugins/ChannelLogger/config.py +++ b/plugins/ChannelLogger/config.py @@ -48,6 +48,8 @@ conf.registerGlobalValue(ChannelLogger, 'flushImmediately', registry.Boolean(False, _("""Determines whether channel logfiles will be flushed anytime they're written to, rather than being buffered by the operating system."""))) +conf.registerChannelValue(ChannelLogger, 'showJoinParts', + registry.Boolean(True, _("""Determines wether joins and parts are logged"""))) conf.registerChannelValue(ChannelLogger, 'stripFormatting', registry.Boolean(True, _("""Determines whether formatting characters (such as bolding, color, etc.) are removed when writing the logs to disk."""))) diff --git a/plugins/ChannelLogger/plugin.py b/plugins/ChannelLogger/plugin.py index 9512d74e1..ec51b09dd 100644 --- a/plugins/ChannelLogger/plugin.py +++ b/plugins/ChannelLogger/plugin.py @@ -206,10 +206,11 @@ class ChannelLogger(callbacks.Plugin): self.doLog(irc, channel, '*** %s is now known as %s\n', oldNick, newNick) def doJoin(self, irc, msg): - for channel in msg.args[0].split(','): - self.doLog(irc, channel, - '*** %s <%s> has joined %s\n', - msg.nick, msg.prefix, channel) + if(self.registryValue('showJoinParts', msg.args[0])): + for channel in msg.args[0].split(','): + self.doLog(irc, channel, + '*** %s <%s> has joined %s\n', + msg.nick, msg.prefix, channel) def doKick(self, irc, msg): if len(msg.args) == 3: @@ -226,14 +227,15 @@ class ChannelLogger(callbacks.Plugin): '*** %s was kicked by %s\n', target, msg.nick) def doPart(self, irc, msg): - if len(msg.args) > 1: - reason = " (%s)" % msg.args[1] - else: - reason = "" - for channel in msg.args[0].split(','): - self.doLog(irc, channel, - '*** %s <%s> has left %s%s\n', - msg.nick, msg.prefix, channel, reason) + if(self.registryValue('showJoinParts', msg.args[0])): + if len(msg.args) > 1: + reason = " (%s)" % msg.args[1] + else: + reason = "" + for channel in msg.args[0].split(','): + self.doLog(irc, channel, + '*** %s <%s> has left %s%s\n', + msg.nick, msg.prefix, channel, reason) def doMode(self, irc, msg): channel = msg.args[0] @@ -258,10 +260,11 @@ class ChannelLogger(callbacks.Plugin): if not isinstance(irc, irclib.Irc): irc = irc.getRealIrc() for (channel, chan) in self.lastStates[irc].channels.iteritems(): - if msg.nick in chan.users: - self.doLog(irc, channel, - '*** %s <%s> has quit IRC%s\n', - msg.nick, msg.prefix, reason) + if(self.registryValue('showJoinParts', msg.args[0])): + if msg.nick in chan.users: + self.doLog(irc, channel, + '*** %s <%s> has quit IRC%s\n', + msg.nick, msg.prefix, reason) def outFilter(self, irc, msg): # Gotta catch my own messages *somehow* :)