diff --git a/RelayNext/config.py b/RelayNext/config.py index 70089b0..ea3d237 100644 --- a/RelayNext/config.py +++ b/RelayNext/config.py @@ -60,6 +60,9 @@ conf.registerChannelValue(RelayNext, 'hostmasks', conf.registerChannelValue(RelayNext, 'noHighlight', registry.Boolean(False, _("""Determines whether the bot should prefix nicks with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions)."""))) +conf.registerChannelValue(RelayNext, 'showPrefixes', + registry.Boolean(False, _("""Determines whether the bot should status prefixes + (@, %, +) when relaying."""))) conf.registerGroup(RelayNext, 'antiflood') conf.registerChannelValue(RelayNext.antiflood, 'enable', diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 33390da..b0e9d95 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -115,7 +115,7 @@ class RelayNext(callbacks.Plugin): Formats a relay given the IRC object, msg object, and channel. """ s = '' - nick = msg.nick + nick = real_nick = msg.nick userhost = '' noHighlight = self.registryValue('noHighlight', channel) useHostmask = self.registryValue('hostmasks', channel) @@ -151,6 +151,18 @@ class RelayNext(callbacks.Plugin): elif msg.command == 'PRIVMSG': text = msg.args[1] + + # Show status prefixes (@%+) in front of the nick if enabled, + # but only the highest prefix. + if self.registryValue("showPrefixes", channel): + chobj = irc.state.channels[channel] + if chobj.isOp(real_nick): + nick = '@' + nick + elif chobj.isHalfop(real_nick): + nick = '%' + nick + elif chobj.isVoice(real_nick): + nick = '+' + nick + if re.match('^\x01ACTION .*\x01$', text): text = text[8:-1] s = '* %s %s' % (nick, text)