From 24c25436be754e2f7b7a92d75d9cd82fd9ea7c21 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 1 Jun 2004 16:22:48 +0000 Subject: [PATCH] Fixed bug in announcements. --- plugins/RSS.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/RSS.py b/plugins/RSS.py index 10d56eed5..47488a75b 100644 --- a/plugins/RSS.py +++ b/plugins/RSS.py @@ -159,14 +159,11 @@ class RSS(callbacks.Privmsg): oldheadlines = [] newresults = self.getFeed(url) newheadlines = self.getHeadlines(newresults) - def headlineEq(h1, h2): - return h1.lower().split() == h2.lower().split() - for (i, oldheadline) in enumerate(oldheadlines): - try: - newheadline = newheadlines[i] - except IndexError: - break - if headlineEq(oldheadline, newheadline): + def canonicalize(headline): + return tuple(headline.lower().split()) + oldheadlines = sets.Set(map(canonicalize, oldheadlines)) + for (i, headline) in enumerate(newheadlines): + if canonicalize(headline) in oldheadlines: newheadlines[i] = None newheadlines = filter(None, newheadlines) # Removes Nones. if newheadlines: