2005-01-12 Clinton Ebadi <clinton@unknownlamer.org>
+ * source/BotConfig.C (read_config): Made to use set_option_value
+ instead of manipulating options_db directly
+
+ * source/BotConfig.H (class BotConfig): Add set_option_value that
+ takes a t_value instead of t_value_list (most uss of
+ set_option_value will be to add a single value so this is very useful)
+
+ * source/BotConfig.C (set_option_value): Implemented
+
* source/UserList.C: Made to work with new Utils/StringTokenizer names
* source/UserCommands.C: Made to work with new
continue;
}
- // This is broken because overwrites existing values
StringTokenizer st (current_line);
std::string command = Utils::to_upper (Utils::trim_str(st.next_token('=')));
StringTokenizer params (Utils::trim_str (st.next_token('=')));
- options_db[command] = t_option_values (t_value_list (),
- t_watcher_list ());
- options_db[command].first.push_back (params.rest ());
+ set_option_value (command, params.rest (), true);
}
return true;
bool append)
{
t_options_db::iterator cf_iter = options_db.find (key);
+ key = Utils::to_upper (key); // keys are case insensitive
if (cf_iter != options_db.end ())
{
run_fun_ (key, values, append));
}
+void
+BotConfig::set_option_value (std::string key, t_value value, bool append)
+{
+ t_value_list value_list = t_value_list ();
+ value_list.push_front (value);
+
+ set_option_value (key, value_list, append);
+}
+
bool
BotConfig::add_watcher (std::string key, t_watcher new_watcher)
{
// Setters
void set_option_value (std::string key, t_value_list values,
bool append);
-
+ // Convinience proc
+ void set_option_value (std::string key, t_value value, bool append);
std::string set_config_file (std::string new_filename); // returns
// old