summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c15
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c10
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c15
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c15
-rw-r--r--src/plugins/scripts/python/weechat-python.c25
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c15
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c43
-rw-r--r--src/plugins/scripts/script-api.c1
-rw-r--r--src/plugins/scripts/script-api.h2
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c15
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c2
11 files changed, 126 insertions, 32 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 51ebcd0c6..82edef379 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -2812,10 +2812,11 @@ int
weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- char *lua_argv[6];
+ char *lua_argv[8];
static char timebuffer[64];
int *rc, ret;
@@ -2829,9 +2830,11 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
lua_argv[0] = script_ptr2str (buffer);
lua_argv[1] = timebuffer;
lua_argv[2] = weechat_string_build_with_exploded (tags, ",");
- lua_argv[3] = (char *)prefix;
- lua_argv[4] = (char *)message;
- lua_argv[5] = NULL;
+ lua_argv[3] = (displayed) ? strdup ("1") : strdup ("0");
+ lua_argv[4] = (highlight) ? strdup ("1") : strdup ("0");
+ lua_argv[5] = (char *)prefix;
+ lua_argv[6] = (char *)message;
+ lua_argv[7] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@@ -2849,6 +2852,10 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (lua_argv[0]);
if (lua_argv[2])
free (lua_argv[2]);
+ if (lua_argv[3])
+ free (lua_argv[3]);
+ if (lua_argv[4])
+ free (lua_argv[4]);
return ret;
}
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index 70b731292..377b213ff 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -88,6 +88,16 @@ weechat_lua_exec (struct t_plugin_script *script,
{
argc = 5;
lua_pushstring (lua_current_interpreter, argv[4]);
+ if (argv[5])
+ {
+ argc = 6;
+ lua_pushstring (lua_current_interpreter, argv[5]);
+ if (argv[6])
+ {
+ argc = 7;
+ lua_pushstring (lua_current_interpreter, argv[6]);
+ }
+ }
}
}
}
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index f25824e3c..b953b0b3b 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2344,10 +2344,11 @@ int
weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- char *perl_argv[6];
+ char *perl_argv[8];
static char timebuffer[64];
int *rc, ret;
@@ -2361,9 +2362,11 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
perl_argv[0] = script_ptr2str (buffer);
perl_argv[1] = timebuffer;
perl_argv[2] = weechat_string_build_with_exploded (tags, ",");
- perl_argv[3] = (char *)prefix;
- perl_argv[4] = (char *)message;
- perl_argv[5] = NULL;
+ perl_argv[3] = (displayed) ? strdup ("1") : strdup ("0");
+ perl_argv[4] = (highlight) ? strdup ("1") : strdup ("0");
+ perl_argv[5] = (char *)prefix;
+ perl_argv[6] = (char *)message;
+ perl_argv[7] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@@ -2381,6 +2384,10 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (perl_argv[0]);
if (perl_argv[2])
free (perl_argv[2]);
+ if (perl_argv[3])
+ free (perl_argv[3]);
+ if (perl_argv[4])
+ free (perl_argv[4]);
return ret;
}
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index d4d5da1aa..f6253f087 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -2504,10 +2504,11 @@ int
weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- char *python_argv[6];
+ char *python_argv[8];
static char timebuffer[64];
int *rc, ret;
@@ -2521,9 +2522,11 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
python_argv[0] = script_ptr2str (buffer);
python_argv[1] = timebuffer;
python_argv[2] = weechat_string_build_with_exploded (tags, ",");
- python_argv[3] = (char *)prefix;
- python_argv[4] = (char *)message;
- python_argv[5] = NULL;
+ python_argv[3] = (displayed) ? strdup ("1") : strdup ("0");
+ python_argv[4] = (highlight) ? strdup ("1") : strdup ("0");
+ python_argv[5] = (char *)prefix;
+ python_argv[6] = (char *)message;
+ python_argv[7] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@@ -2541,6 +2544,10 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (python_argv[0]);
if (python_argv[2])
free (python_argv[2]);
+ if (python_argv[3])
+ free (python_argv[3]);
+ if (python_argv[4])
+ free (python_argv[4]);
return ret;
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index e43deffe4..721f7dcdf 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -93,28 +93,47 @@ weechat_python_exec (struct t_plugin_script *script,
{
if (argv[5])
{
- rc = PyObject_CallFunction (evFunc, "ssssss", argv[0],
- argv[1], argv[2], argv[3],
- argv[4], argv[5]);
+ if (argv[6])
+ {
+ rc = PyObject_CallFunction (evFunc, "sssssss", argv[0],
+ argv[1], argv[2], argv[3],
+ argv[4], argv[5], argv[6]);
+ }
+ else
+ {
+ rc = PyObject_CallFunction (evFunc, "ssssss", argv[0],
+ argv[1], argv[2], argv[3],
+ argv[4], argv[5]);
+ }
}
else
+ {
rc = PyObject_CallFunction (evFunc, "sssss", argv[0],
argv[1], argv[2], argv[3],
argv[4]);
+ }
}
else
+ {
rc = PyObject_CallFunction (evFunc, "ssss", argv[0],
argv[1], argv[2], argv[3]);
+ }
}
else
+ {
rc = PyObject_CallFunction (evFunc, "sss", argv[0],
argv[1], argv[2]);
+ }
}
else
+ {
rc = PyObject_CallFunction (evFunc, "ss", argv[0], argv[1]);
+ }
}
else
+ {
rc = PyObject_CallFunction (evFunc, "s", argv[0]);
+ }
}
else
rc = PyObject_CallFunction (evFunc, NULL);
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index fd09a9e7f..8e3f0e5d5 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -2887,10 +2887,11 @@ int
weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- char *ruby_argv[6];
+ char *ruby_argv[8];
static char timebuffer[64];
int *rc, ret;
@@ -2904,9 +2905,11 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ruby_argv[0] = script_ptr2str (buffer);
ruby_argv[1] = timebuffer;
ruby_argv[2] = weechat_string_build_with_exploded (tags, ",");
- ruby_argv[3] = (char *)prefix;
- ruby_argv[4] = (char *)message;
- ruby_argv[5] = NULL;
+ ruby_argv[3] = (displayed) ? strdup ("1") : strdup ("0");
+ ruby_argv[4] = (highlight) ? strdup ("1") : strdup ("0");
+ ruby_argv[5] = (char *)prefix;
+ ruby_argv[6] = (char *)message;
+ ruby_argv[7] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@@ -2924,6 +2927,10 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (ruby_argv[0]);
if (ruby_argv[2])
free (ruby_argv[2]);
+ if (ruby_argv[3])
+ free (ruby_argv[3]);
+ if (ruby_argv[4])
+ free (ruby_argv[4]);
return ret;
}
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 83f96dd50..53a616018 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -130,16 +130,32 @@ weechat_ruby_exec (struct t_plugin_script *script,
{
if (argv[5])
{
- rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
- &ruby_error, 6,
- rb_str_new2(argv[0]),
- rb_str_new2(argv[1]),
- rb_str_new2(argv[2]),
- rb_str_new2(argv[3]),
- rb_str_new2(argv[4]),
- rb_str_new2(argv[5]));
+ if (argv[6])
+ {
+ rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
+ &ruby_error, 7,
+ rb_str_new2(argv[0]),
+ rb_str_new2(argv[1]),
+ rb_str_new2(argv[2]),
+ rb_str_new2(argv[3]),
+ rb_str_new2(argv[4]),
+ rb_str_new2(argv[5]),
+ rb_str_new2(argv[6]));
+ }
+ else
+ {
+ rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
+ &ruby_error, 6,
+ rb_str_new2(argv[0]),
+ rb_str_new2(argv[1]),
+ rb_str_new2(argv[2]),
+ rb_str_new2(argv[3]),
+ rb_str_new2(argv[4]),
+ rb_str_new2(argv[5]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 5,
rb_str_new2(argv[0]),
@@ -147,36 +163,47 @@ weechat_ruby_exec (struct t_plugin_script *script,
rb_str_new2(argv[2]),
rb_str_new2(argv[3]),
rb_str_new2(argv[4]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 4,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]),
rb_str_new2(argv[2]),
rb_str_new2(argv[3]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 3,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]),
rb_str_new2(argv[2]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 2,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 1,
rb_str_new2(argv[0]));
+ }
}
else
+ {
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 0);
+ }
if (ruby_error)
{
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 25cdad711..62e19e9a3 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -790,6 +790,7 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix,
const char *message),
const char *function)
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index c1a379d30..eff244667 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -143,6 +143,8 @@ extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_pl
time_t date,
int tags_count,
const char **tags,
+ int displayed,
+ int highlight,
const char *prefix,
const char *message),
const char *function);
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 090f999dc..4e51e24d1 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -2716,10 +2716,11 @@ int
weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
+ int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- char *tcl_argv[6];
+ char *tcl_argv[8];
static char timebuffer[64];
int *rc, ret;
@@ -2733,9 +2734,11 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
tcl_argv[0] = script_ptr2str (buffer);
tcl_argv[1] = timebuffer;
tcl_argv[2] = weechat_string_build_with_exploded (tags, ",");
- tcl_argv[3] = (char *)prefix;
- tcl_argv[4] = (char *)message;
- tcl_argv[5] = NULL;
+ tcl_argv[3] = (displayed) ? strdup ("1") : strdup ("0");
+ tcl_argv[4] = (highlight) ? strdup ("1") : strdup ("0");
+ tcl_argv[5] = (char *)prefix;
+ tcl_argv[6] = (char *)message;
+ tcl_argv[7] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@@ -2753,6 +2756,10 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (tcl_argv[0]);
if (tcl_argv[2])
free (tcl_argv[2]);
+ if (tcl_argv[3])
+ free (tcl_argv[3]);
+ if (tcl_argv[4])
+ free (tcl_argv[4]);
return ret;
}
diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c
index b3350e191..2f0058ee2 100644
--- a/src/plugins/scripts/tcl/weechat-tcl.c
+++ b/src/plugins/scripts/tcl/weechat-tcl.c
@@ -82,7 +82,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
if (argv)
{
- for (i = 0; argv[i] && (i<6); i++)
+ for (i = 0; argv[i]; i++)
{
Tcl_DStringAppend (&ds, " \"", -1);
Tcl_DStringAppend (&ds, argv[i], -1);