From 3970feccfea3b6b2c809ae867d3fb06aa9589df9 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 27 May 2025 21:09:18 +0200 Subject: [PATCH 1/2] NickAuth: Make username argument to 'nick add' required optional() is greedy, so if someone uses 'nickauth nick add MyNick' and MyNick is also a bot account name, the command fails. This is very confusing. --- plugins/NickAuth/plugin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/NickAuth/plugin.py b/plugins/NickAuth/plugin.py index fcccd41e1..5d3c0303a 100644 --- a/plugins/NickAuth/plugin.py +++ b/plugins/NickAuth/plugin.py @@ -72,11 +72,10 @@ def _check_auth(self, irc, msg, user): @internationalizeDocstring def add(self, irc, msg, args, network, user, nick): - """[] [] + """[] Add to the list of network services accounts owned by - on . is only required if you - are not already logged in to Limnoria. + on . defaults to the current network. """ network = network.network or irc.network @@ -89,7 +88,7 @@ def add(self, irc, msg, args, network, user, nick): 'on this network.'), Raise=True) irc.replySuccess() add = wrap(add, [optional('networkIrc'), - optional('otherUser'), + 'otherUser', 'nick']) @internationalizeDocstring From 700407a02aa7b01a330c002c7704e56b3923b205 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 27 May 2025 21:33:57 +0200 Subject: [PATCH 2/2] Update test --- plugins/NickAuth/test.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/NickAuth/test.py b/plugins/NickAuth/test.py index d2cb2b26a..f871437da 100644 --- a/plugins/NickAuth/test.py +++ b/plugins/NickAuth/test.py @@ -129,15 +129,13 @@ def testBotJoin(self): def testList(self): self.assertNotError('register foobar 123') self.assertRegexp('nick list', 'You have no recognized services accounts') - self.assertNotError('nick add foo') + self.assertNotError('nick add foobar foo') self.assertRegexp('nick list', 'foo') - self.assertNotError('nick add %s bar' % self.nick) + self.assertNotError('nick add %s foobar bar' % self.irc.network) self.assertRegexp('nick list', 'foo and bar') - self.assertNotError('nick add %s %s baz' % (self.irc.network, self.nick)) - self.assertRegexp('nick list', 'foo, bar, and baz') - self.assertRegexp('nick list %s' % self.irc.network, 'foo, bar, and baz') + self.assertRegexp('nick list %s' % self.irc.network, 'foo and bar') self.assertRegexp('nick list %s foobar' % self.irc.network, - 'foo, bar, and baz') + 'foo and bar') # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: