summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authordmitry kim <jason@nichego.net>2008-07-10 14:14:37 +0400
committerdmitry kim <jason@nichego.net>2008-07-10 14:14:37 +0400
commit42652bd5d93b9173149510fa09defafc6ee4b89c (patch)
tree741fc06fc4768878d9d722aead930e3c40cfd5c1 /data/rbot/plugins
parent793e2f0604faa81fd8764a66389b44559a753772 (diff)
* (plugins/rss) fixed item unique ids
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/rss.rb24
1 files changed, 17 insertions, 7 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index e5c2da11..fea6f352 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -257,18 +257,28 @@ class RSSFeedsPlugin < Plugin
# Make an 'unique' ID for a given item, based on appropriate bot options
# Currently only suppored is bot.config['rss.show_updated']: when false,
# only the guid/link is accounted for.
- #
+
+ def block_rescue(df = nil, &block)
+ block.call rescue nil
+ end
+
def make_uid(item)
uid = [
- (item.guid.content rescue \
- item.guid rescue \
- item.link.href rescue \
- item.link rescue ''
+ (block_rescue do item.guid.content end ||
+ block_rescue do item.guid end ||
+ block_rescue do item.link.href end ||
+ block_rescue do item.link end
)
]
if @bot.config['rss.show_updated']
- uid.push((item.content.content rescue item.description rescue nil))
- uid.unshift((item.title.content rescue item.title rescue nil))
+ uid.push(
+ block_rescue do item.content.content end ||
+ block_rescue do item.description end
+ )
+ uid.unshift(
+ block_rescue do item.title.content end ||
+ block_rescue do item.title end
+ )
end
uid.hash
end