rss_plugin: Don't send title if it's part of the headline description
authorMikael Berthe <mikael@lilotux.net>
Sun, 20 May 2007 12:33:55 +0200
changeset 41 ca6e989ca850
parent 40 0d917adf0daf
child 42 cb52cef33d61
rss_plugin: Don't send title if it's part of the headline description
plugins/rss_plugin.py
--- a/plugins/rss_plugin.py	Sun May 20 09:56:47 2007 +0200
+++ b/plugins/rss_plugin.py	Sun May 20 12:33:55 2007 +0200
@@ -126,9 +126,16 @@
 	title = rss_remove_html(item['title'])
 	link = item['link']
 	description = rss_remove_html(item['description'])
-	reply = title + ' - '
-	if description:
-		reply += description + ' - '
+        # Don't send title if it's part of the description (for example in
+        # Mercurial's changesets).
+        if not description:
+                reply = title + '\n'
+        else:
+                if description.startswith(title):
+                        reply = ''
+                else:
+                        reply = title + ' - '
+                reply += description + '\n'
 	reply += link
 	for groupchat in RSS_CACHE['channels'][channel]['subscribers']:
 		if GROUPCHATS.has_key(groupchat):