]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Fix RSS plugin problems caused by watches created before the new Irc framework
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 6 Aug 2006 23:27:51 +0000 (23:27 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 6 Aug 2006 23:27:51 +0000 (23:27 +0000)
ChangeLog
data/rbot/plugins/rss.rb

index 3970ad3970433fc05a0c7910e239ae740a64f299..b2954b46fc74acd82a9056e9d343c6a675e4d38b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,8 +4,13 @@
                @bot.kick channel, user, reason
        to kick a user from a channel
        * RSS plugin: fix rewatch_rss method
+       * RSS plugin: the different ways to represent channels before and
+       after the New IRC Framework was causing strange problems such as
+       watched feed not being listed as such, undeletable watches, double
+       watches etc. Fix this by checking both for the Channel objects and
+       their to_s form when checking for watches or deleting them.
 
-2006-08-06 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+2006-08-06  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
        * Updating the ChangeLog again: describe the new stuff in trunk which
        will be made available in the next release. Use Gnu style for new
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