From 03c7e1e1d357fe8d156a85021613c9f303b084e1 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 13 May 2011 18:25:40 +0200 Subject: [PATCH] LinkRelay: many fixes --- LinkRelay/config.py | 9 ++++----- LinkRelay/plugin.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/LinkRelay/config.py b/LinkRelay/config.py index e2960e7..d9be3d1 100644 --- a/LinkRelay/config.py +++ b/LinkRelay/config.py @@ -75,10 +75,10 @@ conf.registerChannelValue(LinkRelay, 'includeNetwork', class ValidNonPrivmsgsHandling(registry.OnlySomeStrings): validStrings = ('privmsg', 'notice', 'nothing') conf.registerChannelValue(LinkRelay, 'nonPrivmsgs', - registry.Boolean('privmsg', _("""Determines whether the bot will use - PRIVMSGs (privmsg), NOTICEs (notice), for non-PRIVMSG Relay messages - (i.e., joins, parts, nicks, quits, modes, etc.), or whether it won't relay - such messages (nothing)"""))) + ValidNonPrivmsgsHandling('privmsg', _("""Determines whether the + bot will use PRIVMSGs (privmsg), NOTICEs (notice), for non-PRIVMSG Relay + messages (i.e., joins, parts, nicks, quits, modes, etc.), or whether it + won't relay such messages (nothing)"""))) conf.registerGlobalValue(LinkRelay, 'relays', registry.String('', _("""You shouldn't edit this configuration variable @@ -90,7 +90,6 @@ conf.registerGlobalValue(LinkRelay, 'substitutes', conf.registerGroup(LinkRelay, 'colors') for name, color in {'info': '02', - 'msg': '14', 'truncated': '14', 'mode': '14', 'join': '14', diff --git a/LinkRelay/plugin.py b/LinkRelay/plugin.py index a2b4428..94d1276 100644 --- a/LinkRelay/plugin.py +++ b/LinkRelay/plugin.py @@ -129,10 +129,9 @@ class LinkRelay(callbacks.Plugin): s = '* %s %s' % (nick, text) else: if colored: - s = '\x03%s<%s%s\x0314>\x03 %s' % \ - (self.registryValue('colors.msg'), color, nick, text) + s = '%s<%s%s\x0314>\x03 %s' % (color, nick, text) else: - s = '<%s%s> %s' % (color, nick, text) + s = '<%s> %s' % (nick, text) return s @@ -155,13 +154,14 @@ class LinkRelay(callbacks.Plugin): relay.sourceNetwork, relay.targetChannel, relay.targetNetwork, - hasIRC))) + hasIRC)) def doPrivmsg(self, irc, msg): self.addIRC(irc) channel = msg.args[0] s = msg.args[1] - s = self.formatPrivMsg(msg.nick, s) + s = self.formatPrivMsg(msg.nick, s, + self.registryValue('color', channel)) if channel not in irc.state.channels: # in private # cuts off the end of commands, so that passwords # won't be revealed in relayed PM's @@ -181,7 +181,8 @@ class LinkRelay(callbacks.Plugin): if msg.command == 'PRIVMSG': if not msg.relayedMsg: if msg.args[0] in irc.state.channels: - s = self.formatPrivMsg(irc.nick, msg.args[1]) + s = self.formatPrivMsg(irc.nick, msg.args[1], + self.registryValue('color', msg.args[0])) self.sendToOthers(irc, msg.args[0], s, isPrivmsg=True) return msg @@ -274,8 +275,7 @@ class LinkRelay(callbacks.Plugin): elif self.registryValue('nonPrivmsgs', channel) == 'notice': msg = ircmsgs.notice(relay.targetChannel, s) else: - # nothing - pass + return msg.tag('relayedMsg') relay.targetIRC.sendMsg(msg)