save config on plugin enabled / disabled

This commit is contained in:
yago 2015-01-01 13:54:43 +01:00
parent 7591920a39
commit ae0411ff25
2 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,7 @@ function do_action(msg)
for name, desc in pairs(plugins) do for name, desc in pairs(plugins) do
-- print("Trying module", name) -- print("Trying module", name)
for k, pattern in pairs(desc.patterns) do for k, pattern in pairs(desc.patterns) do
print("Trying", text, "against", pattern) -- print("Trying", text, "against", pattern)
matches = { string.match(text, pattern) } matches = { string.match(text, pattern) }
if matches[1] then if matches[1] then
print(" matches",pattern) print(" matches",pattern)

View File

@ -7,6 +7,7 @@ function enable_plugin( filename )
if plugin_exists(filename) then if plugin_exists(filename) then
-- Add to the config table -- Add to the config table
table.insert(_config.enabled_plugins, filename) table.insert(_config.enabled_plugins, filename)
save_config()
-- Reload the plugins -- Reload the plugins
return reload_plugins( ) return reload_plugins( )
else else
@ -26,6 +27,7 @@ function disable_plugin( name )
end end
-- Disable and reload -- Disable and reload
table.remove(_config.enabled_plugins, k) table.remove(_config.enabled_plugins, k)
save_config( )
return reload_plugins(true) return reload_plugins(true)
end end