summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/tcl/weechat-tcl-api.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-06-10 23:01:40 +0200
committerSebastien Helleu <flashcode@flashtux.org>2012-06-10 23:01:40 +0200
commit529d12c1dbad36227e622edab95ac176a94dd5d5 (patch)
treef19855397a13190ae55f7d34a7a678aaa4081e99 /src/plugins/scripts/tcl/weechat-tcl-api.c
parente25909878e54882515cd926c0a2fbb31df18ffe8 (diff)
downloadweechat-529d12c1dbad36227e622edab95ac176a94dd5d5.zip
scripts: ignore call to "register" (with a warning) if script is already registered
Diffstat (limited to 'src/plugins/scripts/tcl/weechat-tcl-api.c')
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index c282242e4..6762516b5 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -218,6 +218,16 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
int i;
API_FUNC(0, "register", API_RETURN_ERROR);
+ if (tcl_registered_script)
+ {
+ /* script already registered */
+ weechat_printf (NULL,
+ weechat_gettext ("%s%s: script \"%s\" already "
+ "registered (register ignored)"),
+ weechat_prefix ("error"), TCL_PLUGIN_NAME,
+ tcl_registered_script->name);
+ API_RETURN_ERROR;
+ }
tcl_current_script = NULL;
tcl_registered_script = NULL;
@@ -234,7 +244,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
if (script_search (weechat_tcl_plugin, tcl_scripts, name))
{
- /* error: another script already exists with this name! */
+ /* another script already exists with same name */
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to register script "
"\"%s\" (another script already "