summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-02-20 16:29:31 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-02-20 16:29:31 +0100
commit8700e0bb36e0d52b25975d4486bf3e923cabdf68 (patch)
tree0e78e19b763328944ee27213ec968e148bc203ee /src/plugins
parent601bd7e0b871e21f1909d8ece03dd00262da93a0 (diff)
downloadweechat-8700e0bb36e0d52b25975d4486bf3e923cabdf68.zip
scripts: auto-load scripts with supported extensions only (closes #1698)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/guile/weechat-guile.c6
-rw-r--r--src/plugins/javascript/weechat-js.cpp6
-rw-r--r--src/plugins/lua/weechat-lua.c6
-rw-r--r--src/plugins/perl/weechat-perl.c6
-rw-r--r--src/plugins/php/weechat-php.c6
-rw-r--r--src/plugins/python/weechat-python.c6
-rw-r--r--src/plugins/ruby/weechat-ruby.c6
-rw-r--r--src/plugins/tcl/weechat-tcl.c6
8 files changed, 40 insertions, 8 deletions
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c
index a682137d9..32febd4c6 100644
--- a/src/plugins/guile/weechat-guile.c
+++ b/src/plugins/guile/weechat-guile.c
@@ -598,10 +598,14 @@ weechat_guile_load (const char *filename, const char *code)
void
weechat_guile_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_guile_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".scm") == 0))
+ weechat_guile_load (filename, NULL);
}
/*
diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp
index 554d3a12b..f87988fa6 100644
--- a/src/plugins/javascript/weechat-js.cpp
+++ b/src/plugins/javascript/weechat-js.cpp
@@ -417,10 +417,14 @@ weechat_js_load (const char *filename, const char *code)
void
weechat_js_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C++ compiler happy */
(void) data;
- weechat_js_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".js") == 0))
+ weechat_js_load (filename, NULL);
}
/*
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index 1a66cf166..898e438c0 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -696,10 +696,14 @@ weechat_lua_load (const char *filename, const char *code)
void
weechat_lua_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_lua_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".lua") == 0))
+ weechat_lua_load (filename, NULL);
}
/*
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index d28c0697d..ede5bea73 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -663,10 +663,14 @@ weechat_perl_load (const char *filename, const char *code)
void
weechat_perl_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_perl_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".pl") == 0))
+ weechat_perl_load (filename, NULL);
}
/*
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 092113195..89ebdd7e9 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -743,10 +743,14 @@ weechat_php_load (const char *filename, const char *code)
void
weechat_php_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_php_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".php") == 0))
+ weechat_php_load (filename, NULL);
}
/*
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index 0a4cca493..5cce23548 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -1053,10 +1053,14 @@ weechat_python_load (const char *filename, const char *code)
void
weechat_python_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_python_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".py") == 0))
+ weechat_python_load (filename, NULL);
}
/*
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index f8002fc00..d493ba524 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -734,10 +734,14 @@ weechat_ruby_load (const char *filename, const char *code)
void
weechat_ruby_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_ruby_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".rb") == 0))
+ weechat_ruby_load (filename, NULL);
}
/*
diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c
index 86433dd26..22163f948 100644
--- a/src/plugins/tcl/weechat-tcl.c
+++ b/src/plugins/tcl/weechat-tcl.c
@@ -423,10 +423,14 @@ weechat_tcl_load (const char *filename, const char *code)
void
weechat_tcl_load_cb (void *data, const char *filename)
{
+ const char *pos_dot;
+
/* make C compiler happy */
(void) data;
- weechat_tcl_load (filename, NULL);
+ pos_dot = strrchr (filename, '.');
+ if (pos_dot && (strcmp (pos_dot, ".tcl") == 0))
+ weechat_tcl_load (filename, NULL);
}
/*