summaryrefslogtreecommitdiff
path: root/src/plugins/tcl/weechat-tcl.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-02-25 08:46:41 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-02-25 08:46:41 +0100
commitb60aec975ba13d347edd3a110cbfef7699bc3cfb (patch)
tree99945fce576fe848714bdeb9486f6fdbab974c2d /src/plugins/tcl/weechat-tcl.c
parent87b50969722b894bebe791211b232da5ffd82082 (diff)
downloadweechat-b60aec975ba13d347edd3a110cbfef7699bc3cfb.zip
script: add control of autoload (enable/disable/toggle) (task #12393)
New option script.scripts.autoload, new options autoload/noautoload/toggleautoload for command /script, new action "A" (meta-A) on script buffer (toggle autoload).
Diffstat (limited to 'src/plugins/tcl/weechat-tcl.c')
-rw-r--r--src/plugins/tcl/weechat-tcl.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c
index d379c0133..733af1c45 100644
--- a/src/plugins/tcl/weechat-tcl.c
+++ b/src/plugins/tcl/weechat-tcl.c
@@ -52,7 +52,7 @@ const char *tcl_current_script_filename = NULL;
/*
* string used to execute action "install":
- * when signal "tcl_install_script" is received, name of string
+ * when signal "tcl_script_install" is received, name of string
* is added to this string, to be installed later by a timer (when nothing is
* running in script)
*/
@@ -60,12 +60,20 @@ char *tcl_action_install_list = NULL;
/*
* string used to execute action "remove":
- * when signal "tcl_remove_script" is received, name of string
+ * when signal "tcl_script_remove" is received, name of string
* is added to this string, to be removed later by a timer (when nothing is
* running in script)
*/
char *tcl_action_remove_list = NULL;
+/*
+ * string used to execute action "autoload":
+ * when signal "tcl_script_autoload" is received, name of string
+ * is added to this string, to autoload or disable autoload later by a timer
+ * (when nothing is running in script)
+ */
+char *tcl_action_autoload_list = NULL;
+
Tcl_Interp* cinterp;
@@ -728,6 +736,12 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
&tcl_quiet,
&tcl_action_remove_list);
}
+ else if (data == &tcl_action_autoload_list)
+ {
+ plugin_script_action_autoload (weechat_tcl_plugin,
+ &tcl_quiet,
+ &tcl_action_autoload_list);
+ }
}
return WEECHAT_RC_OK;
@@ -763,6 +777,14 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
&weechat_tcl_timer_action_cb,
&tcl_action_remove_list);
}
+ else if (strcmp (signal, "tcl_script_autoload") == 0)
+ {
+ plugin_script_action_add (&tcl_action_autoload_list,
+ (const char *)signal_data);
+ weechat_hook_timer (1, 0, 1,
+ &weechat_tcl_timer_action_cb,
+ &tcl_action_autoload_list);
+ }
}
return WEECHAT_RC_OK;
@@ -811,5 +833,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
plugin_script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
tcl_quiet = 0;
+ /* free some data */
+ if (tcl_action_install_list)
+ free (tcl_action_install_list);
+ if (tcl_action_remove_list)
+ free (tcl_action_remove_list);
+ if (tcl_action_autoload_list)
+ free (tcl_action_autoload_list);
+
return WEECHAT_RC_OK;
}