diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-29 17:44:42 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-29 17:44:42 +0100 |
commit | bf0b5f5644abbf0a79674af7e75f6e24981babfc (patch) | |
tree | e3bd5fb98c83ba64f8f0f922084e6e941644529a /src/plugins/scripts/python | |
parent | bc00946a0da47dbc16cefbb915ae7f94b0ac3abf (diff) | |
download | weechat-bf0b5f5644abbf0a79674af7e75f6e24981babfc.zip |
Add "displayed" and "highlight" arguments to callback for hook_print
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 15 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 25 |
2 files changed, 33 insertions, 7 deletions
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); |