end\r
\r
class ::RssBlob\r
- attr :url\r
- attr :handle\r
- attr :type\r
+ attr_accessor :url\r
+ attr_accessor :handle\r
+ attr_accessor :type\r
attr :watchers\r
attr_accessor :xml\r
attr_accessor :title\r
"rss watched [#{Bold}handle#{Bold}] : list all watched rss feeds (matching #{Bold}handle#{Bold})"\r
when "add"\r
"rss add #{Bold}handle#{Bold} #{Bold}url#{Bold} [#{Bold}type#{Bold}] : add a new rss called #{Bold}handle#{Bold} from url #{Bold}url#{Bold} (of type #{Bold}type#{Bold})"\r
+ when "change"\r
+ "rss change #{Bold}what#{Bold} of #{Bold}handle#{Bold} to #{Bold}new#{Bold} : change the handle, url or type of rss called #{Bold}handle#{Bold} to value #{Bold}new#{Bold}"\r
when /^(del(ete)?|rm)$/\r
"rss del(ete)|rm #{Bold}handle#{Bold} : delete rss feed #{Bold}handle#{Bold}"\r
when "replace"\r
when "rewatch"\r
"rss rewatch : restart threads that watch for changes in watched rss"\r
else\r
- "manage RSS feeds: rss show|list|watched|add|del(ete)|rm|(force)replace|watch|unwatch|rmwatch|rewatch"\r
+ "manage RSS feeds: rss show|list|watched|add|change|del(ete)|rm|(force)replace|watch|unwatch|rmwatch|rewatch"\r
end\r
end\r
\r
return handle\r
end\r
\r
+ def change_rss(m, params)\r
+ handle = params[:handle].downcase\r
+ feed = @feeds.fetch(handle, nil)\r
+ return m.reply "No such feed with handle #{handle}" unless feed\r
+ case params[:what].intern\r
+ when :handle\r
+ new = params[:new].downcase\r
+ if @feeds.key?(new) and @feeds[new]\r
+ m.reply "There already is a feed with handle #{new}"\r
+ return\r
+ else\r
+ @feeds[new] = feed\r
+ @feeds.delete(handle)\r
+ feed.handle = new\r
+ handle = new\r
+ end\r
+ when :url\r
+ new = params[:new]\r
+ feed.mutex.synchronize do\r
+ feed.url = new\r
+ end\r
+ when :format, :type\r
+ new = params[:new]\r
+ new = nil if new == 'default'\r
+ feed.mutex.synchronize do\r
+ feed.type = new\r
+ end\r
+ else\r
+ m.reply "Don't know how to change #{params[:what]} for feeds"\r
+ return\r
+ end\r
+ m.reply "Feed changed:"\r
+ list_rss(m, {:handle => handle})\r
+ end\r
+\r
def del_rss(m, params, pass=false)\r
feed = unwatch_rss(m, params, true)\r
if feed.watched?\r
plugin.map 'rss add :handle :url :type',\r
:action => 'add_rss',\r
:defaults => {:type => nil}\r
+plugin.map 'rss change :what of :handle to :new',\r
+ :action => 'change_rss',\r
+ :requirements => { :what => /handle|url|format|type/ }\r
+plugin.map 'rss change :what for :handle to :new',\r
+ :action => 'change_rss',\r
+ :requirements => { :what => /handle|url|format|type/ }\r
plugin.map 'rss del :handle',\r
:action => 'del_rss'\r
plugin.map 'rss delete :handle',\r