From d8b7254021c6d302bb482459463704b1d7e83516 Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 9 Jun 2004 23:48:33 +0000 Subject: [PATCH] Revert a reply() change and fix some tests. --- src/callbacks.py | 9 +++++---- test/test_callbacks.py | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index f23ecce61..afb1a4778 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -126,10 +126,11 @@ def reply(msg, s, prefixName=True, private=False, notice=False, to=None, action=False): # Ok, let's make the target: target = ircutils.replyTo(msg) - if to is not None: - target = to - elif private: - target = msg.nick + if private: + if to is not None: + target = to + else: + target = msg.nick if to is None: to = msg.nick # Ok, now let's make the payload: diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 96490c317..7f207bd3f 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -74,9 +74,9 @@ class TokenizerTestCase(SupyTestCase): ['foo', 'bar baz', 'quux']) def testNesting(self): - orig = conf.supybot.bracketSyntax() + orig = conf.supybot.reply.bracketSyntax() try: - conf.supybot.bracketSyntax.setValue(True) + conf.supybot.reply.bracketSyntax.setValue(True) self.assertEqual(tokenize('[]'), [[]]) self.assertEqual(tokenize('[foo]'), [['foo']]) self.assertEqual(tokenize('[ foo ]'), [['foo']]) @@ -84,16 +84,16 @@ class TokenizerTestCase(SupyTestCase): self.assertEqual(tokenize('foo bar [baz quux]'), ['foo', 'bar', ['baz', 'quux']]) finally: - conf.supybot.bracketSyntax.setValue(orig) + conf.supybot.reply.bracketSyntax.setValue(orig) try: - conf.supybot.bracketSyntax.setValue(False) + conf.supybot.reply.bracketSyntax.setValue(False) self.assertEqual(tokenize('[]'), ['[]']) self.assertEqual(tokenize('[foo]'), ['[foo]']) self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]']) self.assertEqual(tokenize('foo bar [baz quux]'), ['foo', 'bar', '[baz', 'quux]']) finally: - conf.supybot.bracketSyntax.setValue(orig) + conf.supybot.reply.bracketSyntax.setValue(orig) def testError(self): self.assertRaises(SyntaxError, tokenize, '[foo') #] @@ -101,7 +101,7 @@ class TokenizerTestCase(SupyTestCase): def testPipe(self): try: - conf.supybot.pipeSyntax.set('True') + conf.supybot.reply.pipeSyntax.set('True') self.assertRaises(SyntaxError, tokenize, '| foo') self.assertRaises(SyntaxError, tokenize, 'foo ||bar') self.assertRaises(SyntaxError, tokenize, 'bar |') @@ -116,7 +116,7 @@ class TokenizerTestCase(SupyTestCase): self.assertEqual(tokenize('foo bar | baz quux'), ['baz', 'quux', ['foo', 'bar']]) finally: - conf.supybot.pipeSyntax.set('False') + conf.supybot.reply.pipeSyntax.set('False') self.assertEqual(tokenize('foo|bar'), ['foo|bar']) self.assertEqual(tokenize('foo | bar'), ['foo', '|', 'bar']) self.assertEqual(tokenize('foo | bar | baz'),