]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/rss.rb
autoop: Add a 'restore' command that will op anybody that would be autooped.
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / rss.rb
index 1b12632af9969a1058ebf4af1719555d25049d6d..cabc8272f23ab7e77f24d576554a2beae84ead27 100644 (file)
@@ -174,6 +174,14 @@ module ::RSS
       :dc_creator => %w{dc_creator}
     }.each { |name, chain| def_bang name, chain }
 
+    def categories!
+      return nil unless self.respond_to? :categories
+      cats = categories.map do |c|
+        blank2nil { c.content rescue c rescue nil }
+      end.compact
+      cats.empty? ? nil : cats
+    end
+
     protected
     def blank2nil(&block)
       x = yield
@@ -1112,6 +1120,7 @@ class RSSFeedsPlugin < Plugin
     link = item.link!
     link.strip! if link
 
+    categories = item.categories!
     category = item.category! || item.dc_subject!
     category.strip! if category
     author = item.dc_creator! || item.author!
@@ -1134,6 +1143,7 @@ class RSSFeedsPlugin < Plugin
       :title => title,
       :title_wrap => Bold,
       :desc => desc, :link => link,
+      :categories => categories,
       :category => category, :author => author, :at => at
     }
     output = @bot.filter(key, stream_hash)