mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
Add "displayed" and "highlight" arguments to callback for hook_print
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user