]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/botuser.rb
botuser.rb: don't fail when being passed nil instead of an array to load
[user/henk/code/ruby/rbot.git] / lib / rbot / botuser.rb
index 9a34b34194c1542dc238dff00e6618aa1a2a9ebe..d859e9c3f3f1d74e963e4a248f533ef9d8204da4 100644 (file)
@@ -19,13 +19,13 @@ module Irc
 \r
     BotConfig.register BotConfigStringValue.new( 'auth.password',\r
       :default => 'rbotauth', :wizard => true,\r
-      :desc => 'Password for the bot owner' )\r
+      :desc => _('Password for the bot owner'))\r
     BotConfig.register BotConfigBooleanValue.new( 'auth.login_by_mask',\r
       :default => 'true',\r
-      :desc => 'Set false to prevent new botusers from logging in without a password when the user netmask is known')\r
+      :desc => _('Set false to prevent new botusers from logging in without a password when the user netmask is known'))\r
     BotConfig.register BotConfigBooleanValue.new( 'auth.autologin',\r
       :default => 'true',\r
-      :desc => 'Set false to prevent new botusers from recognizing IRC users without a need to manually login')\r
+      :desc => _('Set false to prevent new botusers from recognizing IRC users without a need to manually login'))\r
     # BotConfig.register BotConfigIntegerValue.new( 'auth.default_level',\r
     #   :default => 10, :wizard => true,\r
     #   :desc => 'The default level for new/unknown users' )\r
@@ -547,6 +547,10 @@ module Irc
       end\r
 \r
       def load_array(ary, forced)\r
+        unless ary\r
+          warn "Tried to load an empty array"\r
+          return\r
+        end\r
         raise "Won't load with unsaved changes" if @has_changes and not forced\r
         reset_hashes\r
         ary.each { |x|\r
@@ -683,7 +687,8 @@ module Irc
         else\r
           # cmds = cmdtxt.split('::')\r
           # @bot.say chan, "you don't have #{cmds.last} (#{cmds.first}) permissions here" if chan\r
-          @bot.say chan, "#{user}, you don't have '#{cmdtxt}' permissions here" if chan\r
+          @bot.say chan, _("%{user}, you don't have '%{command}' permissions here") %\r
+                        {:user=>user, :command=>cmdtxt} if chan\r
           return false\r
         end\r
       end\r