]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Add a cal.path option with the path to the cal program.
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>
Mon, 30 Jun 2008 09:37:37 +0000 (11:37 +0200)
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>
Mon, 30 Jun 2008 10:00:39 +0000 (12:00 +0200)
data/rbot/plugins/cal.rb

index dd1d1538a143826f4e010501655ba027a17f91e8..bfac39e5be1f77db366e50bd16d761be10ee449c 100644 (file)
@@ -1,12 +1,21 @@
 class CalPlugin < Plugin
+  Config.register Config::StringValue.new('cal.path',
+     :default => '/usr/bin/cal',
+     :desc => _('Path to the cal program'))
+
   def help(plugin, topic="")
     "cal [month year] => show current calendar [optionally specify month and year]"
   end
+  
+  def cal_path
+    @bot.config["cal.path"]
+  end
+
   def cal(m, params)
     if params.has_key?(:month)
-      m.reply Utils.safe_exec("cal", params[:month], params[:year])
+      m.reply Utils.safe_exec(cal_path, params[:month], params[:year])
     else
-      m.reply Utils.safe_exec("cal")
+      m.reply Utils.safe_exec(cal_path)
     end
   end
 end