diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-06 23:27:51 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-06 23:27:51 +0000 |
commit | c7eab99603c757ac4202e809f5c5923fa23e65ff (patch) | |
tree | 277ec59ae79aabfe5c987a83f46b404bb232c662 | |
parent | 7142123955bcd73a554564f361125f8da5255b83 (diff) |
Fix RSS plugin problems caused by watches created before the new Irc framework
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | data/rbot/plugins/rss.rb | 16 |
2 files changed, 20 insertions, 3 deletions
@@ -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 diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index b49b6a1d..03bb0b42 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -1,7 +1,12 @@ +#-- vim:sw=2:et
+#++
+#
# RSS feed plugin for RubyBot
# (c) 2004 Stanislav Karchebny <berkus@madfire.net>
# (c) 2005 Ian Monroe <ian@monroe.nu>
# (c) 2005 Mark Kretschmann <markey@web.de>
+# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+#
# Licensed under MIT License.
require 'rss/parser'
@@ -54,19 +59,26 @@ class ::RssBlob end
def watched_by?(who)
- @watchers.include?(who)
+ # We need to check bot 'who' itself and the String form, because rss
+ # watches added before the new Irc framework represented watchers as
+ # Strings whereas they are now Channels.
+ #
+ @watchers.include?(who) || @watchers.include?(who.to_s)
end
def add_watch(who)
if watched_by?(who)
return nil
end
- @watchers << who unless watched_by?(who)
+ @watchers << who
return who
end
def rm_watch(who)
+ # See comment to watched_by?
+ #
@watchers.delete(who)
+ @watchers.delete(who.to_s)
end
def to_a
|