Skip to content

Commit 9d084e2

Browse files
committed
Allow network-specific username and ident. Closes GH-589.
1 parent 90f0e08 commit 9d084e2

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ def registerNetwork(name, password='', ssl=False, sasl_username='',
315315
registerGlobalValue(network, 'nick', ValidNickOrEmpty('', _("""Determines
316316
what nick the bot will use on this network. If empty, defaults to
317317
supybot.nick.""")))
318+
registerGlobalValue(network, 'ident', ValidNickOrEmpty('', _("""Determines
319+
the bot's ident string, if the server doesn't provide one by default.
320+
If empty, defaults to supybot.ident.""")))
321+
registerGlobalValue(network, 'user', registry.String('', _("""Determines
322+
the username the bot sends to the server. If empty, defaults to
323+
supybot.user""")))
318324
registerGlobalValue(network, 'umodes',
319325
registry.String('', _("""Determines what user modes the bot will request
320326
from the server when it first connects. If empty, defaults to

src/irclib.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,12 +895,12 @@ def reset(self):
895895

896896
def _setNonResettingVariables(self):
897897
# Configuration stuff.
898-
self.nick = conf.supybot.nick()
899-
network_nick = conf.supybot.networks.get(self.network).nick()
900-
if network_nick != '':
901-
self.nick = network_nick
902-
self.user = conf.supybot.user()
903-
self.ident = conf.supybot.ident()
898+
def get_value(name):
899+
return getattr(conf.supybot.networks.get(self.network), name)() or \
900+
getattr(conf.supybot, name)()
901+
self.nick = get_value('nick')
902+
self.user = get_value('user')
903+
self.ident = get_value('ident')
904904
self.alternateNicks = conf.supybot.nick.alternates()[:]
905905
self.password = conf.supybot.networks.get(self.network).password()
906906
self.sasl_username = \

0 commit comments

Comments
 (0)