- places = feed.watchers
- handle = feed.handle.empty? ? "" : "::#{feed.handle}:: "
- date = String.new
- if opts
- places = opts[:places] if opts.key?(:places)
- handle = opts[:handle].to_s if opts.key?(:handle)
- if opts.key?(:date) && opts[:date]
- if item.respond_to?(:updated)
- if item.updated.content.class <= Time
- date = item.updated.content.strftime("%Y/%m/%d %H:%M")
- else
- date = item.updated.content.to_s
- end
- elsif item.respond_to?(:source) and item.source.respond_to?(:updated)
- if item.source.updated.content.class <= Time
- date = item.source.updated.content.strftime("%Y/%m/%d %H:%M")
- else
- date = item.source.updated.content.to_s
- end
- elsif item.respond_to?(:pubDate)
- if item.pubDate.class <= Time
- date = item.pubDate.strftime("%Y/%m/%d %H:%M")
- else
- date = item.pubDate.to_s
- end
- elsif item.respond_to?(:date)
- if item.date.class <= Time
- date = item.date.strftime("%Y/%m/%d %H:%M")
- else
- date = item.date.to_s
- end
- else
- date = "(no date)"
- end
- date += " :: "
+ opts = {
+ :places => feed.watchers,
+ :handle => feed.handle,
+ :date => false,
+ :announce_method => @bot.config['rss.announce_method']
+ }.merge options
+
+ places = opts[:places]
+ announce_method = opts[:announce_method]
+
+ handle = opts[:handle].to_s
+
+ date = \
+ if opts[:date]
+ if item.respond_to?(:updated) and item.updated
+ make_date(item.updated.content)
+ elsif item.respond_to?(:modified) and item.modified
+ make_date(item.modified.content)
+ elsif item.respond_to?(:source) and item.source.respond_to?(:updated)
+ make_date(item.source.updated.content)
+ elsif item.respond_to?(:pubDate)
+ make_date(item.pubDate)
+ elsif item.respond_to?(:date)
+ make_date(item.date)
+ else
+ "(no date)"