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 registerGlobalValue(network, 'nick', ValidNickOrEmpty('', _("""Determines
what nick the bot will use on this network. If empty, defaults to what nick the bot will use on this network. If empty, defaults to
supybot.nick."""))) 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', registerGlobalValue(network, 'umodes',
registry.String('', _("""Determines what user modes the bot will request registry.String('', _("""Determines what user modes the bot will request
from the server when it first connects. If empty, defaults to from the server when it first connects. If empty, defaults to

View File

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