]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/core/config.rb
auth core botmodule: advertise and act on mismatched master password
[user/henk/code/ruby/rbot.git] / lib / rbot / core / config.rb
index cfc6588b86845d0f74c69d248cf389e530eb0190..fc99fd8c961f5de8dae44dc89050362337a5ea0e 100644 (file)
@@ -4,16 +4,14 @@
 # :title: rbot config management from IRC
 #
 # Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Copyright:: (C) 2006,2007 Giuseppe Bilotta
-# License:: GPL v2
 
 class ConfigModule < CoreBotModule
 
   def version_string
     if $version_timestamp.to_i > 0
-      ago = String.new ' ['
-      ago << Utils.secs_to_string(Time.now.to_i - $version_timestamp.to_i)
-      ago << ' ago]'
+      ago = _(" [%{secs} ago]") % {
+        :secs => Utils.secs_to_string(Time.now.to_i - $version_timestamp.to_i)
+      }
     else
       ago = ''
     end
@@ -74,13 +72,13 @@ class ConfigModule < CoreBotModule
     rx = Regexp.new(params[:rx].to_s, true)
     cfs = []
     @bot.config.items.each do |k, v|
-      cfs << v if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
+      cfs << [Bold + k.to_s + Bold, v.desc] if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
     end
     if cfs.empty?
       m.reply _("no config key found matching %{r}") % { :r => params[:rx].to_s}
     else
-      m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.key}.join(', ') }
-      m.reply cfs.map { |c| [c.key, c.desc].join(': ') }.join("\n")
+      m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.first}.join(', ') } if cfs.length > 1
+      m.reply cfs.map { |c| c.join(': ') }.join("\n")
     end
   end
 
@@ -205,10 +203,8 @@ class ConfigModule < CoreBotModule
     case m.ctcp.intern
     when :VERSION
       m.ctcp_reply version_string
-      # @bot.irclog "@ #{m.source} asked #{who} about version info"
     when :SOURCE
       m.ctcp_reply Irc::Bot::SOURCE_URL
-      # @bot.irclog "@ #{m.source} asked #{who} about source info"
     end
   end