]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
quotes plugin: 'other channel' commands must be mapped earlier
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 30 Jan 2009 14:35:03 +0000 (15:35 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 30 Jan 2009 14:35:03 +0000 (15:35 +0100)
Due to the way mapping work, quote commands whose first parameter is a
channel must be mapped before the ones that implicitly refer to the
current channel.

This has the upside that they really work, and the downside that
commands that refer to the current channel must specify the channel if
their argument begins wit something that looks like a channel spec.
However, this last case is extremely rare, so we're fine.

data/rbot/plugins/quotes.rb

index 055c9bad239b535ce755e701b5b0deb733395855..257bf88007a77b3e99aa28110c6ff044168bb894 100644 (file)
@@ -265,6 +265,18 @@ end
 plugin = QuotePlugin.new
 plugin.register("quotes")
 
+plugin.default_auth('other::edit', false) # Prevent random people from editing other channels quote lists by default
+plugin.default_auth('other::view', true) # But allow them to view them
+
+plugin.map "addquote :channel *quote", :action => :cmd_addquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::edit::add!'
+plugin.map "delquote :channel :num", :action => :cmd_delquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::edit::del!'
+plugin.map "getquote :channel [:num]", :action => :cmd_getquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::get!'
+plugin.map "whoquote :channel :num", :action => :cmd_whoquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::who!'
+plugin.map "whenquote :channel :num", :action => :cmd_whenquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::when!'
+plugin.map "searchquote :channel *reg", :action => :cmd_searchquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::view::search!'
+plugin.map "countquote :channel [*reg]", :action => :cmd_countquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::view::count!'
+plugin.map "topicquote :channel [:num]", :action => :cmd_topicquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::topic!'
+
 plugin.default_auth('edit', false) # Prevent random people from removing quotes
 plugin.default_auth('edit::add', true) # But allow them to add them
 
@@ -278,14 +290,3 @@ plugin.map "countquote [*reg]", :action => :cmd_countquote, :private => false, :
 plugin.map "topicquote [:num]", :action => :cmd_topicquote, :private => false, :requirements => { :num => /^\d+$/ }, :auth_path => '!quote::topic!'
 plugin.map "lastquote", :action => :cmd_lastquote, :private => false, :auth_path => '!quote::view::last!'
 
-plugin.default_auth('other::edit', false) # Prevent random people from editing other channels quote lists by default
-plugin.default_auth('other::view', true) # But allow them to view them
-
-plugin.map "addquote :channel *quote", :action => :cmd_addquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::edit::add!'
-plugin.map "delquote :channel :num", :action => :cmd_delquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::edit::del!'
-plugin.map "getquote :channel [:num]", :action => :cmd_getquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::get!'
-plugin.map "whoquote :channel :num", :action => :cmd_whoquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::who!'
-plugin.map "whenquote :channel :num", :action => :cmd_whenquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::view::when!'
-plugin.map "searchquote :channel *reg", :action => :cmd_searchquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::view::search!'
-plugin.map "countquote [:channel] [*reg]", :action => :cmd_countquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN }, :auth_path => '!quote::other::view::count!'
-plugin.map "topicquote :channel [:num]", :action => :cmd_topicquote, :requirements => { :channel => Regexp::Irc::GEN_CHAN, :num => /^\d+$/ }, :auth_path => '!quote::other::topic!'