summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-03-11 18:39:37 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-03-11 18:39:37 +0100
commitc71e2cad382544e01855ad668a55acf871c484c1 (patch)
tree909de9e11417ed34d6e7dcac07b2a74e91b9a3a0 /src/plugins/scripts/python
parentadae98e94d58ebc29dd02d9404dfc7593716baa8 (diff)
downloadweechat-c71e2cad382544e01855ad668a55acf871c484c1.zip
Add function "buffer_match_list" in plugin API
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index e306d00fc..58dd89af1 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -4853,7 +4853,7 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args)
}
/*
- * weechat_python_api_buffer_get_integer get a buffer property as integer
+ * weechat_python_api_buffer_get_integer: get a buffer property as integer
*/
static PyObject *
@@ -5022,6 +5022,40 @@ weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *ar
}
/*
+ * weechat_python_api_buffer_match_list: return 1 if buffer matches list of
+ * buffers
+ */
+
+static PyObject *
+weechat_python_api_buffer_match_list (PyObject *self, PyObject *args)
+{
+ char *buffer, *string;
+ int value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script || !python_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
+ PYTHON_RETURN_INT(0);
+ }
+
+ buffer = NULL;
+ string = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
+ PYTHON_RETURN_INT(0);
+ }
+
+ value = weechat_buffer_match_list (script_str2ptr (buffer), string);
+
+ PYTHON_RETURN_INT(value);
+}
+
+/*
* weechat_python_api_current_window: get current window
*/
@@ -7040,6 +7074,7 @@ PyMethodDef weechat_python_funcs[] =
{ "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" },
{ "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" },
{ "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_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" },
{ "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" },