2005-02-02 07:45:35 +01:00
|
|
|
###
|
|
|
|
# Copyright (c) 2005, Jeremiah Fincher
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the author of this software nor the name of
|
|
|
|
# contributors to this software may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written consent.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
###
|
|
|
|
|
|
|
|
import supybot.conf as conf
|
|
|
|
import supybot.ircutils as ircutils
|
|
|
|
import supybot.registry as registry
|
2010-10-19 19:50:41 +02:00
|
|
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
|
|
|
_ = PluginInternationalization('Relay')
|
2005-02-02 07:45:35 +01:00
|
|
|
|
|
|
|
def configure(advanced):
|
|
|
|
from supybot.questions import output, expect, anything, something, yn
|
|
|
|
conf.registerPlugin('Relay', True)
|
2010-10-19 19:50:41 +02:00
|
|
|
if yn(_('Would you like to relay between any channels?')):
|
2014-07-13 17:25:58 +02:00
|
|
|
channels = anything(_('What channels? Separate them by spaces.'))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.supybot.plugins.Relay.channels.set(channels)
|
2010-10-19 19:50:41 +02:00
|
|
|
if yn(_('Would you like to use color to distinguish between nicks?')):
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.supybot.plugins.Relay.color.setValue(True)
|
|
|
|
output("""Right now there's no way to configure the actual connection to
|
|
|
|
the server. What you'll need to do when the bot finishes starting up is
|
|
|
|
use the 'start' command followed by the 'connect' command. Use the 'help'
|
|
|
|
command to see how these two commands should be used.""")
|
|
|
|
|
2005-02-09 01:39:11 +01:00
|
|
|
class Ignores(registry.SpaceSeparatedListOf):
|
|
|
|
List = ircutils.IrcSet
|
|
|
|
Value = conf.ValidHostmask
|
|
|
|
|
2005-02-02 07:45:35 +01:00
|
|
|
class Networks(registry.SpaceSeparatedListOf):
|
|
|
|
List = ircutils.IrcSet
|
|
|
|
Value = registry.String
|
|
|
|
|
|
|
|
Relay = conf.registerPlugin('Relay')
|
|
|
|
conf.registerChannelValue(Relay, 'color',
|
2014-05-11 15:41:06 +02:00
|
|
|
registry.Boolean(True, _("""Determines whether the bot will color relayed
|
2010-10-19 19:50:41 +02:00
|
|
|
PRIVMSGs so as to make the messages easier to read.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerChannelValue(Relay, 'topicSync',
|
2010-10-19 19:50:41 +02:00
|
|
|
registry.Boolean(True, _("""Determines whether the bot will synchronize
|
|
|
|
topics between networks in the channels it relays.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerChannelValue(Relay, 'hostmasks',
|
2014-05-11 15:41:06 +02:00
|
|
|
registry.Boolean(True, _("""Determines whether the bot will relay the
|
2014-05-11 15:47:32 +02:00
|
|
|
hostmask of the person joining or parting the channel when they join
|
2014-05-11 15:57:45 +02:00
|
|
|
or part.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerChannelValue(Relay, 'includeNetwork',
|
2010-10-19 19:50:41 +02:00
|
|
|
registry.Boolean(True, _("""Determines whether the bot will include the
|
2005-02-02 07:45:35 +01:00
|
|
|
network in relayed PRIVMSGs; if you're only relaying between two networks,
|
2010-10-19 19:50:41 +02:00
|
|
|
it's somewhat redundant, and you may wish to save the space.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerChannelValue(Relay, 'punishOtherRelayBots',
|
2014-05-11 15:41:06 +02:00
|
|
|
registry.Boolean(True, _("""Determines whether the bot will detect other
|
2010-10-19 19:50:41 +02:00
|
|
|
bots relaying and respond by kickbanning them.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerGlobalValue(Relay, 'channels',
|
2010-10-19 19:50:41 +02:00
|
|
|
conf.SpaceSeparatedSetOfChannels([], _("""Determines which channels the bot
|
|
|
|
will relay in.""")))
|
2005-02-09 01:39:11 +01:00
|
|
|
conf.registerChannelValue(Relay.channels, 'joinOnAllNetworks',
|
2014-05-11 15:41:06 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot
|
2005-02-02 07:45:35 +01:00
|
|
|
will always join the channel(s) it relays for on all networks the bot is
|
2010-10-19 19:50:41 +02:00
|
|
|
connected to.""")))
|
2005-02-09 01:39:11 +01:00
|
|
|
conf.registerChannelValue(Relay, 'ignores',
|
2010-10-19 19:50:41 +02:00
|
|
|
Ignores([], _("""Determines what hostmasks will not be relayed on a
|
|
|
|
channel.""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
conf.registerChannelValue(Relay, 'noticeNonPrivmsgs',
|
2014-05-31 17:55:44 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot will used NOTICEs
|
2005-02-02 07:45:35 +01:00
|
|
|
rather than PRIVMSGs for non-PRIVMSG relay messages (i.e., joins, parts,
|
2010-10-19 19:50:41 +02:00
|
|
|
nicks, quits, modes, etc.)""")))
|
2005-02-02 07:45:35 +01:00
|
|
|
|
|
|
|
|
2006-02-11 16:52:51 +01:00
|
|
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|