super
if @registry.has_key?(:commands)
@commands = @registry[:commands]
- else
+ end
+
+ if @commands.nil?
@commands = Hash.new
end
return
end
- code = params[:code].join( " " )
+ code = params[:code].to_s
nick = m.sourcenick
created = Time.new.strftime '%Y/%m/%d %H:%m'
channel = m.target
cmds_per_page = 30
cmds = @commands.keys.sort
- num_pages = cmds.length / cmds_per_page
+ num_pages = cmds.length / cmds_per_page + 1
page = params[:page].to_i
page = [page, 1].max
page = [page, num_pages].min
plugin = ScriptPlugin.new
plugin.register( "script" )
+plugin.default_auth( 'edit', false )
-plugin.map 'script add -f :name *code', :action => 'handle_add_force', :auth => 'scriptedit'
-plugin.map 'script add :name *code', :action => 'handle_add', :auth => 'scriptedit'
-plugin.map 'script del :name', :action => 'handle_del', :auth => 'scriptedit'
+plugin.map 'script add -f :name *code', :action => 'handle_add_force', :auth_path => 'edit'
+plugin.map 'script add :name *code', :action => 'handle_add', :auth_path => 'edit'
+plugin.map 'script del :name', :action => 'handle_del', :auth_path => 'edit'
plugin.map 'script list :page', :action => 'handle_list', :defaults => { :page => '1' }
plugin.map 'script show :name', :action => 'handle_show'