diff --git a/src/irclib.py b/src/irclib.py index 6518a0fe5..bca06f348 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -339,11 +339,14 @@ class IrcState(IrcCommandDispatcher): }) def _prefixParser(s): - (left, right) = s.split(')') - assert left[0] == '(', 'Odd PREFIX in 005: %s' % s - left = left[1:] - assert len(left) == len(right), 'Odd PREFIX in 005: %s' % s - return dict(zip(left, right)) + if ')' in s: + (left, right) = s.split(')') + assert left[0] == '(', 'Odd PREFIX in 005: %s' % s + left = left[1:] + assert len(left) == len(right), 'Odd PREFIX in 005: %s' % s + return dict(zip(left, right)) + else: + return dict(zip('ovh', s)) _005converters['prefix'] = _prefixParser del _prefixParser def do005(self, irc, msg): diff --git a/test/test_irclib.py b/test/test_irclib.py index 875a48989..e2e4a8067 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -225,6 +225,13 @@ class IrcStateTestCase(SupyTestCase): conf.supybot.protocols.irc.maxHistoryLength():]) conf.supybot.protocols.irc.maxHistoryLength.setValue(oldconfmaxhistory) + def testWasteland005(self): + state = irclib.IrcState() + # Here we're testing if PREFIX works without the (ov) there. + state.addMsg(self.irc, ircmsgs.IrcMsg(':desolate.wasteland.org 005 jemfinch NOQUIT WATCH=128 SAFELIST MODES=6 MAXCHANNELS=10 MAXBANS=100 NICKLEN=30 TOPICLEN=307 KICKLEN=307 CHANTYPES=&# PREFIX=@+ NETWORK=DALnet SILENCE=10 :are available on this server')) + self.assertEqual(state.supported['prefix']['o'], '@') + self.assertEqual(state.supported['prefix']['v'], '+') + def testEmptyTopic(self): state = irclib.IrcState() state.addMsg(self.irc, ircmsgs.topic('#foo'))