ChannelLogger: Rewrite relayed nicks. Closes GH-507.

This commit is contained in:
Valentin Lorentz 2013-08-19 17:22:56 +02:00
parent 1724d6867b
commit d14f5df76f

View File

@ -190,10 +190,14 @@ class ChannelLogger(callbacks.Plugin):
ignoreOwner=True) ignoreOwner=True)
except KeyError: except KeyError:
logChannelMessages = True logChannelMessages = True
nick = msg.nick or irc.nick
if msg.tagged('ChannelLogger__relayed'):
(nick, text) = text.split(' ', 1)
nick = nick[1:-1]
msg.args = (recipients, text)
if (noLogPrefix and text.startswith(noLogPrefix)) or \ if (noLogPrefix and text.startswith(noLogPrefix)) or \
not logChannelMessages: not logChannelMessages:
text = '-= THIS MESSAGE NOT LOGGED =-' text = '-= THIS MESSAGE NOT LOGGED =-'
nick = msg.nick or irc.nick
if ircmsgs.isAction(msg): if ircmsgs.isAction(msg):
self.doLog(irc, channel, self.doLog(irc, channel,
'* %s %s\n', nick, ircmsgs.unAction(msg)) '* %s %s\n', nick, ircmsgs.unAction(msg))
@ -280,6 +284,8 @@ class ChannelLogger(callbacks.Plugin):
if msg.command in ('PRIVMSG', 'NOTICE'): if msg.command in ('PRIVMSG', 'NOTICE'):
# Other messages should be sent back to us. # Other messages should be sent back to us.
m = ircmsgs.IrcMsg(msg=msg, prefix=irc.prefix) m = ircmsgs.IrcMsg(msg=msg, prefix=irc.prefix)
if msg.tagged('relayedMsg'):
m.tag('ChannelLogger__relayed')
self(irc, m) self(irc, m)
return msg return msg