Allow network-specific username and ident. Closes GH-589.

This commit is contained in:
Valentin Lorentz 2014-05-08 08:33:01 +00:00
parent 90f0e08b20
commit 9d084e2e70
2 changed files with 12 additions and 6 deletions

View File

@ -315,6 +315,12 @@ def registerNetwork(name, password='', ssl=False, sasl_username='',
registerGlobalValue(network, 'nick', ValidNickOrEmpty('', _("""Determines
what nick the bot will use on this network. If empty, defaults to
supybot.nick.""")))
registerGlobalValue(network, 'ident', ValidNickOrEmpty('', _("""Determines
the bot's ident string, if the server doesn't provide one by default.
If empty, defaults to supybot.ident.""")))
registerGlobalValue(network, 'user', registry.String('', _("""Determines
the username the bot sends to the server. If empty, defaults to
supybot.user""")))
registerGlobalValue(network, 'umodes',
registry.String('', _("""Determines what user modes the bot will request
from the server when it first connects. If empty, defaults to

View File

@ -895,12 +895,12 @@ class Irc(IrcCommandDispatcher):
def _setNonResettingVariables(self):
# Configuration stuff.
self.nick = conf.supybot.nick()
network_nick = conf.supybot.networks.get(self.network).nick()
if network_nick != '':
self.nick = network_nick
self.user = conf.supybot.user()
self.ident = conf.supybot.ident()
def get_value(name):
return getattr(conf.supybot.networks.get(self.network), name)() or \
getattr(conf.supybot, name)()
self.nick = get_value('nick')
self.user = get_value('user')
self.ident = get_value('ident')
self.alternateNicks = conf.supybot.nick.alternates()[:]
self.password = conf.supybot.networks.get(self.network).password()
self.sasl_username = \