From 7673a700b38581e5ccdb37cd18976728aebbabcf Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 13 Apr 2011 20:25:26 +0200 Subject: core: use buffer pointer instead of window in input functions, add new function window_search_with_buffer in plugin API --- src/plugins/scripts/python/weechat-python-api.c | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/plugins/scripts/python') diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 58dd89af1..9a3924fc4 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5080,6 +5080,39 @@ weechat_python_api_current_window (PyObject *self, PyObject *args) PYTHON_RETURN_STRING_FREE(result); } +/* + * weechat_python_api_window_search_with_buffer: search a window with buffer + * pointer + */ + +static PyObject * +weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args) +{ + char *buffer, *result; + PyObject *object; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PYTHON_RETURN_EMPTY; + } + + buffer = NULL; + + if (!PyArg_ParseTuple (args, "s", &buffer)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PYTHON_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + + PYTHON_RETURN_STRING_FREE(result); +} + /* * weechat_python_api_window_get_integer get a window property as integer */ @@ -7076,6 +7109,7 @@ PyMethodDef weechat_python_funcs[] = { "buffer_string_replace_local_var", &weechat_python_api_buffer_string_replace_local_var, METH_VARARGS, "" }, { "buffer_match_list", &weechat_python_api_buffer_match_list, METH_VARARGS, "" }, { "current_window", &weechat_python_api_current_window, METH_VARARGS, "" }, + { "window_search_with_buffer", &weechat_python_api_window_search_with_buffer, METH_VARARGS, "" }, { "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" }, { "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" }, { "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" }, -- cgit v1.2.3