X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ftopic.rb;h=9b6ffdb47e0b46af21875efff7f2bb4d55a028ec;hb=70351b15aadcce2e2f167952fbbaa96188916f26;hp=e57c0e812878354986e31b543a30862fc674f064;hpb=8f483cba538d982ca43096090b75a9185e90b552;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/topic.rb b/data/rbot/plugins/topic.rb index e57c0e81..9b6ffdb4 100755 --- a/data/rbot/plugins/topic.rb +++ b/data/rbot/plugins/topic.rb @@ -94,6 +94,7 @@ class TopicPlugin < Plugin end def topicsep(m, ch, txt) + return if !@bot.auth.allow?("topic::edit::separator", m.source, m.replyto) if txt sep = txt.strip if sep != "" @@ -141,6 +142,7 @@ class TopicPlugin < Plugin end def topicaddat(m, channel, num, txt) + return if !@bot.auth.allow?("topic::edit::add", m.source, m.replyto) sep = getsep(channel) topic = channel.topic.to_s topicarray = topic.split(/\s+#{Regexp.escape(sep)}\s*/) @@ -158,6 +160,7 @@ class TopicPlugin < Plugin end def topicdel(m, channel, num) + return if !@bot.auth.allow?("topic::edit::del", m.source, m.replyto) sep = getsep(channel) topic = channel.topic.to_s topicarray = topic.split(/\s+#{Regexp.escape(sep)}\s*/) @@ -167,7 +170,7 @@ class TopicPlugin < Plugin end def learntopic(m, channel) - return if !@bot.auth.allow?("learntopic", m.source, m.replyto) + return if !@bot.auth.allow?("topic::store::store", m.source, m.replyto) topic = channel.topic.to_s k = channel.downcase if @registry.has_key?(k) @@ -181,9 +184,9 @@ class TopicPlugin < Plugin end def replacetopic(m, channel, num, txt) - return if !@bot.auth.allow?("topic", m.source, m.replyto) + return if !@bot.auth.allow?("topic::edit::replace", m.source, m.replyto) sep = getsep(channel) - topic = @bot.channels[channel].topic.to_s + topic = channel.topic.to_s topicarray = topic.split(/\s+#{Regexp.escape(sep)}\s*/) topicarray[num] = txt newtopic = topicarray.join(" #{sep} ") @@ -191,26 +194,27 @@ class TopicPlugin < Plugin end def restoretopic(m, channel) + return if !@bot.auth.allow?("topic::store::restore", m.source, m.replyto) return if !@bot.auth.allow?("restoretopic", m.source, m.replyto) k = channel.downcase if @registry.has_key?(k) && @registry[k].has_key?(:topic) topic = @registry[k][:topic] - @bot.topic channel, topic + topicset(m, channel, topic) else m.reply "I don't remember any topic for this channel" end end def topicset(m, channel, text) - return if !@bot.auth.allow?("topic", m.source, m.replyto) + return if !@bot.auth.allow?("topic::edit::replace", m.source, m.replyto) @bot.topic channel, text end end plugin = TopicPlugin.new -plugin.map 'topic :command *text', :action => 'handletopic', :public => true, :private => false -plugin.map 'topic :channel :command *text', :action => 'handletopic', :public => false, :private => true +plugin.map 'topic :command [*text]', :action => 'handletopic', :public => true, :private => false +plugin.map 'topic :channel :command [*text]', :action => 'handletopic', :public => false, :private => true plugin.default_auth('*', false)