From f31fec5681522905018520aa1c95f5befb93e345 Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 5 Jan 2005 18:36:46 +0000 Subject: [PATCH] Fix an exception when using the --to option for Note.list and add tests for the --to and --from options. --- plugins/Note.py | 7 +------ test/test_Note.py | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/Note.py b/plugins/Note.py index df60aef48..8e3f0d2d4 100644 --- a/plugins/Note.py +++ b/plugins/Note.py @@ -373,14 +373,9 @@ class Note(callbacks.Privmsg): def p(note): return note.frm == user.id if receiver: - try: - receiver = ircdb.users.getUserId(receiver) - except KeyError: - irc.error('That user is not in my user database.') - return originalP = p def p(note): - return originalP(note) and note.to == receiver + return originalP(note) and note.to == receiver.id notes = list(self.db.select(p)) if not notes: irc.error('I couldn\'t find any sent notes for your user.') diff --git a/test/test_Note.py b/test/test_Note.py index 0bf2435b9..686ec0160 100644 --- a/test/test_Note.py +++ b/test/test_Note.py @@ -70,9 +70,11 @@ class NoteTestCase(PluginTestCase, PluginDocumentation): self.assertNotError('note send inkedmn 1,2,3') _ = self.getMsg(' ') self.assertRegexp('note list --sent', r'#2.*#1') + self.assertRegexp('note list --sent --to inkedmn', r'#2.*#1') self.assertRegexp('note list', r'#1.*#2') self.assertRegexp('note 1', 'testing') self.assertResponse('note list --old', '#1 from inkedmn') + self.assertResponse('note list --old --from inkedmn','#1 from inkedmn')