summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/tcl
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-11-29 17:44:42 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-11-29 17:44:42 +0100
commitbf0b5f5644abbf0a79674af7e75f6e24981babfc (patch)
treee3bd5fb98c83ba64f8f0f922084e6e941644529a /src/plugins/scripts/tcl
parentbc00946a0da47dbc16cefbb915ae7f94b0ac3abf (diff)
downloadweechat-bf0b5f5644abbf0a79674af7e75f6e24981babfc.zip
Add "displayed" and "highlight" arguments to callback for hook_print
Diffstat (limited to 'src/plugins/scripts/tcl')
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c15
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c2
2 files changed, 12 insertions, 5 deletions
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);