ChannelLogger: Make relayed message rewriting optional.

This commit is contained in:
Valentin Lorentz 2020-05-17 21:05:59 +02:00
parent 75f7479bf4
commit 08f4c781cb
2 changed files with 7 additions and 1 deletions

View File

@ -72,6 +72,10 @@ conf.registerChannelValue(ChannelLogger, 'filenameTimestamp',
for the timestamp are in the time.strftime docs at python.org. In order for the timestamp are in the time.strftime docs at python.org. In order
for your logs to be rotated, you'll also have to enable for your logs to be rotated, you'll also have to enable
supybot.plugins.ChannelLogger.rotateLogs."""))) supybot.plugins.ChannelLogger.rotateLogs.""")))
conf.registerChannelValue(ChannelLogger, 'rewriteRelayed',
registry.Boolean(False, _("""Determines whether the bot will rewrite
outgoing relayed messages (eg. from the Relay plugin) to use the original
nick instead of the bot's nick.""")))
conf.registerGlobalValue(ChannelLogger, 'directories', conf.registerGlobalValue(ChannelLogger, 'directories',
registry.Boolean(True, _("""Determines whether the bot will partition its registry.Boolean(True, _("""Determines whether the bot will partition its

View File

@ -186,7 +186,9 @@ class ChannelLogger(callbacks.Plugin):
except KeyError: except KeyError:
logChannelMessages = True logChannelMessages = True
nick = msg.nick or irc.nick nick = msg.nick or irc.nick
if msg.tagged('ChannelLogger__relayed'): rewriteRelayed = self.registryValue('rewriteRelayed',
channel, irc.network)
if rewriteRelayed and msg.tagged('ChannelLogger__relayed'):
(nick, text) = text.split(' ', 1) (nick, text) = text.split(' ', 1)
nick = nick[1:-1] nick = nick[1:-1]
msg.args = (recipients, text) msg.args = (recipients, text)