From cdab55aa0552356173815cfc79a7b9ddc0a435ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 10 May 2014 08:26:56 +0200 Subject: api: change type of arguments displayed/highlight in hook_print callback from string to integer (in scripts) --- src/plugins/python/weechat-python-api.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/plugins/python') diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index ee0dfa4be..c79196ad5 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -2438,15 +2438,15 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = PyLong_FromLong((long)displayed); + func_argv[5] = PyLong_FromLong((long)highlight); func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_python_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssOOss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2460,9 +2460,13 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, if (func_argv[3]) free (func_argv[3]); if (func_argv[4]) - free (func_argv[4]); + { + Py_XDECREF((PyObject *)func_argv[4]); + } if (func_argv[5]) - free (func_argv[5]); + { + Py_XDECREF((PyObject *)func_argv[5]); + } return ret; } -- cgit v1.2.3