mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-27 13:31:10 -05:00
RelayNext: Optionally show status prefixes in messages (Closes #38)
This commit is contained in:
parent
867e61ea78
commit
52f0fb2d46
@ -60,6 +60,9 @@ conf.registerChannelValue(RelayNext, 'hostmasks',
|
|||||||
conf.registerChannelValue(RelayNext, 'noHighlight',
|
conf.registerChannelValue(RelayNext, 'noHighlight',
|
||||||
registry.Boolean(False, _("""Determines whether the bot should prefix nicks
|
registry.Boolean(False, _("""Determines whether the bot should prefix nicks
|
||||||
with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions).""")))
|
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.registerGroup(RelayNext, 'antiflood')
|
||||||
conf.registerChannelValue(RelayNext.antiflood, 'enable',
|
conf.registerChannelValue(RelayNext.antiflood, 'enable',
|
||||||
|
@ -115,7 +115,7 @@ class RelayNext(callbacks.Plugin):
|
|||||||
Formats a relay given the IRC object, msg object, and channel.
|
Formats a relay given the IRC object, msg object, and channel.
|
||||||
"""
|
"""
|
||||||
s = ''
|
s = ''
|
||||||
nick = msg.nick
|
nick = real_nick = msg.nick
|
||||||
userhost = ''
|
userhost = ''
|
||||||
noHighlight = self.registryValue('noHighlight', channel)
|
noHighlight = self.registryValue('noHighlight', channel)
|
||||||
useHostmask = self.registryValue('hostmasks', channel)
|
useHostmask = self.registryValue('hostmasks', channel)
|
||||||
@ -151,6 +151,18 @@ class RelayNext(callbacks.Plugin):
|
|||||||
|
|
||||||
elif msg.command == 'PRIVMSG':
|
elif msg.command == 'PRIVMSG':
|
||||||
text = msg.args[1]
|
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):
|
if re.match('^\x01ACTION .*\x01$', text):
|
||||||
text = text[8:-1]
|
text = text[8:-1]
|
||||||
s = '* %s %s' % (nick, text)
|
s = '* %s %s' % (nick, text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user