From d253d7e1bf670adc5bfcd55fe3154085be16cd5c Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 3 Oct 2004 03:01:27 +0000 Subject: [PATCH] Added --without. --- plugins/URL.py | 17 +++++++++++------ test/test_URL.py | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/URL.py b/plugins/URL.py index 35a74715d..9e04b9c56 100644 --- a/plugins/URL.py +++ b/plugins/URL.py @@ -153,14 +153,15 @@ class URL(callbacks.PrivmsgCommandAndRegexp): stats = wrap(stats, ['channeldb']) def last(self, irc, msg, args, optlist, channel): - """[] [--{from,with,near,proto}=] --nolimit + """[] [--{from,with,without,near,proto}=] --nolimit Gives the last URL matching the given criteria. --from is from whom the URL came; --proto is the protocol the URL used; --with is something - inside the URL; --near is something in the same message as the URL; If - --nolimit is given, returns all the URLs that are found. to just the - URL. is only necessary if the message isn't sent in the - channel itself. + inside the URL; --without is something that should not be in the URL; + --near is something in the same message as the URL; If --nolimit is + given, returns all the URLs that are found. to just the URL. + is only necessary if the message isn't sent in the channel + itself. """ predicates = [] f = None @@ -174,6 +175,9 @@ class URL(callbacks.PrivmsgCommandAndRegexp): elif option == 'with': def f(record, arg=arg): return arg in record.url + elif option == 'without': + def f(record, arg=arg): + return arg not in record.url elif option == 'proto': def f(record, arg=arg): return record.url.startswith(arg) @@ -202,7 +206,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp): 'with': 'text', 'near': 'text', 'proto': 'text', - 'nolimit': '',}) + 'nolimit': '', + 'without': 'text',}) Class = URL diff --git a/test/test_URL.py b/test/test_URL.py index d097d3808..fbf87c91e 100644 --- a/test/test_URL.py +++ b/test/test_URL.py @@ -73,6 +73,7 @@ class URLTestCase(ChannelPluginTestCase, PluginDocumentation): re.escape(urls[-1])) self.assertRegexp('url last --with dhcp', re.escape(urls[-3])) self.assertRegexp('url last --from alsdkjf', '^No') + self.assertRegexp('url last --without game', 'sourceforge') #self.assertNotError('url random') def testDefaultNotFancy(self):