summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
commitdfdf42e27b033730178bf8884e2f4a1e6c960791 (patch)
tree6f7a25f6df49089832aabc6448bd6e527de2ea0e /src/plugins/scripts/python
parent2a83aae85e68a8c7431f372f39131b09fea7bca1 (diff)
downloadweechat-dfdf42e27b033730178bf8884e2f4a1e6c960791.zip
core: remove unneeded whitespace
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c1392
-rw-r--r--src/plugins/scripts/python/weechat-python.c184
2 files changed, 788 insertions, 788 deletions
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 78c308605..83bfde802 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -82,7 +82,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
{
char *name, *author, *version, *license, *shutdown_func, *description;
char *charset;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
python_current_script = NULL;
python_registered_script = NULL;
@@ -96,7 +96,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssssss", &name, &author, &version,
&license, &description, &shutdown_func, &charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (script_search (weechat_python_plugin, python_scripts, name))
{
/* error: another scripts already exists with this name! */
@@ -107,7 +107,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
python_current_script = script_add (weechat_python_plugin,
&python_scripts, &last_python_script,
@@ -130,7 +130,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -144,14 +144,14 @@ weechat_python_api_plugin_get_name (PyObject *self, PyObject *args)
{
char *plugin;
const char *result;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
plugin = NULL;
if (!PyArg_ParseTuple (args, "s", &plugin))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_plugin_get_name (script_str2ptr (plugin));
-
+
API_RETURN_STRING(result);
}
@@ -163,15 +163,15 @@ static PyObject *
weechat_python_api_charset_set (PyObject *self, PyObject *args)
{
char *charset;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
charset = NULL;
if (!PyArg_ParseTuple (args, "s", &charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_charset_set (python_current_script,
charset);
-
+
API_RETURN_OK;
}
@@ -184,15 +184,15 @@ weechat_python_api_iconv_to_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_to_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -206,15 +206,15 @@ weechat_python_api_iconv_from_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_from_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -227,14 +227,14 @@ weechat_python_api_gettext (PyObject *self, PyObject *args)
{
char *string;
const char *result;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_gettext (string);
-
+
API_RETURN_STRING(result);
}
@@ -248,16 +248,16 @@ weechat_python_api_ngettext (PyObject *self, PyObject *args)
char *single, *plural;
const char *result;
int count;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
single = NULL;
plural = NULL;
count = 0;
if (!PyArg_ParseTuple (args, "ssi", &single, &plural, &count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_ngettext (single, plural, count);
-
+
API_RETURN_STRING(result);
}
@@ -272,16 +272,16 @@ weechat_python_api_string_match (PyObject *self, PyObject *args)
{
char *string, *mask;
int case_sensitive, value;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
string = NULL;
mask = NULL;
case_sensitive = 0;
if (!PyArg_ParseTuple (args, "ssi", &string, &mask, &case_sensitive))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_match (string, mask, case_sensitive);
-
+
API_RETURN_INT(value);
}
@@ -298,15 +298,15 @@ weechat_python_api_string_has_highlight (PyObject *self, PyObject *args)
{
char *string, *highlight_words;
int value;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
string = NULL;
highlight_words = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &highlight_words))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight (string, highlight_words);
-
+
API_RETURN_INT(value);
}
@@ -323,15 +323,15 @@ weechat_python_api_string_has_highlight_regex (PyObject *self, PyObject *args)
{
char *string, *regex;
int value;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
string = NULL;
regex = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &regex))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight_regex (string, regex);
-
+
API_RETURN_INT(value);
}
@@ -347,14 +347,14 @@ weechat_python_api_string_mask_to_regex (PyObject *self, PyObject *args)
{
char *mask, *result;
PyObject *return_value;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
mask = NULL;
if (!PyArg_ParseTuple (args, "s", &mask))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_mask_to_regex (mask);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -368,15 +368,15 @@ weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
{
char *string, *replacement, *result;
PyObject *return_value;
-
+
API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
string = NULL;
replacement = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_remove_color (string, replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -390,14 +390,14 @@ weechat_python_api_string_is_command_char (PyObject *self, PyObject *args)
{
char *string;
int value;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_is_command_char (string);
-
+
API_RETURN_INT(value);
}
@@ -412,14 +412,14 @@ weechat_python_api_string_input_for_buffer (PyObject *self, PyObject *args)
{
char *string;
const char *result;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_input_for_buffer (string);
-
+
API_RETURN_STRING(result);
}
@@ -432,13 +432,13 @@ weechat_python_api_mkdir_home (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_home (directory, mode))
API_RETURN_OK;
@@ -454,16 +454,16 @@ weechat_python_api_mkdir (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -477,16 +477,16 @@ weechat_python_api_mkdir_parents (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_parents (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -499,14 +499,14 @@ weechat_python_api_list_new (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -519,7 +519,7 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
{
char *weelist, *data, *where, *user_data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
@@ -527,12 +527,12 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
user_data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -545,16 +545,16 @@ weechat_python_api_list_search (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -567,15 +567,15 @@ weechat_python_api_list_search_pos (PyObject *self, PyObject *args)
{
char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -588,16 +588,16 @@ weechat_python_api_list_casesearch (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -611,15 +611,15 @@ weechat_python_api_list_casesearch_pos (PyObject *self, PyObject *args)
{
char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -633,13 +633,13 @@ weechat_python_api_list_get (PyObject *self, PyObject *args)
char *weelist, *result;
int position;
PyObject *return_value;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
weelist = NULL;
position = 0;
if (!PyArg_ParseTuple (args, "si", &weelist, &position))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
API_RETURN_STRING_FREE(result);
@@ -653,16 +653,16 @@ static PyObject *
weechat_python_api_list_set (PyObject *self, PyObject *args)
{
char *item, *new_value;
-
+
API_FUNC(1, "list_set", API_RETURN_ERROR);
item = NULL;
new_value = NULL;
if (!PyArg_ParseTuple (args, "ss", &item, &new_value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_set (script_str2ptr (item),
new_value);
-
+
API_RETURN_OK;
}
@@ -675,14 +675,14 @@ weechat_python_api_list_next (PyObject *self, PyObject *args)
{
char *item, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -695,14 +695,14 @@ weechat_python_api_list_prev (PyObject *self, PyObject *args)
{
char *item, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -715,14 +715,14 @@ weechat_python_api_list_string (PyObject *self, PyObject *args)
{
char *item;
const char *result;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_list_string (script_str2ptr (item));
-
+
API_RETURN_STRING(result);
}
@@ -735,14 +735,14 @@ weechat_python_api_list_size (PyObject *self, PyObject *args)
{
char *weelist;
int size;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
size = weechat_list_size (script_str2ptr (weelist));
-
+
API_RETURN_INT(size);
}
@@ -754,16 +754,16 @@ static PyObject *
weechat_python_api_list_remove (PyObject *self, PyObject *args)
{
char *weelist, *item;
-
+
API_FUNC(1, "list_remove", API_RETURN_ERROR);
weelist = NULL;
item = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -775,14 +775,14 @@ static PyObject *
weechat_python_api_list_remove_all (PyObject *self, PyObject *args)
{
char *weelist;
-
+
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove_all (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -794,14 +794,14 @@ static PyObject *
weechat_python_api_list_free (PyObject *self, PyObject *args)
{
char *weelist;
-
+
API_FUNC(1, "list_free", API_RETURN_ERROR);
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_free (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -817,19 +817,19 @@ weechat_python_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -839,10 +839,10 @@ weechat_python_api_config_reload_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -855,21 +855,21 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new (weechat_python_plugin,
python_current_script,
name,
&weechat_python_api_config_reload_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -887,9 +887,9 @@ weechat_python_api_config_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -897,12 +897,12 @@ weechat_python_api_config_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -914,10 +914,10 @@ weechat_python_api_config_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -934,7 +934,7 @@ weechat_python_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -942,12 +942,12 @@ weechat_python_api_config_section_write_cb (void *data,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -957,10 +957,10 @@ weechat_python_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -978,7 +978,7 @@ weechat_python_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -986,12 +986,12 @@ weechat_python_api_config_section_write_default_cb (void *data,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1001,10 +1001,10 @@ weechat_python_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1023,9 +1023,9 @@ weechat_python_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1033,12 +1033,12 @@ weechat_python_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1050,10 +1050,10 @@ weechat_python_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1071,21 +1071,21 @@ weechat_python_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1099,10 +1099,10 @@ weechat_python_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1119,7 +1119,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
char *data_delete_option, *result;
int user_can_add_options, user_can_delete_options;
PyObject *return_value;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
config_file = NULL;
name = NULL;
@@ -1143,7 +1143,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&data_create_option, &function_delete_option,
&data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file),
@@ -1165,7 +1165,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&weechat_python_api_config_section_delete_option_cb,
function_delete_option,
data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1178,16 +1178,16 @@ weechat_python_api_config_search_section (PyObject *self, PyObject *args)
{
char *config_file, *section_name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
config_file = NULL;
section_name = NULL;
if (!PyArg_ParseTuple (args, "ss", &config_file, &section_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1205,20 +1205,20 @@ weechat_python_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1228,10 +1228,10 @@ weechat_python_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1247,22 +1247,22 @@ weechat_python_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1280,22 +1280,22 @@ weechat_python_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1314,7 +1314,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
char *data_change, *function_delete, *data_delete;
int min, max, null_value_allowed;
PyObject *return_value;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
@@ -1337,7 +1337,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
&function_change, &data_change, &function_delete,
&data_delete))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file),
@@ -1360,7 +1360,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
&weechat_python_api_config_option_delete_cb,
function_delete,
data_delete));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1373,18 +1373,18 @@ weechat_python_api_config_search_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *option_name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
option_name = NULL;
if (!PyArg_ParseTuple (args, "sss", &config_file, &section, &option_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1397,14 +1397,14 @@ weechat_python_api_config_string_to_boolean (PyObject *self, PyObject *args)
{
char *text;
int value;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
text = NULL;
if (!PyArg_ParseTuple (args, "s", &text))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_string_to_boolean (text);
-
+
API_RETURN_INT(value);
}
@@ -1417,16 +1417,16 @@ weechat_python_api_config_option_reset (PyObject *self, PyObject *args)
{
char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
option = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1439,18 +1439,18 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
{
char *option, *new_value;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
new_value = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1464,16 +1464,16 @@ weechat_python_api_config_option_set_null (PyObject *self, PyObject *args)
{
char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1486,14 +1486,14 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = weechat_config_option_unset (script_str2ptr (option));
-
+
API_RETURN_INT(rc);
}
@@ -1505,16 +1505,16 @@ static PyObject *
weechat_python_api_config_option_rename (PyObject *self, PyObject *args)
{
char *option, *new_name;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
option = NULL;
new_name = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &new_name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_option_rename (script_str2ptr (option),
new_name);
-
+
API_RETURN_OK;
}
@@ -1527,14 +1527,14 @@ weechat_python_api_config_option_is_null (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1548,14 +1548,14 @@ weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args
{
char *option;
int value;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_default_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1568,14 +1568,14 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1588,14 +1588,14 @@ weechat_python_api_config_boolean_default (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1608,14 +1608,14 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1628,14 +1628,14 @@ weechat_python_api_config_integer_default (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1648,14 +1648,14 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1668,14 +1668,14 @@ weechat_python_api_config_string_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1688,14 +1688,14 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1708,14 +1708,14 @@ weechat_python_api_config_color_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1727,16 +1727,16 @@ static PyObject *
weechat_python_api_config_write_option (PyObject *self, PyObject *args)
{
char *config_file, *option;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
config_file = NULL;
option = NULL;
if (!PyArg_ParseTuple (args, "ss", &config_file, &option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1748,19 +1748,19 @@ static PyObject *
weechat_python_api_config_write_line (PyObject *self, PyObject *args)
{
char *config_file, *option_name, *value;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
config_file = NULL;
option_name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &config_file, &option_name, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_line (script_str2ptr (config_file),
option_name,
"%s",
value);
-
+
API_RETURN_OK;
}
@@ -1773,14 +1773,14 @@ weechat_python_api_config_write (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_write (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1793,14 +1793,14 @@ weechat_python_api_config_read (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_read (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1813,14 +1813,14 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_reload (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1832,16 +1832,16 @@ static PyObject *
weechat_python_api_config_option_free (PyObject *self, PyObject *args)
{
char *option;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_option_free (weechat_python_plugin,
python_current_script,
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1854,16 +1854,16 @@ static PyObject *
weechat_python_api_config_section_free_options (PyObject *self, PyObject *args)
{
char *section;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
section = NULL;
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free_options (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1875,16 +1875,16 @@ static PyObject *
weechat_python_api_config_section_free (PyObject *self, PyObject *args)
{
char *section;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
section = NULL;
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1896,16 +1896,16 @@ static PyObject *
weechat_python_api_config_free (PyObject *self, PyObject *args)
{
char *config_file;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_free (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file));
-
+
API_RETURN_OK;
}
@@ -1918,14 +1918,14 @@ weechat_python_api_config_get (PyObject *self, PyObject *args)
{
char *option, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_get (option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1938,16 +1938,16 @@ weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_api_config_get_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_STRING(result);
}
@@ -1960,16 +1960,16 @@ weechat_python_api_config_is_set_plugin (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = script_api_config_is_set_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -1982,18 +1982,18 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
{
char *option, *value;
int rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &value))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = script_api_config_set_plugin (weechat_python_plugin,
python_current_script,
option,
value);
-
+
API_RETURN_INT(rc);
}
@@ -2005,18 +2005,18 @@ static PyObject *
weechat_python_api_config_set_desc_plugin (PyObject *self, PyObject *args)
{
char *option, *description;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
option = NULL;
description = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &description))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_set_desc_plugin (weechat_python_plugin,
python_current_script,
option,
description);
-
+
API_RETURN_OK;
}
@@ -2029,16 +2029,16 @@ weechat_python_api_config_unset_plugin (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = script_api_config_unset_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2053,20 +2053,20 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
struct t_hashtable *hashtable;
PyObject *dict;
int num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
context = NULL;
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (context, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_INT(num_keys);
}
@@ -2079,15 +2079,15 @@ weechat_python_api_key_unbind (PyObject *self, PyObject *args)
{
char *context, *key;
int num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
context = NULL;
key = NULL;
if (!PyArg_ParseTuple (args, "ss", &context, &key))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
num_keys = weechat_key_unbind (context, key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2100,14 +2100,14 @@ weechat_python_api_prefix (PyObject *self, PyObject *args)
{
char *prefix;
const char *result;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
prefix = NULL;
if (!PyArg_ParseTuple (args, "s", &prefix))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_prefix (prefix);
-
+
API_RETURN_STRING(result);
}
@@ -2120,14 +2120,14 @@ weechat_python_api_color (PyObject *self, PyObject *args)
{
char *color;
const char *result;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
color = NULL;
if (!PyArg_ParseTuple (args, "s", &color))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_color (color);
-
+
API_RETURN_STRING(result);
}
@@ -2139,18 +2139,18 @@ static PyObject *
weechat_python_api_prnt (PyObject *self, PyObject *args)
{
char *buffer, *message;
-
+
API_FUNC(0, "prnt", API_RETURN_ERROR);
buffer = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2164,7 +2164,7 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
{
char *buffer, *tags, *message;
int date;
-
+
API_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL;
date = 0;
@@ -2172,14 +2172,14 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
message = NULL;
if (!PyArg_ParseTuple (args, "siss", &buffer, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_date_tags (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
date,
tags,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2192,20 +2192,20 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
{
char *buffer, *message;
int y;
-
+
API_FUNC(1, "prnt_y", API_RETURN_ERROR);
buffer = NULL;
y = 0;
message = NULL;
if (!PyArg_ParseTuple (args, "sis", &buffer, &y, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_y (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
y,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2217,16 +2217,16 @@ static PyObject *
weechat_python_api_log_print (PyObject *self, PyObject *args)
{
char *message;
-
+
API_FUNC(1, "log_print", API_RETURN_ERROR);
message = NULL;
if (!PyArg_ParseTuple (args, "s", &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_log_printf (weechat_python_plugin,
python_current_script,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2245,7 +2245,7 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2253,12 +2253,12 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2268,10 +2268,10 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2285,7 +2285,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
char *command, *description, *arguments, *args_description, *completion;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
command = NULL;
description = NULL;
@@ -2297,7 +2297,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssssss", &command, &description, &arguments,
&args_description, &completion, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_command (weechat_python_plugin,
python_current_script,
command,
@@ -2308,7 +2308,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
&weechat_python_api_hook_command_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2324,20 +2324,20 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2347,10 +2347,10 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2363,21 +2363,21 @@ weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
command = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &command, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_python_plugin,
python_current_script,
command,
&weechat_python_api_hook_command_run_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2392,7 +2392,7 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2402,12 +2402,12 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2415,10 +2415,10 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2432,7 +2432,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
int interval, align_second, max_calls;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
interval = 10;
align_second = 0;
@@ -2442,7 +2442,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "iiiss", &interval, &align_second, &max_calls,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_python_plugin,
python_current_script,
interval,
@@ -2451,7 +2451,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
&weechat_python_api_hook_timer_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2466,21 +2466,21 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2488,10 +2488,10 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2505,7 +2505,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
int fd, read, write, exception;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
fd = 0;
read = 0;
@@ -2516,7 +2516,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "iiiiss", &fd, &read, &write, &exception,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_python_plugin,
python_current_script,
fd,
@@ -2526,7 +2526,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
&weechat_python_api_hook_fd_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2543,24 +2543,24 @@ weechat_python_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2568,10 +2568,10 @@ weechat_python_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2585,7 +2585,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
char *command, *function, *data, *result;
int timeout;
PyObject *return_value;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
command = NULL;
timeout = 0;
@@ -2593,7 +2593,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
data = NULL;
if (!PyArg_ParseTuple (args, "siss", &command, &timeout, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_process (weechat_python_plugin,
python_current_script,
command,
@@ -2601,7 +2601,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
&weechat_python_api_hook_process_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2617,25 +2617,25 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
void *func_argv[5];
char str_status[32], str_gnutls_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2643,10 +2643,10 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2660,7 +2660,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
char *proxy, *address, *local_hostname, *function, *data, *result;
int port, sock, ipv6;
PyObject *return_value;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
proxy = NULL;
address = NULL;
@@ -2673,7 +2673,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssiiisss", &proxy, &address, &port, &sock,
&ipv6, &local_hostname, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_python_plugin,
python_current_script,
proxy,
@@ -2689,7 +2689,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
&weechat_python_api_hook_connect_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2709,16 +2709,16 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -2729,12 +2729,12 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
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);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2750,10 +2750,10 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2767,7 +2767,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
char *buffer, *tags, *message, *function, *data, *result;
int strip_colors;
PyObject *return_value;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
buffer = NULL;
tags = NULL;
@@ -2778,7 +2778,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssiss", &buffer, &tags, &message,
&strip_colors, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_print (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
@@ -2788,7 +2788,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
&weechat_python_api_hook_print_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2805,9 +2805,9 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -2830,12 +2830,12 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2845,10 +2845,10 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2861,21 +2861,21 @@ weechat_python_api_hook_signal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_python_plugin,
python_current_script,
signal,
&weechat_python_api_hook_signal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2888,14 +2888,14 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
{
char *signal, *type_data, *signal_data, *error;
int number;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
signal = NULL;
type_data = NULL;
signal_data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &type_data, &signal_data))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
weechat_hook_signal_send (signal, type_data, signal_data);
@@ -2917,7 +2917,7 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
script_str2ptr (signal_data));
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -2933,20 +2933,20 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssO", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2958,10 +2958,10 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
{
Py_XDECREF((PyObject *)func_argv[2]);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2974,21 +2974,21 @@ weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_python_plugin,
python_current_script,
signal,
&weechat_python_api_hook_hsignal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3002,20 +3002,20 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
char *signal;
struct t_hashtable *hashtable;
PyObject *dict;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
signal = NULL;
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (signal, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_OK;
}
@@ -3030,7 +3030,7 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3038,12 +3038,12 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3051,10 +3051,10 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3067,21 +3067,21 @@ weechat_python_api_hook_config (PyObject *self, PyObject *args)
{
char *option, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
option = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &option, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_config (weechat_python_plugin,
python_current_script,
option,
&weechat_python_api_hook_config_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3098,7 +3098,7 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3107,12 +3107,12 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3124,10 +3124,10 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3140,7 +3140,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
{
char *completion, *description, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
completion = NULL;
description = NULL;
@@ -3149,7 +3149,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssss", &completion, &description, &function,
&data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_python_plugin,
python_current_script,
completion,
@@ -3157,7 +3157,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
&weechat_python_api_hook_completion_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3170,7 +3170,7 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
{
char *completion, *word, *where;
int nick_completion;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
completion = NULL;
word = NULL;
@@ -3179,12 +3179,12 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssis", &completion, &word, &nick_completion,
&where))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion,
where);
-
+
API_RETURN_OK;
}
@@ -3199,22 +3199,22 @@ weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3227,21 +3227,21 @@ weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
{
char *modifier, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
modifier = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &modifier, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_python_plugin,
python_current_script,
modifier,
&weechat_python_api_hook_modifier_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3254,16 +3254,16 @@ weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
{
char *modifier, *modifier_data, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
modifier = NULL;
modifier_data = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "sss", &modifier, &modifier_data, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3278,21 +3278,21 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3305,7 +3305,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
@@ -3315,7 +3315,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssss", &info_name, &description,
&args_description, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info (weechat_python_plugin,
python_current_script,
info_name,
@@ -3324,7 +3324,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
&weechat_python_api_hook_info_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3340,28 +3340,28 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
void *func_argv[3];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
-
+
ret_hashtable = weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssO", func_argv);
-
+
if (func_argv[2])
{
Py_XDECREF((PyObject *)func_argv[2]);
}
-
+
return ret_hashtable;
}
-
+
return NULL;
}
@@ -3375,7 +3375,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
char *info_name, *description, *args_description, *output_description;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
@@ -3387,7 +3387,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
&args_description, &output_description,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_python_plugin,
python_current_script,
info_name,
@@ -3397,7 +3397,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
&weechat_python_api_hook_info_hashtable_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3413,27 +3413,27 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3447,7 +3447,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
infolist_name = NULL;
description = NULL;
@@ -3459,7 +3459,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
&pointer_description, &args_description, &function,
&data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_python_plugin,
python_current_script,
infolist_name,
@@ -3469,7 +3469,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
&weechat_python_api_hook_infolist_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3485,14 +3485,14 @@ weechat_python_api_hook_focus_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = weechat_python_hashtable_to_dict (info);
-
+
ret_hashtable = weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
@@ -3501,10 +3501,10 @@ weechat_python_api_hook_focus_cb (void *data,
{
Py_XDECREF((PyObject *)func_argv[1]);
}
-
+
return ret_hashtable;
}
-
+
return NULL;
}
@@ -3517,21 +3517,21 @@ weechat_python_api_hook_focus (PyObject *self, PyObject *args)
{
char *area, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
area = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &area, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_python_plugin,
python_current_script,
area,
&weechat_python_api_hook_focus_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3543,16 +3543,16 @@ static PyObject *
weechat_python_api_unhook (PyObject *self, PyObject *args)
{
char *hook;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
hook = NULL;
if (!PyArg_ParseTuple (args, "s", &hook))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_unhook (weechat_python_plugin,
python_current_script,
script_str2ptr (hook));
-
+
API_RETURN_OK;
}
@@ -3565,11 +3565,11 @@ weechat_python_api_unhook_all (PyObject *self, PyObject *args)
{
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (python_current_script);
-
+
API_RETURN_OK;
}
@@ -3585,15 +3585,15 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3607,10 +3607,10 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3625,14 +3625,14 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3646,10 +3646,10 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3663,7 +3663,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
char *name, *function_input, *data_input, *function_close, *data_close;
char *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
name = NULL;
function_input = NULL;
@@ -3673,7 +3673,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssss", &name, &function_input, &data_input,
&function_close, &data_close))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_python_plugin,
python_current_script,
name,
@@ -3683,7 +3683,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
&weechat_python_api_buffer_close_cb,
function_close,
data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3697,15 +3697,15 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args)
char *plugin, *name;
char *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
plugin = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &plugin, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search (plugin, name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3718,14 +3718,14 @@ weechat_python_api_buffer_search_main (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3738,14 +3738,14 @@ weechat_python_api_current_buffer (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3757,14 +3757,14 @@ static PyObject *
weechat_python_api_buffer_clear (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_clear (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3776,16 +3776,16 @@ static PyObject *
weechat_python_api_buffer_close (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_buffer_close (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3797,16 +3797,16 @@ static PyObject *
weechat_python_api_buffer_merge (PyObject *self, PyObject *args)
{
char *buffer, *target_buffer;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
buffer = NULL;
target_buffer = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &target_buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
-
+
API_RETURN_OK;
}
@@ -3820,15 +3820,15 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args)
{
char *buffer;
int number;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
buffer = NULL;
number = 0;
if (!PyArg_ParseTuple (args, "si", &buffer, &number))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_unmerge (script_str2ptr (buffer), number);
-
+
API_RETURN_OK;
}
@@ -3841,15 +3841,15 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *property;
int value;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
-
+
API_RETURN_INT(value);
}
@@ -3862,15 +3862,15 @@ weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
{
char *buffer, *property;
const char *result;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
-
+
API_RETURN_STRING(result);
}
@@ -3883,16 +3883,16 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3904,18 +3904,18 @@ static PyObject *
weechat_python_api_buffer_set (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_set (script_str2ptr (buffer),
property,
value);
-
+
API_RETURN_OK;
}
@@ -3929,15 +3929,15 @@ weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *ar
{
char *buffer, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
buffer = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3951,15 +3951,15 @@ weechat_python_api_buffer_match_list (PyObject *self, PyObject *args)
{
char *buffer, *string;
int value;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
buffer = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
-
+
API_RETURN_INT(value);
}
@@ -3972,14 +3972,14 @@ weechat_python_api_current_window (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3993,14 +3993,14 @@ weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args)
{
char *buffer, *result;
PyObject *return_value;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4013,15 +4013,15 @@ weechat_python_api_window_get_integer (PyObject *self, PyObject *args)
{
char *window, *property;
int value;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_window_get_integer (script_str2ptr (window), property);
-
+
API_RETURN_INT(value);
}
@@ -4034,15 +4034,15 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
{
char *window, *property;
const char *result;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_window_get_string (script_str2ptr (window), property);
-
+
API_RETURN_STRING(result);
}
@@ -4055,16 +4055,16 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
{
char *window, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4076,14 +4076,14 @@ static PyObject *
weechat_python_api_window_set_title (PyObject *self, PyObject *args)
{
char *title;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
title = NULL;
if (!PyArg_ParseTuple (args, "s", &title))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_window_set_title (title);
-
+
API_RETURN_OK;
}
@@ -4097,7 +4097,7 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
char *buffer, *parent_group, *name, *color, *result;
int visible;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
buffer = NULL;
parent_group = NULL;
@@ -4107,13 +4107,13 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssssi", &buffer, &parent_group, &name,
&color, &visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
name,
color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4126,18 +4126,18 @@ weechat_python_api_nicklist_search_group (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4151,7 +4151,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
char *buffer, *group, *name, *color, *prefix, *prefix_color, *result;
int visible;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
@@ -4163,7 +4163,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssssssi", &buffer, &group, &name, &color,
&prefix, &prefix_color, &visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
name,
@@ -4171,7 +4171,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix,
prefix_color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4184,18 +4184,18 @@ weechat_python_api_nicklist_search_nick (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4207,16 +4207,16 @@ static PyObject *
weechat_python_api_nicklist_remove_group (PyObject *self, PyObject *args)
{
char *buffer, *group;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &group))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
-
+
API_RETURN_OK;
}
@@ -4228,16 +4228,16 @@ static PyObject *
weechat_python_api_nicklist_remove_nick (PyObject *self, PyObject *args)
{
char *buffer, *nick;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &nick))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
-
+
API_RETURN_OK;
}
@@ -4249,14 +4249,14 @@ static PyObject *
weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_all (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -4269,18 +4269,18 @@ weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property;
int value;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_INT(value);
}
@@ -4293,18 +4293,18 @@ weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args)
{
char *buffer, *group, *property;
const char *result;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4317,18 +4317,18 @@ weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4340,7 +4340,7 @@ static PyObject *
weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *value;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
@@ -4348,12 +4348,12 @@ weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
value = NULL;
if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4366,18 +4366,18 @@ weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property;
int value;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_INT(value);
}
@@ -4390,18 +4390,18 @@ weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property;
const char *result;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4414,18 +4414,18 @@ weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4437,7 +4437,7 @@ static PyObject *
weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *value;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
@@ -4445,12 +4445,12 @@ weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
value = NULL;
if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4463,14 +4463,14 @@ weechat_python_api_bar_item_search (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_item_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4485,7 +4485,7 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4493,20 +4493,20 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4519,21 +4519,21 @@ weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_python_plugin,
python_current_script,
name,
&weechat_python_api_bar_item_build_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4545,14 +4545,14 @@ static PyObject *
weechat_python_api_bar_item_update (PyObject *self, PyObject *args)
{
char *name;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_item_update (name);
-
+
API_RETURN_OK;
}
@@ -4564,16 +4564,16 @@ static PyObject *
weechat_python_api_bar_item_remove (PyObject *self, PyObject *args)
{
char *item;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_bar_item_remove (weechat_python_plugin,
python_current_script,
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -4586,14 +4586,14 @@ weechat_python_api_bar_search (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4608,7 +4608,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
char *filling_top_bottom, *filling_left_right, *size, *size_max;
char *color_fg, *color_delim, *color_bg, *separator, *items, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
name = NULL;
hidden = NULL;
@@ -4630,7 +4630,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
&filling_left_right, &size, &size_max, &color_fg,
&color_delim, &color_bg, &separator, &items))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_new (name,
hidden,
priority,
@@ -4646,7 +4646,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
color_bg,
separator,
items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4658,18 +4658,18 @@ static PyObject *
weechat_python_api_bar_set (PyObject *self, PyObject *args)
{
char *bar, *property, *value;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
bar = NULL;
property = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_set (script_str2ptr (bar),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4681,14 +4681,14 @@ static PyObject *
weechat_python_api_bar_update (PyObject *self, PyObject *args)
{
char *name;
-
+
API_FUNC(1, "bar_item", API_RETURN_ERROR);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_update (name);
-
+
API_RETURN_OK;
}
@@ -4700,14 +4700,14 @@ static PyObject *
weechat_python_api_bar_remove (PyObject *self, PyObject *args)
{
char *bar;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
bar = NULL;
if (!PyArg_ParseTuple (args, "s", &bar))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_remove (script_str2ptr (bar));
-
+
API_RETURN_OK;
}
@@ -4719,18 +4719,18 @@ static PyObject *
weechat_python_api_command (PyObject *self, PyObject *args)
{
char *buffer, *command;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
buffer = NULL;
command = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &command))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_command (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
command);
-
+
API_RETURN_OK;
}
@@ -4743,15 +4743,15 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
{
char *info_name, *arguments;
const char *result;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
info_name = NULL;
arguments = NULL;
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_info_get (info_name, arguments);
-
+
API_RETURN_STRING(result);
}
@@ -4765,14 +4765,14 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
char *info_name;
struct t_hashtable *hashtable, *result_hashtable;
PyObject *dict, *result_dict;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
info_name = NULL;
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (info_name, hashtable);
result_dict = weechat_python_hashtable_to_dict (result_hashtable);
@@ -4780,7 +4780,7 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
weechat_hashtable_free (hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
return result_dict;
}
@@ -4793,13 +4793,13 @@ weechat_python_api_infolist_new (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4812,14 +4812,14 @@ weechat_python_api_infolist_new_item (PyObject *self, PyObject *args)
{
char *infolist, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4834,18 +4834,18 @@ weechat_python_api_infolist_new_var_integer (PyObject *self, PyObject *args)
char *infolist, *name, *result;
int value;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4859,18 +4859,18 @@ weechat_python_api_infolist_new_var_string (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4884,18 +4884,18 @@ weechat_python_api_infolist_new_var_pointer (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4910,18 +4910,18 @@ weechat_python_api_infolist_new_var_time (PyObject *self, PyObject *args)
char *infolist, *name, *result;
int value;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4934,18 +4934,18 @@ weechat_python_api_infolist_get (PyObject *self, PyObject *args)
{
char *name, *pointer, *arguments, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
name = NULL;
pointer = NULL;
arguments = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &pointer, &arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4958,14 +4958,14 @@ weechat_python_api_infolist_next (PyObject *self, PyObject *args)
{
char *infolist;
int value;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_next (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -4978,14 +4978,14 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args)
{
char *infolist;
int value;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_prev (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -4998,14 +4998,14 @@ static PyObject *
weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args)
{
char *infolist;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5018,14 +5018,14 @@ weechat_python_api_infolist_fields (PyObject *self, PyObject *args)
{
char *infolist;
const char *result;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_fields (script_str2ptr (infolist));
-
+
API_RETURN_STRING(result);
}
@@ -5038,16 +5038,16 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args)
{
char *infolist, *variable;
int value;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
-
+
API_RETURN_INT(value);
}
@@ -5060,16 +5060,16 @@ weechat_python_api_infolist_string (PyObject *self, PyObject *args)
{
char *infolist, *variable;
const char *result;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
-
+
API_RETURN_STRING(result);
}
@@ -5082,16 +5082,16 @@ weechat_python_api_infolist_pointer (PyObject *self, PyObject *args)
{
char *infolist, *variable, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5105,18 +5105,18 @@ weechat_python_api_infolist_time (PyObject *self, PyObject *args)
char *infolist, *variable, timebuffer[64], *result;
time_t time;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_infolist_time (script_str2ptr (infolist),
variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5128,14 +5128,14 @@ static PyObject *
weechat_python_api_infolist_free (PyObject *self, PyObject *args)
{
char *infolist;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_free (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5148,14 +5148,14 @@ weechat_python_api_hdata_get (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5168,15 +5168,15 @@ weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args)
{
char *hdata, *name;
int value;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
-
+
API_RETURN_INT(value);
}
@@ -5190,15 +5190,15 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
{
char *hdata, *name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5211,15 +5211,15 @@ weechat_python_api_hdata_get_var_hdata (PyObject *self, PyObject *args)
{
char *hdata, *name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5232,16 +5232,16 @@ weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
{
char *hdata, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5255,18 +5255,18 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args)
char *result, *hdata, *pointer;
int count;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
count = 0;
if (!PyArg_ParseTuple (args, "ssi", &hdata, &pointer, &count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5280,18 +5280,18 @@ weechat_python_api_hdata_integer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
int value;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_INT(value);
}
@@ -5305,18 +5305,18 @@ weechat_python_api_hdata_long (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
long value;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_LONG(value);
}
@@ -5330,18 +5330,18 @@ weechat_python_api_hdata_string (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
const char *result;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_STRING(result);
}
@@ -5355,18 +5355,18 @@ weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5381,20 +5381,20 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
char *hdata, *pointer, *name, timebuffer[64], *result;
time_t time;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5407,15 +5407,15 @@ weechat_python_api_hdata_get_string (PyObject *self, PyObject *args)
{
char *hdata, *property;
const char *result;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
hdata = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
-
+
API_RETURN_STRING(result);
}
@@ -5429,15 +5429,15 @@ weechat_python_api_upgrade_new (PyObject *self, PyObject *args)
char *filename, *result;
int write;
PyObject *return_value;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
filename = NULL;
write = 0;
if (!PyArg_ParseTuple (args, "si", &filename, &write))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_upgrade_new (filename, write));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5450,18 +5450,18 @@ weechat_python_api_upgrade_write_object (PyObject *self, PyObject *args)
{
char *upgrade_file, *infolist;
int object_id, rc;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
upgrade_file = NULL;
object_id = 0;
infolist = NULL;
if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
-
+
API_RETURN_INT(rc);
}
@@ -5479,23 +5479,23 @@ weechat_python_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5507,10 +5507,10 @@ weechat_python_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -5523,21 +5523,21 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
{
char *upgrade_file, *function, *data;
int rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
upgrade_file = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &upgrade_file, &function, &data))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = script_api_upgrade_read (weechat_python_plugin,
python_current_script,
script_str2ptr (upgrade_file),
&weechat_python_api_upgrade_read_cb,
function,
data);
-
+
API_RETURN_INT(rc);
}
@@ -5549,14 +5549,14 @@ static PyObject *
weechat_python_api_upgrade_close (PyObject *self, PyObject *args)
{
char *upgrade_file;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
upgrade_file = NULL;
if (!PyArg_ParseTuple (args, "s", &upgrade_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_upgrade_close (script_str2ptr (upgrade_file));
-
+
API_RETURN_OK;
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index a6fe6f663..612c40f2c 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -83,12 +83,12 @@ weechat_python_set_python2_bin ()
char *versions[] = { "2", "2.7", "2.6", "2.5", "2.4", "2.3", "2.2", NULL };
int num_paths, i, j, rc;
struct stat stat_buf;
-
+
python2_bin = NULL;
-
+
dir_separator = weechat_info_get ("dir_separator", "");
path = getenv ("PATH");
-
+
if (dir_separator && path)
{
paths = weechat_string_split (path, ":", 0, 0, &num_paths);
@@ -114,7 +114,7 @@ weechat_python_set_python2_bin ()
weechat_string_free_split (paths);
}
}
-
+
if (!python2_bin)
python2_bin = strdup ("python");
}
@@ -134,14 +134,14 @@ weechat_python_hashtable_map_cb (void *data,
/* make C compiler happy */
(void) hashtable;
-
+
dict = (PyObject *)data;
-
+
dict_key = Py_BuildValue ("s", (const char *)key);
dict_value = Py_BuildValue ("s", (const char *)value);
-
+
PyDict_SetItem (dict, dict_key, dict_value);
-
+
Py_DECREF (dict_key);
Py_DECREF (dict_value);
}
@@ -155,18 +155,18 @@ PyObject *
weechat_python_hashtable_to_dict (struct t_hashtable *hashtable)
{
PyObject *dict;
-
+
dict = PyDict_New ();
if (!dict)
{
Py_INCREF(Py_None);
return Py_None;
}
-
+
weechat_hashtable_map (hashtable,
&weechat_python_hashtable_map_cb,
dict);
-
+
return dict;
}
@@ -186,7 +186,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
PyObject *key, *value;
Py_ssize_t pos;
char *str_key, *str_value;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -194,7 +194,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
pos = 0;
while (PyDict_Next (dict, &pos, &key, &value))
{
@@ -202,7 +202,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
str_value = PyString_AsString (value);
weechat_hashtable_set (hashtable, str_key, str_value);
}
-
+
return hashtable;
}
@@ -223,9 +223,9 @@ weechat_python_exec (struct t_plugin_script *script,
PyObject *rc;
void *argv2[16], *ret_value;
int i, argc, *ret_int;
-
+
/* PyEval_AcquireLock (); */
-
+
old_python_current_script = python_current_script;
old_interpreter = NULL;
if (script->interpreter)
@@ -233,11 +233,11 @@ weechat_python_exec (struct t_plugin_script *script,
old_interpreter = PyThreadState_Swap (NULL);
PyThreadState_Swap (script->interpreter);
}
-
+
evMain = PyImport_AddModule ((char *) "__main__");
evDict = PyModule_GetDict (evMain);
evFunc = PyDict_GetItemString (evDict, function);
-
+
if ( !(evFunc && PyCallable_Check (evFunc)) )
{
weechat_printf (NULL,
@@ -248,7 +248,7 @@ weechat_python_exec (struct t_plugin_script *script,
PyThreadState_Swap (old_interpreter);
return NULL;
}
-
+
python_current_script = script;
if (argv && argv[0])
@@ -272,16 +272,16 @@ weechat_python_exec (struct t_plugin_script *script,
{
rc = PyObject_CallFunction (evFunc, NULL);
}
-
+
ret_value = NULL;
-
+
/*
* ugly hack : rc = NULL while 'return weechat.WEECHAT_RC_OK ....
* because of '#define WEECHAT_RC_OK 0'
*/
if (rc == NULL)
rc = PyInt_FromLong (0);
-
+
if (PyErr_Occurred())
{
PyErr_Print ();
@@ -316,21 +316,21 @@ weechat_python_exec (struct t_plugin_script *script,
"a valid value"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
}
-
+
if (ret_value == NULL)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: error in function \"%s\""),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
}
-
+
/* PyEval_ReleaseThread (python_current_script->interpreter); */
-
+
python_current_script = old_python_current_script;
-
+
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
-
+
return ret_value;
}
@@ -342,10 +342,10 @@ static PyObject *
weechat_python_output (PyObject *self, PyObject *args)
{
char *msg, *m, *p;
-
+
/* make C compiler happy */
(void) self;
-
+
msg = NULL;
if (!PyArg_ParseTuple (args, "s", &msg))
@@ -385,7 +385,7 @@ weechat_python_output (PyObject *self, PyObject *args)
else
strcat (python_buffer_output, m);
}
-
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -415,7 +415,7 @@ weechat_python_load (const char *filename)
const char *weechat_home;
char *p_home;
int len;
-
+
if ((fp = fopen (filename, "r")) == NULL)
{
weechat_printf (NULL,
@@ -423,21 +423,21 @@ weechat_python_load (const char *filename)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PYTHON_PLUGIN_NAME, filename);
}
-
+
python_current_script = NULL;
python_registered_script = NULL;
-
+
/* PyEval_AcquireLock (); */
python_current_interpreter = Py_NewInterpreter ();
PySys_SetArgv(1, argv);
-
+
if (python_current_interpreter == NULL)
{
weechat_printf (NULL,
@@ -448,9 +448,9 @@ weechat_python_load (const char *filename)
/* PyEval_ReleaseLock (); */
return 0;
}
-
+
PyThreadState_Swap (python_current_interpreter);
-
+
weechat_module = Py_InitModule ("weechat", weechat_python_funcs);
if ( weechat_module == NULL)
@@ -460,7 +460,7 @@ weechat_python_load (const char *filename)
"module"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
fclose (fp);
-
+
Py_EndInterpreter (python_current_interpreter);
/* PyEval_ReleaseLock (); */
@@ -486,13 +486,13 @@ weechat_python_load (const char *filename)
free (p_home);
}
}
-
+
/* define some constants */
weechat_dict = PyModule_GetDict(weechat_module);
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK", PyInt_FromLong((long) WEECHAT_RC_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_EAT", PyInt_FromLong((long) WEECHAT_RC_OK_EAT));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_ERROR", PyInt_FromLong((long) WEECHAT_RC_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_OK", PyInt_FromLong((long) WEECHAT_CONFIG_READ_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_MEMORY_ERROR", PyInt_FromLong((long) WEECHAT_CONFIG_READ_MEMORY_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", PyInt_FromLong((long) WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
@@ -507,19 +507,19 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_ERROR", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_SORT", PyString_FromString(WEECHAT_LIST_POS_SORT));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_BEGINNING", PyString_FromString(WEECHAT_LIST_POS_BEGINNING));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_END", PyString_FromString(WEECHAT_LIST_POS_END));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_LOW", PyString_FromString(WEECHAT_HOTLIST_LOW));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_MESSAGE", PyString_FromString(WEECHAT_HOTLIST_MESSAGE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_PRIVATE", PyString_FromString(WEECHAT_HOTLIST_PRIVATE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_HIGHLIGHT", PyString_FromString(WEECHAT_HOTLIST_HIGHLIGHT));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_PROCESS_RUNNING", PyInt_FromLong((long) WEECHAT_HOOK_PROCESS_RUNNING));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_PROCESS_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_PROCESS_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_OK", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
@@ -529,11 +529,11 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_STRING", PyString_FromString(WEECHAT_HOOK_SIGNAL_STRING));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyString_FromString(WEECHAT_HOOK_SIGNAL_INT));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_POINTER", PyString_FromString(WEECHAT_HOOK_SIGNAL_POINTER));
-
+
weechat_outputs = Py_InitModule("weechatOutputs",
weechat_python_output_funcs);
if (weechat_outputs == NULL)
@@ -558,9 +558,9 @@ weechat_python_load (const char *filename)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
}
-
+
python_current_script_filename = filename;
-
+
if (PyRun_SimpleFile (fp, filename) != 0)
{
weechat_printf (NULL,
@@ -570,7 +570,7 @@ weechat_python_load (const char *filename)
if (PyErr_Occurred ())
PyErr_Print ();
-
+
/* if script was registered, removing from list */
if (python_current_script != NULL)
{
@@ -578,10 +578,10 @@ weechat_python_load (const char *filename)
&python_scripts, &last_python_script,
python_current_script);
}
-
+
Py_EndInterpreter (python_current_interpreter);
/* PyEval_ReleaseLock (); */
-
+
return 0;
}
@@ -589,14 +589,14 @@ weechat_python_load (const char *filename)
PyErr_Print ();
fclose (fp);
-
+
if (!python_registered_script)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
"found (or failed) in file \"%s\""),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
-
+
if (PyErr_Occurred ())
PyErr_Print ();
Py_EndInterpreter (python_current_interpreter);
@@ -605,10 +605,10 @@ weechat_python_load (const char *filename)
return 0;
}
python_current_script = python_registered_script;
-
+
python_current_script->interpreter = (PyThreadState *) python_current_interpreter;
/* PyEval_ReleaseThread (python_current_script->interpreter); */
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -618,7 +618,7 @@ weechat_python_load (const char *filename)
python_current_script,
&weechat_python_api_buffer_input_data_cb,
&weechat_python_api_buffer_close_cb);
-
+
return 1;
}
@@ -631,7 +631,7 @@ weechat_python_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_python_load (filename);
}
@@ -645,14 +645,14 @@ weechat_python_unload (struct t_plugin_script *script)
int *rc;
void *interpreter;
PyThreadState *old_interpreter;
-
+
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
PYTHON_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT,
@@ -660,20 +660,20 @@ weechat_python_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
old_interpreter = PyThreadState_Swap (NULL);
interpreter = script->interpreter;
-
+
if (python_current_script == script)
python_current_script = (python_current_script->prev_script) ?
python_current_script->prev_script : python_current_script->next_script;
-
+
script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
script);
-
+
PyThreadState_Swap (interpreter);
Py_EndInterpreter (interpreter);
-
+
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
}
@@ -686,7 +686,7 @@ void
weechat_python_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_python_plugin, python_scripts, name);
if (ptr_script)
{
@@ -725,7 +725,7 @@ weechat_python_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_python_plugin, python_scripts, name);
if (ptr_script)
{
@@ -757,7 +757,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
@@ -833,7 +833,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
"python");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -850,9 +850,9 @@ weechat_python_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_python_plugin, completion, python_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -867,12 +867,12 @@ weechat_python_info_cb (void *data, const char *info_name,
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (weechat_strcasecmp (info_name, "python2_bin") == 0)
{
return python2_bin;
}
-
+
return NULL;
}
@@ -886,17 +886,17 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "python_script") == 0)
{
return script_infolist_list_scripts (weechat_python_plugin,
python_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -913,13 +913,13 @@ weechat_python_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, PYTHON_PLUGIN_NAME) == 0))
{
script_print_log (weechat_python_plugin, python_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -937,10 +937,10 @@ weechat_python_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (python_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -972,7 +972,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
&python_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -988,7 +988,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "python_script_install") == 0)
@@ -1008,7 +1008,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
&python_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1020,7 +1020,7 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_python_plugin = plugin;
-
+
/*
* hook info to get path to python 2.x interpreter
* (some scripts using hook_process need that)
@@ -1030,10 +1030,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
N_("path to python 2.x interpreter"),
NULL,
&weechat_python_info_cb, NULL);
-
+
/* init stdout/stderr buffer */
python_buffer_output[0] = '\0';
-
+
Py_Initialize ();
if (Py_IsInitialized () == 0)
{
@@ -1043,7 +1043,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
-
+
PyEval_InitThreads();
/* python_mainThreadState = PyThreadState_Swap(NULL); */
python_mainThreadState = PyEval_SaveThread();
@@ -1070,10 +1070,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_python_signal_script_action_cb,
&weechat_python_load_cb);
python_quiet = 0;
-
+
script_display_short_list (weechat_python_plugin,
python_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -1089,7 +1089,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
python_quiet = 1;
script_end (plugin, &python_scripts, &weechat_python_unload_all);
python_quiet = 0;
-
+
/* free Python interpreter */
if (python_mainThreadState != NULL)
{
@@ -1098,7 +1098,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* PyEval_ReleaseLock (); */
python_mainThreadState = NULL;
}
-
+
Py_Finalize ();
if (Py_IsInitialized () != 0)
{
@@ -1106,7 +1106,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
weechat_gettext ("%s%s: unable to free interpreter"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
-
+
/* free some data */
if (python2_bin)
free (python2_bin);
@@ -1114,6 +1114,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
free (python_action_install_list);
if (python_action_remove_list)
free (python_action_remove_list);
-
+
return WEECHAT_RC_OK;
}