summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python/weechat-python-api.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-05-10 01:22:08 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-05-10 01:22:08 +0200
commit57c6478b9184979ad1a09336076b0c07cd7fc56b (patch)
tree60a01bcb7d788217b5c47431c0c1db12dcc053b3 /src/plugins/scripts/python/weechat-python-api.c
parent09c42f4cf0787a72a70dd5273da355e522e9fdf5 (diff)
downloadweechat-57c6478b9184979ad1a09336076b0c07cd7fc56b.zip
Add function window_set_title in API (task #9361)
Diffstat (limited to 'src/plugins/scripts/python/weechat-python-api.c')
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 45282370f..6cf94d2e3 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -4298,7 +4298,7 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PYTHON_RETURN_ERROR;
+ PYTHON_RETURN_EMPTY;
}
buffer = NULL;
@@ -4425,7 +4425,7 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
- PYTHON_RETURN_ERROR;
+ PYTHON_RETURN_EMPTY;
}
window = NULL;
@@ -4458,7 +4458,7 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PYTHON_RETURN_ERROR;
+ PYTHON_RETURN_EMPTY;
}
window = NULL;
@@ -4477,6 +4477,37 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_window_set_title: set window title
+ */
+
+static PyObject *
+weechat_python_api_window_set_title (PyObject *self, PyObject *args)
+{
+ char *title;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
+ PYTHON_RETURN_ERROR;
+ }
+
+ title = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &title))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
+ PYTHON_RETURN_ERROR;
+ }
+
+ weechat_window_set_title (title);
+
+ PYTHON_RETURN_OK;
+}
+
+/*
* weechat_python_api_nicklist_add_group: add a group in nicklist
*/
@@ -5932,6 +5963,7 @@ PyMethodDef weechat_python_funcs[] =
{ "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, "" },
+ { "window_set_title", &weechat_python_api_window_set_title, METH_VARARGS, "" },
{ "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" },
{ "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" },
{ "nicklist_add_nick", &weechat_python_api_nicklist_add_nick, METH_VARARGS, "" },