Added includeNetwork.

This commit is contained in:
Jeremy Fincher 2004-08-10 15:40:21 +00:00
parent e908b14c64
commit 532ac414a0

View File

@ -83,6 +83,10 @@ conf.registerChannelValue(conf.supybot.plugins.Relay, 'hostmasks',
registry.Boolean(False, """Determines whether the bot will relay the registry.Boolean(False, """Determines whether the bot will relay the
hostmask of the person joining or parting the channel when he or she joins hostmask of the person joining or parting the channel when he or she joins
or parts.""")) or parts."""))
conf.registerChannelValue(conf.supybot.plugins.Relay, 'includeNetwork',
registry.Boolean(True, """Determines whether the bot will include the
network in relayed PRIVMSGs; if you're only relaying between two networks,
it's somewhat redundant, and you may wish to save the space."""))
conf.registerGlobalValue(conf.supybot.plugins.Relay, 'channels', conf.registerGlobalValue(conf.supybot.plugins.Relay, 'channels',
conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot
will relay in.""")) will relay in."""))
@ -348,6 +352,15 @@ class Relay(callbacks.Privmsg):
otherIrc.queueMsg(ircmsgs.whois(nick, nick)) otherIrc.queueMsg(ircmsgs.whois(nick, nick))
self._whois[(otherIrc, nick)] = (irc, msg, {}) self._whois[(otherIrc, nick)] = (irc, msg, {})
def ignore(self, irc, msg, args):
"""[<channel>] <nick|hostmask>
Ignores everything said or done by <nick|hostmask> in <channel>.
<channel> is only necessary if the message isn't sent in the channel
itself.
"""
pass
def do311(self, irc, msg): def do311(self, irc, msg):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)
nick = ircutils.toLower(msg.args[1]) nick = ircutils.toLower(msg.args[1])
@ -443,9 +456,13 @@ class Relay(callbacks.Privmsg):
do401 = do402 do401 = do402
def _formatPrivmsg(self, nick, network, msg): def _formatPrivmsg(self, nick, network, msg):
channel = msg.args[0]
if self.registryValue('includeNetwork', channel):
network = '@' + network
else:
network = ''
# colorize nicks # colorize nicks
color = self.registryValue('color', msg.args[0]) if self.registryValue('color', channel):
if color:
nick = ircutils.IrcString(nick) nick = ircutils.IrcString(nick)
newnick = ircutils.mircColor(nick, *ircutils.canonicalColor(nick)) newnick = ircutils.mircColor(nick, *ircutils.canonicalColor(nick))
colors = ircutils.canonicalColor(nick, shift=4) colors = ircutils.canonicalColor(nick, shift=4)
@ -455,7 +472,7 @@ class Relay(callbacks.Privmsg):
t = ircutils.mircColor('*', *colors) t = ircutils.mircColor('*', *colors)
else: else:
t = '*' t = '*'
s = '%s %s@%s %s' % (t, nick, network, ircmsgs.unAction(msg)) s = '%s %s%s %s' % (t, nick, network, ircmsgs.unAction(msg))
else: else:
if color: if color:
lt = ircutils.mircColor('<', *colors) lt = ircutils.mircColor('<', *colors)
@ -463,7 +480,7 @@ class Relay(callbacks.Privmsg):
else: else:
lt = '<' lt = '<'
gt = '>' gt = '>'
s = '%s%s@%s%s %s' % (lt, nick, network, gt, msg.args[1]) s = '%s%s%s%s %s' % (lt, nick, network, gt, msg.args[1])
return s return s
def _addRelayedMsg(self, msg): def _addRelayedMsg(self, msg):