From: Giuseppe Bilotta Date: Fri, 30 Jan 2009 14:35:03 +0000 (+0100) Subject: quotes plugin: 'other channel' commands must be mapped earlier X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=eb6fc83e7a46a23ce8ffa7750ae62dcb0574769b;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git quotes plugin: 'other channel' commands must be mapped earlier 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. --- diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb index 055c9bad..257bf880 100644 --- a/data/rbot/plugins/quotes.rb +++ b/data/rbot/plugins/quotes.rb @@ -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!'