]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Try to read old language-agnostic lart/praises if language-specific ones are not...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 27 Oct 2006 11:51:23 +0000 (11:51 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 27 Oct 2006 11:51:23 +0000 (11:51 +0000)
data/rbot/plugins/lart.rb
data/rbot/plugins/salut.rb

index 435ed04dab3613f71a02ec4ef5b1ea163c767489..77c0988229e3c51127185320f9b8052595083ae2 100644 (file)
@@ -42,23 +42,35 @@ class LartPlugin < Plugin
     @lartfile = nil
     @praisefile = nil
     super
+
   end
 
   def set_language(lang)
     save
     @lartfile = "#{@bot.botclass}/lart/larts-#{lang}"
     @praisefile = "#{@bot.botclass}/lart/praises-#{lang}"
+    # We may be on an old installation, so on the first run read non-language-specific larts
+    @bulart = "#{@bot.botclass}/lart/larts"
+    @bupraise = "#{@bot.botclass}/lart/praise"
     @larts.clear
     @praises.clear
     if File.exists? @lartfile
       IO.foreach(@lartfile) { |line|
         @larts << line.chomp
       }
+    elsif File.exists? @bulart
+      IO.foreach(@bulart) { |line|
+        @larts << line.chomp
+      }
     end
     if File.exists? @praisefile
       IO.foreach(@praisefile) { |line|
         @praises << line.chomp
       }
+    elsif File.exists? @bupraise
+      IO.foreach(@bupraise) { |line|
+        @praises << line.chomp
+      }
     end
   end
 
index 1a301b438e13619011b75ba1e387bd733f525407..4827601948324570af93c22f154523f497444a9e 100644 (file)
@@ -137,6 +137,10 @@ class SalutPlugin < Plugin
   end\r
 \r
   def load_lang(lang)\r
+    dir = "#{@bot.botclass}/salut"\r
+    if not File.exist?(dir)\r
+      Dir.mkdir(dir)\r
+    end\r
     file = "#{@bot.botclass}/salut/salut-#{lang}"\r
     if File.exist?(file)\r
       begin\r