]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/rss.rb
Fix RSS plugin problems caused by watches created before the new Irc framework
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / rss.rb
index b49b6a1d1ec3adbea42ef4670f0148a334f4d63e..03bb0b42038e2c0dbb27a09a77c99a82a60b1d45 100644 (file)
@@ -1,7 +1,12 @@
+#-- vim:sw=2:et\r
+#++\r
+#\r
 # RSS feed plugin for RubyBot\r
 # (c) 2004 Stanislav Karchebny <berkus@madfire.net>\r
 # (c) 2005 Ian Monroe <ian@monroe.nu>\r
 # (c) 2005 Mark Kretschmann <markey@web.de>\r
+# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\r
+#\r
 # Licensed under MIT License.\r
 \r
 require 'rss/parser'\r
@@ -54,19 +59,26 @@ class ::RssBlob
   end\r
 \r
   def watched_by?(who)\r
-    @watchers.include?(who)\r
+    # We need to check bot 'who' itself and the String form, because rss\r
+    # watches added before the new Irc framework represented watchers as\r
+    # Strings whereas they are now Channels.\r
+    #\r
+    @watchers.include?(who) || @watchers.include?(who.to_s) \r
   end\r
 \r
   def add_watch(who)\r
     if watched_by?(who)\r
       return nil\r
     end\r
-    @watchers << who unless watched_by?(who)\r
+    @watchers << who\r
     return who\r
   end\r
 \r
   def rm_watch(who)\r
+    # See comment to watched_by?\r
+    #\r
     @watchers.delete(who)\r
+    @watchers.delete(who.to_s)\r
   end\r
 \r
   def to_a\r