summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2004-06-29 10:07:03 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-06-29 10:07:03 +0000
commit482d07b7c39079e5693d91c5c0944c9aea5b4166 (patch)
tree9abef1fa8fd8a4aadf6614b925a9e3df91dfe1f8 /src
parent7bc708b5c7bd19d83ca38622ba74b5efa639fecc (diff)
downloadirssi-482d07b7c39079e5693d91c5c0944c9aea5b4166.zip
Make /LOAD script.pl load it.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3256 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/perl/perl-fe.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c
index 3c47a6d7..7015cdf2 100644
--- a/src/perl/perl-fe.c
+++ b/src/perl/perl-fe.c
@@ -160,6 +160,25 @@ static void cmd_script_list(void)
TXT_SCRIPT_LIST_FOOTER);
}
+static void cmd_load(const char *data, SERVER_REC *server, void *item)
+{
+ char *rootmodule, *submodule;
+ void *free_arg;
+ size_t len;
+
+ if (!cmd_get_params(data, &free_arg, 2 , &rootmodule, &submodule))
+ return;
+
+ len = strlen(rootmodule);
+ if (len > 3 && strcmp(rootmodule + len - 3, ".pl") == 0) {
+ /* make /LOAD script.pl work as expected */
+ signal_stop();
+ cmd_script_load(data);
+ }
+
+ cmd_params_free(free_arg);
+}
+
static void sig_script_error(PERL_SCRIPT_REC *script, const char *error)
{
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
@@ -230,6 +249,7 @@ void fe_perl_init(void)
command_bind("script unload", NULL, (SIGNAL_FUNC) cmd_script_unload);
command_bind("script reset", NULL, (SIGNAL_FUNC) cmd_script_reset);
command_bind("script list", NULL, (SIGNAL_FUNC) cmd_script_list);
+ command_bind("load", NULL, (SIGNAL_FUNC) cmd_load);
command_set_options("script exec", "permanent");
signal_add("script error", (SIGNAL_FUNC) sig_script_error);
@@ -248,6 +268,7 @@ void fe_perl_deinit(void)
command_unbind("script unload", (SIGNAL_FUNC) cmd_script_unload);
command_unbind("script reset", (SIGNAL_FUNC) cmd_script_reset);
command_unbind("script list", (SIGNAL_FUNC) cmd_script_list);
+ command_unbind("load", (SIGNAL_FUNC) cmd_load);
signal_remove("script error", (SIGNAL_FUNC) sig_script_error);
signal_remove("complete command script load", (SIGNAL_FUNC) sig_complete_load);