From ac72e77fcb2c9ea9bbae67476b2d66458586926a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 23 Jan 2007 16:24:29 +0000 Subject: [PATCH] salut only saves its data files when they were changed (i.e. never, presently) --- data/rbot/plugins/salut.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index 6b16a745..a74504f6 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -1,5 +1,8 @@ # vim: set sw=2 et: # Salutations plugin: respond to salutations +# TODO allow online editing of salutations +# TODO *REMEMBER* to set @changed to true after edit +# TODO or changes won't be saved unless Array.respond_to?(:pick_one) debug "Defining the pick_one method for Array" @@ -31,6 +34,7 @@ class SalutPlugin < Plugin @main_lang_str = nil @main_lang = nil @all_langs = true + @changed = false super reload end @@ -144,6 +148,7 @@ class SalutPlugin < Plugin @salutations[@main_lang] = load_lang(@main_lang_str) end create_match + @changed = false end def load_lang(lang) @@ -169,6 +174,7 @@ class SalutPlugin < Plugin def save return if @salutations.empty? + return unless @changed @salutations.each { |lang, val| l = lang.to_s save_lang(lang, val) -- 2.39.5