2005-02-02 13:20:13 +01:00
|
|
|
###
|
|
|
|
# Copyright (c) 2005, Jeremiah Fincher
|
2012-09-01 16:16:48 +02:00
|
|
|
# Copyright (c) 2010, James McCoy
|
2005-02-02 13:20:13 +01:00
|
|
|
# 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-20 09:10:03 +02:00
|
|
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
|
|
|
_ = PluginInternationalization('Services')
|
2005-02-02 13:20:13 +01:00
|
|
|
|
|
|
|
def registerNick(nick, password=''):
|
|
|
|
p = conf.supybot.plugins.Services.Nickserv.get('password')
|
2010-10-20 09:10:03 +02:00
|
|
|
h = _('Determines what password the bot will use with NickServ when ' \
|
|
|
|
'identifying as %s.') % nick
|
2019-08-25 14:00:11 +02:00
|
|
|
v = conf.registerNetworkValue(p, nick,
|
|
|
|
registry.String(password, h, private=True))
|
2005-02-02 13:20:13 +01:00
|
|
|
if password:
|
|
|
|
v.setValue(password)
|
|
|
|
|
|
|
|
def configure(advanced):
|
|
|
|
from supybot.questions import expect, anything, something, yn, getpass
|
|
|
|
conf.registerPlugin('Services', True)
|
2010-10-20 09:10:03 +02:00
|
|
|
nick = something(_('What is your registered nick?'))
|
|
|
|
password = something(_('What is your password for that nick?'))
|
|
|
|
chanserv = something(_('What is your ChanServ named?'), default='ChanServ')
|
|
|
|
nickserv = something(_('What is your NickServ named?'), default='NickServ')
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.supybot.plugins.Services.nicks.setValue([nick])
|
|
|
|
conf.supybot.plugins.Services.NickServ.setValue(nickserv)
|
|
|
|
registerNick(nick, password)
|
|
|
|
conf.supybot.plugins.Services.ChanServ.setValue(chanserv)
|
|
|
|
|
|
|
|
class ValidNickOrEmptyString(registry.String):
|
|
|
|
def setValue(self, v):
|
|
|
|
if v and not ircutils.isNick(v):
|
2014-01-20 15:43:55 +01:00
|
|
|
raise registry.InvalidRegistryValue('Value must be a valid nick or the empty string.')
|
2005-02-02 13:20:13 +01:00
|
|
|
registry.String.setValue(self, v)
|
|
|
|
|
|
|
|
class ValidNickSet(conf.ValidNicks):
|
|
|
|
List = ircutils.IrcSet
|
|
|
|
|
|
|
|
Services = conf.registerPlugin('Services')
|
2019-08-25 14:00:11 +02:00
|
|
|
conf.registerNetworkValue(Services, 'nicks',
|
2010-10-20 09:10:03 +02:00
|
|
|
ValidNickSet([], _("""Determines what nicks the bot will use with
|
|
|
|
services.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
|
|
|
|
class Networks(registry.SpaceSeparatedSetOfStrings):
|
|
|
|
List = ircutils.IrcSet
|
2006-07-14 22:55:44 +02:00
|
|
|
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.registerGlobalValue(Services, 'disabledNetworks',
|
2010-10-20 09:10:03 +02:00
|
|
|
Networks(_('QuakeNet').split(), _("""Determines what networks this plugin
|
|
|
|
will be disabled on.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
|
2019-08-25 14:00:11 +02:00
|
|
|
conf.registerNetworkValue(Services, 'noJoinsUntilIdentified',
|
2010-10-20 09:10:03 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot will not join any
|
2005-02-02 13:20:13 +01:00
|
|
|
channels until it is identified. This may be useful, for instances, if
|
|
|
|
you have a vhost that isn't set until you're identified, or if you're
|
2010-10-20 09:10:03 +02:00
|
|
|
joining +r channels that won't allow you to join unless you identify.""")))
|
2019-08-25 14:00:11 +02:00
|
|
|
conf.registerNetworkValue(Services, 'ghostDelay',
|
2015-09-15 21:00:31 +02:00
|
|
|
registry.NonNegativeInteger(60, _("""Determines how many seconds the bot will
|
2015-09-15 20:59:26 +02:00
|
|
|
wait between successive GHOST attempts. Set this to 0 to disable GHOST.""")))
|
2019-08-25 14:00:11 +02:00
|
|
|
conf.registerNetworkValue(Services, 'NickServ',
|
2014-06-06 12:54:26 +02:00
|
|
|
ValidNickOrEmptyString('NickServ', _("""Determines what nick the 'NickServ' service
|
2010-10-20 09:10:03 +02:00
|
|
|
has.""")))
|
2010-06-22 01:35:35 +02:00
|
|
|
conf.registerGroup(Services.NickServ, 'password')
|
2019-08-25 14:00:11 +02:00
|
|
|
conf.registerNetworkValue(Services, 'ChanServ',
|
2014-06-06 12:54:26 +02:00
|
|
|
ValidNickOrEmptyString('ChanServ', _("""Determines what nick the 'ChanServ' service
|
2010-10-20 09:10:03 +02:00
|
|
|
has.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.registerChannelValue(Services.ChanServ, 'password',
|
2010-10-20 09:10:03 +02:00
|
|
|
registry.String('', _("""Determines what password the bot will use with
|
|
|
|
ChanServ."""), private=True))
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.registerChannelValue(Services.ChanServ, 'op',
|
2010-10-20 09:10:03 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot will request to get
|
|
|
|
opped by the ChanServ when it joins the channel.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.registerChannelValue(Services.ChanServ, 'halfop',
|
2010-10-20 09:10:03 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot will request to get
|
|
|
|
half-opped by the ChanServ when it joins the channel.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
conf.registerChannelValue(Services.ChanServ, 'voice',
|
2010-10-20 09:10:03 +02:00
|
|
|
registry.Boolean(False, _("""Determines whether the bot will request to get
|
|
|
|
voiced by the ChanServ when it joins the channel.""")))
|
2005-02-02 13:20:13 +01:00
|
|
|
|
2006-02-11 16:52:51 +01:00
|
|
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|