From 5653e0c7279d42ed8e4f84b376bc2e4eb714f909 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 19 Jan 2015 12:14:38 +0100 Subject: [PATCH 1/2] Fix commit 30a026a Requesting multiple capabilities in one message will result in a NAK for all of them if at least one is not supported by the server. --- src/irclib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index 504583dc8..5310aa49a 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -962,8 +962,8 @@ class Irc(IrcCommandDispatcher): elif self.sasl_username and self.sasl_password: self.sasl = 'plain' - self.queueMsg(ircmsgs.IrcMsg(command='CAP', args=('REQ', - 'account-notify extended-join multi-prefix'))) + for cap in ('account-notify', 'extended-join', 'multi-prefix'): + self.queueMsg(ircmsgs.IrcMsg(command='CAP', args=('REQ', cap))) if self.sasl: self.queueMsg(ircmsgs.IrcMsg(command='CAP', args=('REQ', 'sasl'))) From c565af776575e71ce022487ddfe18e11dba56400 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 19 Jan 2015 18:08:15 +0100 Subject: [PATCH 2/2] Update tests again --- test/test_irclib.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/test_irclib.py b/test/test_irclib.py index 6a57f342d..bb85f33fa 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -387,6 +387,10 @@ class IrcTestCase(SupyTestCase): m = self.irc.takeMsg() self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m) m = self.irc.takeMsg() + self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m) + m = self.irc.takeMsg() + self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m) + m = self.irc.takeMsg() self.failUnless(m.command == 'USER', 'Expected USER, got %r.' % m) def testPingResponse(self): @@ -483,11 +487,14 @@ class IrcCallbackTestCase(SupyTestCase): conf.supybot.nick.setValue(nick) user = 'user any user' conf.supybot.user.setValue(user) - expected = [ircmsgs.nick(nick), - ircmsgs.IrcMsg(command='CAP', args=('REQ', - 'account-notify extended-join multi-prefix')), - ircmsgs.IrcMsg(command='CAP', args=('END',)), - ircmsgs.user('limnoria', user)] + expected = [ + ircmsgs.nick(nick), + ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')), + ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')), + ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')), + ircmsgs.IrcMsg(command='CAP', args=('END',)), + ircmsgs.user('limnoria', user) + ] irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: