Admin: @nick only sets the nick on the current network. Closes GH-273.

This commit is contained in:
Valentin Lorentz 2013-05-21 18:52:46 +02:00
parent a15dea55db
commit 58befaee5c
2 changed files with 7 additions and 5 deletions

View File

@ -212,19 +212,21 @@ class Admin(callbacks.Plugin):
self.log.debug('Got NICK without Admin.nick being called.')
@internationalizeDocstring
def nick(self, irc, msg, args, nick):
"""[<nick>]
def nick(self, irc, msg, args, nick, network):
"""[<nick>] [<network>]
Changes the bot's nick to <nick>. If no nick is given, returns the
bot's current nick.
"""
network = network or irc.network
if nick:
conf.supybot.nick.setValue(nick)
group = getattr(conf.supybot.networks, network)
group.nick.setValue(nick)
irc.queueMsg(ircmsgs.nick(nick))
self.pendingNickChanges[irc.getRealIrc()] = irc
else:
irc.reply(irc.nick)
nick = wrap(nick, [additional('nick')])
nick = wrap(nick, [additional('nick'), additional('something')])
@internationalizeDocstring
def part(self, irc, msg, args, channel, reason):

View File

@ -122,7 +122,7 @@ class AdminTestCase(PluginTestCase):
self.assertEqual(m.command, 'NICK')
self.assertEqual(m.args[0], 'foobar')
finally:
conf.supybot.nick.setValue(original)
conf.supybot.networks.test.nick.setValue('')
def testAddCapabilityOwner(self):
self.assertError('admin capability add %s owner' % self.nick)