summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/ruby
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-02-23 10:51:59 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-02-23 10:51:59 +0100
commit3d3dc1593db988c7649c9f7dc7e4289a576a6c77 (patch)
treed727c01a55c3d9b20852ad6c4fc2609caf60c969 /src/plugins/scripts/ruby
parent27bf347e1c1889457e9a7d1b0419cb4d1e03a359 (diff)
downloadweechat-3d3dc1593db988c7649c9f7dc7e4289a576a6c77.zip
Allow script commands to reload only one script
Diffstat (limited to 'src/plugins/scripts/ruby')
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 166b4685a..8179d758d 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -643,6 +643,38 @@ weechat_ruby_unload_name (const char *name)
}
/*
+ * weechat_ruby_reload_name: reload a Ruby script by name
+ */
+
+void
+weechat_ruby_reload_name (const char *name)
+{
+ struct t_plugin_script *ptr_script;
+ char *filename;
+
+ ptr_script = script_search (weechat_ruby_plugin, ruby_scripts, name);
+ if (ptr_script)
+ {
+ filename = strdup (ptr_script->filename);
+ if (filename)
+ {
+ weechat_ruby_unload (ptr_script);
+ weechat_printf (NULL,
+ weechat_gettext ("%s: script \"%s\" unloaded"),
+ RUBY_PLUGIN_NAME, name);
+ weechat_ruby_load (filename);
+ free (filename);
+ }
+ }
+ else
+ {
+ weechat_printf (NULL,
+ weechat_gettext ("%s%s: script \"%s\" not loaded"),
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, name);
+ }
+}
+
+/*
* weechat_ruby_unload_all: unload all Ruby scripts
*/
@@ -721,6 +753,11 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
if (path_script)
free (path_script);
}
+ else if (weechat_strcasecmp (argv[1], "reload") == 0)
+ {
+ /* reload one Ruby script */
+ weechat_ruby_reload_name (argv_eol[2]);
+ }
else if (weechat_strcasecmp (argv[1], "unload") == 0)
{
/* unload Ruby script */