summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python/weechat-python-api.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-26 18:51:16 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-26 18:51:16 +0200
commitd95aef21346b04c1fc17d52b96d0dfaa0cf3d43c (patch)
tree9b1ede10258e6a196ad6b699415ca09c42d68670 /src/plugins/scripts/python/weechat-python-api.c
parentb3ac47bcf1bd096c1b9484bd8dbe19e6eaf015aa (diff)
downloadweechat-d95aef21346b04c1fc17d52b96d0dfaa0cf3d43c.zip
script plugins: use new macros to reduce code length
Diffstat (limited to 'src/plugins/scripts/python/weechat-python-api.c')
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c3759
1 files changed, 861 insertions, 2898 deletions
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 9401eff2e..78c308605 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -34,27 +34,43 @@
#include "weechat-python.h"
-#define PYTHON_RETURN_OK return Py_BuildValue ("i", 1);
-#define PYTHON_RETURN_ERROR return Py_BuildValue ("i", 0);
-#define PYTHON_RETURN_EMPTY \
- Py_INCREF(Py_None); \
+#define API_FUNC(__init, __name, __ret) \
+ char *python_function_name = __name; \
+ (void) self; \
+ if (__init \
+ && (!python_current_script || !python_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, \
+ python_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, \
+ python_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK return Py_BuildValue ("i", 1);
+#define API_RETURN_ERROR return Py_BuildValue ("i", 0);
+#define API_RETURN_EMPTY \
+ Py_INCREF (Py_None); \
return Py_None;
-#define PYTHON_RETURN_STRING(__string) \
+#define API_RETURN_STRING(__string) \
if (__string) \
return Py_BuildValue ("s", __string); \
return Py_BuildValue ("s", "")
-#define PYTHON_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
- object = Py_BuildValue ("s", __string); \
+ return_value = Py_BuildValue ("s", __string); \
free (__string); \
- return object; \
+ return return_value; \
} \
return Py_BuildValue ("s", "")
-#define PYTHON_RETURN_INT(__int) \
- return Py_BuildValue("i", __int);
-#define PYTHON_RETURN_LONG(__long) \
- return Py_BuildValue("l", __long);
+#define API_RETURN_INT(__int) \
+ return Py_BuildValue ("i", __int);
+#define API_RETURN_LONG(__long) \
+ return Py_BuildValue ("l", __long);
/*
@@ -67,12 +83,9 @@ weechat_python_api_register (PyObject *self, PyObject *args)
char *name, *author, *version, *license, *shutdown_func, *description;
char *charset;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "register", API_RETURN_ERROR);
python_current_script = NULL;
python_registered_script = NULL;
-
name = NULL;
author = NULL;
version = NULL;
@@ -80,13 +93,9 @@ weechat_python_api_register (PyObject *self, PyObject *args)
description = NULL;
shutdown_func = NULL;
charset = NULL;
-
if (!PyArg_ParseTuple (args, "sssssss", &name, &author, &version,
&license, &description, &shutdown_func, &charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(python_current_script_filename, "register");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (script_search (weechat_python_plugin, python_scripts, name))
{
@@ -96,7 +105,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -119,10 +128,10 @@ weechat_python_api_register (PyObject *self, PyObject *args)
}
else
{
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -136,26 +145,14 @@ weechat_python_api_plugin_get_name (PyObject *self, PyObject *args)
char *plugin;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
plugin = NULL;
-
if (!PyArg_ParseTuple (args, "s", &plugin))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_plugin_get_name (script_str2ptr (plugin));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -167,27 +164,15 @@ weechat_python_api_charset_set (PyObject *self, PyObject *args)
{
char *charset;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "charset_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
charset = NULL;
-
if (!PyArg_ParseTuple (args, "s", &charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "charset_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_charset_set (python_current_script,
charset);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -198,29 +183,17 @@ static PyObject *
weechat_python_api_iconv_to_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_iconv_to_internal (charset, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -232,29 +205,17 @@ static PyObject *
weechat_python_api_iconv_from_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_iconv_from_internal (charset, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -267,26 +228,14 @@ weechat_python_api_gettext (PyObject *self, PyObject *args)
char *string;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "gettext");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "gettext");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_gettext (string);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -300,28 +249,16 @@ weechat_python_api_ngettext (PyObject *self, PyObject *args)
const char *result;
int count;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "ngettext");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
single = NULL;
plural = NULL;
count = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &single, &plural, &count))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "ngettext");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_ngettext (single, plural, count);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -336,28 +273,16 @@ weechat_python_api_string_match (PyObject *self, PyObject *args)
char *string, *mask;
int case_sensitive, value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_match");
- PYTHON_RETURN_INT(0);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_match");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_match (string, mask, case_sensitive);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -374,27 +299,15 @@ weechat_python_api_string_has_highlight (PyObject *self, PyObject *args)
char *string, *highlight_words;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
string = NULL;
highlight_words = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &highlight_words))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight (string, highlight_words);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -411,27 +324,15 @@ weechat_python_api_string_has_highlight_regex (PyObject *self, PyObject *args)
char *string, *regex;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
string = NULL;
regex = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &regex))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight_regex (string, regex);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -445,28 +346,16 @@ static PyObject *
weechat_python_api_string_mask_to_regex (PyObject *self, PyObject *args)
{
char *mask, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
mask = NULL;
-
if (!PyArg_ParseTuple (args, "s", &mask))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_mask_to_regex (mask);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -478,29 +367,17 @@ static PyObject *
weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
{
char *string, *replacement, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_remove_color");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
string = NULL;
replacement = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_remove_color");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_remove_color (string, replacement);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -514,26 +391,14 @@ weechat_python_api_string_is_command_char (PyObject *self, PyObject *args)
char *string;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_is_command_char (string);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -548,26 +413,14 @@ weechat_python_api_string_input_for_buffer (PyObject *self, PyObject *args)
char *string;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_input_for_buffer (string);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -580,28 +433,16 @@ weechat_python_api_mkdir_home (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_home");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_home");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_home (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -614,28 +455,16 @@ weechat_python_api_mkdir (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -649,28 +478,16 @@ weechat_python_api_mkdir_parents (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_parents (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -681,21 +498,16 @@ static PyObject *
weechat_python_api_list_new (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -706,34 +518,22 @@ static PyObject *
weechat_python_api_list_add (PyObject *self, PyObject *args)
{
char *weelist, *data, *where, *user_data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_add");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
where = NULL;
user_data = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_add");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -744,30 +544,18 @@ static PyObject *
weechat_python_api_list_search (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -780,27 +568,15 @@ weechat_python_api_list_search_pos (PyObject *self, PyObject *args)
char *weelist, *data;
int pos;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_search_pos");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_search_pos");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
- PYTHON_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -811,30 +587,18 @@ static PyObject *
weechat_python_api_list_casesearch (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -848,27 +612,15 @@ weechat_python_api_list_casesearch_pos (PyObject *self, PyObject *args)
char *weelist, *data;
int pos;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
- PYTHON_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -880,29 +632,17 @@ weechat_python_api_list_get (PyObject *self, PyObject *args)
{
char *weelist, *result;
int position;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
weelist = NULL;
position = 0;
-
if (!PyArg_ParseTuple (args, "si", &weelist, &position))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -914,28 +654,16 @@ weechat_python_api_list_set (PyObject *self, PyObject *args)
{
char *item, *new_value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
item = NULL;
new_value = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &item, &new_value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_set (script_str2ptr (item),
new_value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -946,28 +674,16 @@ static PyObject *
weechat_python_api_list_next (PyObject *self, PyObject *args)
{
char *item, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_next");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_next");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -978,28 +694,16 @@ static PyObject *
weechat_python_api_list_prev (PyObject *self, PyObject *args)
{
char *item, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_prev");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_prev");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1012,26 +716,14 @@ weechat_python_api_list_string (PyObject *self, PyObject *args)
char *item;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_list_string (script_str2ptr (item));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1044,26 +736,14 @@ weechat_python_api_list_size (PyObject *self, PyObject *args)
char *weelist;
int size;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_size");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_size");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
size = weechat_list_size (script_str2ptr (weelist));
- PYTHON_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1075,28 +755,16 @@ weechat_python_api_list_remove (PyObject *self, PyObject *args)
{
char *weelist, *item;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
weelist = NULL;
item = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1108,26 +776,14 @@ weechat_python_api_list_remove_all (PyObject *self, PyObject *args)
{
char *weelist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_remove_all");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_remove_all");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove_all (script_str2ptr (weelist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1139,26 +795,14 @@ weechat_python_api_list_free (PyObject *self, PyObject *args)
{
char *weelist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_free (script_str2ptr (weelist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1170,7 +814,7 @@ weechat_python_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1178,13 +822,13 @@ weechat_python_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
+ 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", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1193,8 +837,8 @@ weechat_python_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1210,26 +854,14 @@ static PyObject *
weechat_python_api_config_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new (weechat_python_plugin,
python_current_script,
@@ -1238,7 +870,7 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1252,7 +884,7 @@ weechat_python_api_config_read_cb (void *data,
const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1260,16 +892,16 @@ weechat_python_api_config_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- python_argv[4] = (value) ? (char *)value : empty_arg;
+ 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] = (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", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1278,10 +910,10 @@ weechat_python_api_config_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1299,7 +931,7 @@ weechat_python_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1307,14 +939,14 @@ weechat_python_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1323,8 +955,8 @@ weechat_python_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1343,7 +975,7 @@ weechat_python_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1351,14 +983,14 @@ weechat_python_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1367,8 +999,8 @@ weechat_python_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1388,7 +1020,7 @@ weechat_python_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1396,16 +1028,16 @@ weechat_python_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- python_argv[4] = (value) ? (char *)value : empty_arg;
+ 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] = (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", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1414,10 +1046,10 @@ weechat_python_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1436,7 +1068,7 @@ weechat_python_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1444,15 +1076,15 @@ weechat_python_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = script_ptr2str (option);
+ 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", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1461,12 +1093,12 @@ weechat_python_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1486,17 +1118,9 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
char *function_create_option, *data_create_option, *function_delete_option;
char *data_delete_option, *result;
int user_can_add_options, user_can_delete_options;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new_section");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
config_file = NULL;
name = NULL;
user_can_add_options = 0;
@@ -1511,7 +1135,6 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
data_create_option = NULL;
function_delete_option = NULL;
data_delete_option = NULL;
-
if (!PyArg_ParseTuple (args, "ssiissssssssss", &config_file, &name,
&user_can_add_options, &user_can_delete_options,
&function_read, &data_read, &function_write,
@@ -1519,10 +1142,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&data_write_default, &function_create_option,
&data_create_option, &function_delete_option,
&data_delete_option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new_section");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new_section (weechat_python_plugin,
python_current_script,
@@ -1546,7 +1166,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
function_delete_option,
data_delete_option));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1557,30 +1177,18 @@ static PyObject *
weechat_python_api_config_search_section (PyObject *self, PyObject *args)
{
char *config_file, *section_name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_search_section");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_search_section");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1594,7 +1202,7 @@ weechat_python_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1602,14 +1210,14 @@ weechat_python_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
- python_argv[2] = (value) ? (char *)value : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1618,8 +1226,8 @@ weechat_python_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1636,7 +1244,7 @@ weechat_python_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1644,16 +1252,16 @@ weechat_python_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
+ 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", python_argv);
+ "ss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1669,7 +1277,7 @@ weechat_python_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1677,16 +1285,16 @@ weechat_python_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
+ 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", python_argv);
+ "ss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1705,17 +1313,9 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
char *function_check_value, *data_check_value, *function_change;
char *data_change, *function_delete, *data_delete;
int min, max, null_value_allowed;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new_option");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
name = NULL;
@@ -1730,17 +1330,13 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
data_change = NULL;
function_delete = NULL;
data_delete = NULL;
-
if (!PyArg_ParseTuple (args, "ssssssiississssss", &config_file, &section, &name,
&type, &description, &string_values, &min, &max,
&default_value, &value, &null_value_allowed,
&function_check_value, &data_check_value,
&function_change, &data_change, &function_delete,
&data_delete))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new_option");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new_option (weechat_python_plugin,
python_current_script,
@@ -1765,7 +1361,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
function_delete,
data_delete));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1776,32 +1372,20 @@ static PyObject *
weechat_python_api_config_search_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *option_name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_search_option");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_search_option");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1814,26 +1398,14 @@ weechat_python_api_config_string_to_boolean (PyObject *self, PyObject *args)
char *text;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
text = NULL;
-
if (!PyArg_ParseTuple (args, "s", &text))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_string_to_boolean (text);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1846,28 +1418,16 @@ weechat_python_api_config_option_reset (PyObject *self, PyObject *args)
char *option;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_reset");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
option = NULL;
run_callback = 0;
-
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_reset");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1880,30 +1440,18 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
char *option, *new_value;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1917,28 +1465,16 @@ weechat_python_api_config_option_set_null (PyObject *self, PyObject *args)
char *option;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1951,26 +1487,14 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_unset");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_unset");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
rc = weechat_config_option_unset (script_str2ptr (option));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1982,28 +1506,16 @@ weechat_python_api_config_option_rename (PyObject *self, PyObject *args)
{
char *option, *new_name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_rename");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
option = NULL;
new_name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &option, &new_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_rename");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_option_rename (script_str2ptr (option),
new_name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2016,26 +1528,14 @@ weechat_python_api_config_option_is_null (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PYTHON_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PYTHON_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_is_null (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2049,26 +1549,14 @@ weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PYTHON_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PYTHON_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_default_is_null (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2081,26 +1569,14 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2113,26 +1589,14 @@ weechat_python_api_config_boolean_default (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean_default (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2145,26 +1609,14 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2177,26 +1629,14 @@ weechat_python_api_config_integer_default (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_integer_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_integer_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer_default (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2209,26 +1649,14 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2241,26 +1669,14 @@ weechat_python_api_config_string_default (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string_default");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string_default");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string_default (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2273,26 +1689,14 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_color");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_color");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2305,26 +1709,14 @@ weechat_python_api_config_color_default (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_color_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_color_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color_default (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2336,28 +1728,16 @@ weechat_python_api_config_write_option (PyObject *self, PyObject *args)
{
char *config_file, *option;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write_option");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
config_file = NULL;
option = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &config_file, &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write_option");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2369,31 +1749,19 @@ weechat_python_api_config_write_line (PyObject *self, PyObject *args)
{
char *config_file, *option_name, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write_line");
- PYTHON_RETURN_ERROR;
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write_line");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_write_line (script_str2ptr (config_file),
option_name,
"%s",
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2406,26 +1774,14 @@ weechat_python_api_config_write (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_write (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2438,26 +1794,14 @@ weechat_python_api_config_read (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_read");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_read");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_read (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2470,26 +1814,14 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_reload");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_reload");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_reload (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2501,28 +1833,16 @@ weechat_python_api_config_option_free (PyObject *self, PyObject *args)
{
char *option;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_option_free (weechat_python_plugin,
python_current_script,
script_str2ptr (option));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2535,28 +1855,16 @@ weechat_python_api_config_section_free_options (PyObject *self, PyObject *args)
{
char *section;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
section = NULL;
-
if (!PyArg_ParseTuple (args, "s", &section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free_options (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2568,28 +1876,16 @@ weechat_python_api_config_section_free (PyObject *self, PyObject *args)
{
char *section;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
section = NULL;
-
if (!PyArg_ParseTuple (args, "s", &section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2601,28 +1897,16 @@ weechat_python_api_config_free (PyObject *self, PyObject *args)
{
char *config_file;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_free (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2633,28 +1917,16 @@ static PyObject *
weechat_python_api_config_get (PyObject *self, PyObject *args)
{
char *option, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_get (option));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2667,28 +1939,16 @@ weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_api_config_get_plugin (weechat_python_plugin,
python_current_script,
option);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2701,28 +1961,16 @@ weechat_python_api_config_is_set_plugin (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ 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);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2735,30 +1983,18 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
char *option, *value;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ 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);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2770,30 +2006,18 @@ weechat_python_api_config_set_desc_plugin (PyObject *self, PyObject *args)
{
char *option, *description;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
option = NULL;
description = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &option, &description))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_set_desc_plugin (weechat_python_plugin,
python_current_script,
option,
description);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2806,28 +2030,16 @@ weechat_python_api_config_unset_plugin (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
rc = script_api_config_unset_plugin (weechat_python_plugin,
python_current_script,
option);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2842,22 +2054,10 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
PyObject *dict;
int num_keys;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
context = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -2867,7 +2067,7 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
if (hashtable)
weechat_hashtable_free (hashtable);
- PYTHON_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2880,27 +2080,15 @@ weechat_python_api_key_unbind (PyObject *self, PyObject *args)
char *context, *key;
int num_keys;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
context = NULL;
key = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &context, &key))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
num_keys = weechat_key_unbind (context, key);
- PYTHON_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2913,20 +2101,14 @@ weechat_python_api_prefix (PyObject *self, PyObject *args)
char *prefix;
const char *result;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
prefix = NULL;
-
if (!PyArg_ParseTuple (args, "s", &prefix))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prefix");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_prefix (prefix);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2939,20 +2121,14 @@ weechat_python_api_color (PyObject *self, PyObject *args)
char *color;
const char *result;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "color", API_RETURN_EMPTY);
color = NULL;
-
if (!PyArg_ParseTuple (args, "s", &color))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "color");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_color (color);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2964,24 +2140,18 @@ weechat_python_api_prnt (PyObject *self, PyObject *args)
{
char *buffer, *message;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "prnt", API_RETURN_ERROR);
buffer = NULL;
message = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2995,25 +2165,13 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
char *buffer, *tags, *message;
int date;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "prnt_date_tags");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL;
date = 0;
tags = NULL;
message = NULL;
-
if (!PyArg_ParseTuple (args, "siss", &buffer, &date, &tags, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt_date_tags");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf_date_tags (weechat_python_plugin,
python_current_script,
@@ -3022,7 +2180,7 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
tags,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3035,24 +2193,12 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
char *buffer, *message;
int y;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "prnt_y");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "prnt_y", API_RETURN_ERROR);
buffer = NULL;
y = 0;
message = NULL;
-
if (!PyArg_ParseTuple (args, "sis", &buffer, &y, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt_y");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf_y (weechat_python_plugin,
python_current_script,
@@ -3060,7 +2206,7 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
y,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3072,28 +2218,16 @@ weechat_python_api_log_print (PyObject *self, PyObject *args)
{
char *message;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "log_print");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
message = NULL;
-
if (!PyArg_ParseTuple (args, "s", &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "log_print");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_log_printf (weechat_python_plugin,
python_current_script,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3105,7 +2239,7 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3116,14 +2250,14 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3132,8 +2266,8 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3150,17 +2284,9 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
{
char *command, *description, *arguments, *args_description, *completion;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_command");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
command = NULL;
description = NULL;
arguments = NULL;
@@ -3168,13 +2294,9 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
completion = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sssssss", &command, &description, &arguments,
&args_description, &completion, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_command");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_command (weechat_python_plugin,
python_current_script,
@@ -3187,7 +2309,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3199,7 +2321,7 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3207,14 +2329,14 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (command) ? (char *)command : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3223,8 +2345,8 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3240,26 +2362,14 @@ static PyObject *
weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_command_run");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_command_run");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_command_run (weechat_python_plugin,
python_current_script,
@@ -3268,7 +2378,7 @@ weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3279,7 +2389,7 @@ int
weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3290,13 +2400,13 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_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", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3321,29 +2431,17 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
{
int interval, align_second, max_calls;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_timer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
interval = 10;
align_second = 0;
max_calls = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "iiiss", &interval, &align_second, &max_calls,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_timer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_timer (weechat_python_plugin,
python_current_script,
@@ -3354,7 +2452,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3365,7 +2463,7 @@ int
weechat_python_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3375,13 +2473,13 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_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", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3406,30 +2504,18 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
{
int fd, read, write, exception;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_fd");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
fd = 0;
read = 0;
write = 0;
exception = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "iiiiss", &fd, &read, &write, &exception,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_fd");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_fd (weechat_python_plugin,
python_current_script,
@@ -3441,7 +2527,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3454,7 +2540,7 @@ weechat_python_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3464,16 +2550,16 @@ weechat_python_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (command) ? (char *)command : empty_arg;
- python_argv[2] = str_rc;
- python_argv[3] = (out) ? (char *)out : empty_arg;
- python_argv[4] = (err) ? (char *)err : empty_arg;
+ 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", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3498,27 +2584,15 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
int timeout;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_process");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
command = NULL;
timeout = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "siss", &command, &timeout, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_process");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_process (weechat_python_plugin,
python_current_script,
@@ -3528,7 +2602,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3540,7 +2614,7 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3551,16 +2625,16 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_status;
- python_argv[2] = str_gnutls_rc;
- python_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- python_argv[4] = (error) ? (char *)error : empty_arg;
+ 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", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3585,17 +2659,9 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
{
char *proxy, *address, *local_hostname, *function, *data, *result;
int port, sock, ipv6;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_connect");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
proxy = NULL;
address = NULL;
port = 0;
@@ -3604,13 +2670,9 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
local_hostname = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssiiisss", &proxy, &address, &port, &sock,
&ipv6, &local_hostname, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_connect");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_connect (weechat_python_plugin,
python_current_script,
@@ -3628,7 +2690,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3643,7 +2705,7 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *python_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3657,21 +2719,21 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = timebuffer;
- python_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!python_argv[3])
- python_argv[3] = strdup ("");
- python_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- python_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- python_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- python_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[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", python_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3680,14 +2742,14 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[3])
- free (python_argv[3]);
- if (python_argv[4])
- free (python_argv[4]);
- if (python_argv[5])
- free (python_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -3704,30 +2766,18 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
{
char *buffer, *tags, *message, *function, *data, *result;
int strip_colors;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_print");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
buffer = NULL;
tags = NULL;
message = NULL;
strip_colors = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sssiss", &buffer, &tags, &message,
&strip_colors, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_print");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_print (weechat_python_plugin,
python_current_script,
@@ -3739,7 +2789,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3751,7 +2801,7 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
void *signal_data)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -3760,31 +2810,31 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- python_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- python_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- python_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- python_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3793,8 +2843,8 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
ret = *rc;
free (rc);
}
- if (free_needed && python_argv[2])
- free (python_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -3810,26 +2860,14 @@ static PyObject *
weechat_python_api_hook_signal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_signal (weechat_python_plugin,
python_current_script,
@@ -3838,7 +2876,7 @@ weechat_python_api_hook_signal (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3851,29 +2889,17 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
char *signal, *type_data, *signal_data, *error;
int number;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PYTHON_RETURN_ERROR;
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
weechat_hook_signal_send (signal, type_data, signal_data);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
@@ -3883,16 +2909,16 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
{
weechat_hook_signal_send (signal, type_data, &number);
}
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
weechat_hook_signal_send (signal, type_data,
script_str2ptr (signal_data));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -3904,7 +2930,7 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3912,14 +2938,14 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (signal) ? (char *)signal : empty_arg;
- python_argv[2] = weechat_python_hashtable_to_dict (hashtable);
+ 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", python_argv);
+ "ssO", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3928,9 +2954,9 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
- if (python_argv[2])
+ if (func_argv[2])
{
- Py_XDECREF((PyObject *)python_argv[2]);
+ Py_XDECREF((PyObject *)func_argv[2]);
}
return ret;
@@ -3947,26 +2973,14 @@ static PyObject *
weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_hsignal (weechat_python_plugin,
python_current_script,
@@ -3975,7 +2989,7 @@ weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3989,22 +3003,10 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
struct t_hashtable *hashtable;
PyObject *dict;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
signal = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -4014,7 +3016,7 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
if (hashtable)
weechat_hashtable_free (hashtable);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4025,7 +3027,7 @@ int
weechat_python_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4033,14 +3035,14 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (option) ? (char *)option : empty_arg;
- python_argv[2] = (value) ? (char *)value : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4064,26 +3066,14 @@ static PyObject *
weechat_python_api_hook_config (PyObject *self, PyObject *args)
{
char *option, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_config");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_config");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_config (weechat_python_plugin,
python_current_script,
@@ -4092,7 +3082,7 @@ weechat_python_api_hook_config (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4105,7 +3095,7 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4113,15 +3103,15 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- python_argv[2] = script_ptr2str (buffer);
- python_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ 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", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4130,10 +3120,10 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (python_argv[2])
- free (python_argv[2]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -4149,28 +3139,16 @@ static PyObject *
weechat_python_api_hook_completion (PyObject *self, PyObject *args)
{
char *completion, *description, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
completion = NULL;
description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &completion, &description, &function,
&data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_completion (weechat_python_plugin,
python_current_script,
@@ -4180,7 +3158,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4193,33 +3171,21 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
char *completion, *word, *where;
int nick_completion;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
completion = NULL;
word = NULL;
nick_completion = 0;
where = NULL;
-
if (!PyArg_ParseTuple (args, "ssis", &completion, &word, &nick_completion,
&where))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion,
where);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4231,22 +3197,22 @@ weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ 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])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- python_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- python_argv[3] = (string) ? (char *)string : empty_arg;
+ 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", python_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4260,26 +3226,14 @@ static PyObject *
weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
{
char *modifier, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_modifier (weechat_python_plugin,
python_current_script,
@@ -4288,7 +3242,7 @@ weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4299,30 +3253,18 @@ static PyObject *
weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
{
char *modifier, *modifier_data, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4334,21 +3276,21 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ 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])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- python_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ 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", python_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4362,29 +3304,17 @@ static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_info");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sssss", &info_name, &description,
&args_description, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_info");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_info (weechat_python_plugin,
python_current_script,
@@ -4395,7 +3325,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4407,7 +3337,7 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
@@ -4415,18 +3345,18 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- python_argv[2] = weechat_python_hashtable_to_dict (hashtable);
+ 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", python_argv);
+ "ssO", func_argv);
- if (python_argv[2])
+ if (func_argv[2])
{
- Py_XDECREF((PyObject *)python_argv[2]);
+ Py_XDECREF((PyObject *)func_argv[2]);
}
return ret_hashtable;
@@ -4444,31 +3374,19 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *output_description;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
args_description = NULL;
output_description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssssss", &info_name, &description,
&args_description, &output_description,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_info_hashtable (weechat_python_plugin,
python_current_script,
@@ -4480,7 +3398,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4492,7 +3410,7 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4500,18 +3418,18 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- python_argv[2] = script_ptr2str (pointer);
- python_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ 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", python_argv);
+ "ssss", func_argv);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4528,31 +3446,19 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_infolist");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssssss", &infolist_name, &description,
&pointer_description, &args_description, &function,
&data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_infolist");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_infolist (weechat_python_plugin,
python_current_script,
@@ -4564,7 +3470,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4576,20 +3482,27 @@ weechat_python_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ 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])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = weechat_python_hashtable_to_dict (info);
- return (struct t_hashtable *)weechat_python_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", python_argv);
+ ret_hashtable = weechat_python_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ script_callback->function,
+ "sO", func_argv);
+ if (func_argv[1])
+ {
+ Py_XDECREF((PyObject *)func_argv[1]);
+ }
+
+ return ret_hashtable;
}
return NULL;
@@ -4603,26 +3516,14 @@ static PyObject *
weechat_python_api_hook_focus (PyObject *self, PyObject *args)
{
char *area, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_focus");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_focus");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_focus (weechat_python_plugin,
python_current_script,
@@ -4631,7 +3532,7 @@ weechat_python_api_hook_focus (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4643,28 +3544,16 @@ weechat_python_api_unhook (PyObject *self, PyObject *args)
{
char *hook;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "unhook");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
hook = NULL;
-
if (!PyArg_ParseTuple (args, "s", &hook))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "unhook");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_unhook (weechat_python_plugin,
python_current_script,
script_str2ptr (hook));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4675,18 +3564,13 @@ static PyObject *
weechat_python_api_unhook_all (PyObject *self, PyObject *args)
{
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "unhook_all");
- PYTHON_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (python_current_script);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4698,7 +3582,7 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
const char *input_data)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4706,14 +3590,14 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ 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,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4721,8 +3605,8 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4738,7 +3622,7 @@ int
weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4746,13 +3630,13 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
+ 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,
- "ss", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4760,8 +3644,8 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4778,29 +3662,17 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
{
char *name, *function_input, *data_input, *function_close, *data_close;
char *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
name = NULL;
function_input = NULL;
data_input = NULL;
function_close = NULL;
data_close = NULL;
-
if (!PyArg_ParseTuple (args, "sssss", &name, &function_input, &data_input,
&function_close, &data_close))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_buffer_new (weechat_python_plugin,
python_current_script,
@@ -4812,7 +3684,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
function_close,
data_close));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4824,29 +3696,17 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args)
{
char *plugin, *name;
char *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
plugin = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &plugin, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search (plugin, name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4857,21 +3717,16 @@ static PyObject *
weechat_python_api_buffer_search_main (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search_main");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4882,21 +3737,16 @@ static PyObject *
weechat_python_api_current_buffer (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "current_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4908,26 +3758,14 @@ weechat_python_api_buffer_clear (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_clear");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_clear");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_clear (script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4939,28 +3777,16 @@ weechat_python_api_buffer_close (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_close");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_close");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_buffer_close (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4972,28 +3798,16 @@ weechat_python_api_buffer_merge (PyObject *self, PyObject *args)
{
char *buffer, *target_buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_merge");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
buffer = NULL;
target_buffer = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &target_buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_merge");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5007,27 +3821,15 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args)
char *buffer;
int number;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
buffer = NULL;
number = 0;
-
if (!PyArg_ParseTuple (args, "si", &buffer, &number))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_unmerge (script_str2ptr (buffer), number);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5040,27 +3842,15 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
char *buffer, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5073,27 +3863,15 @@ weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
char *buffer, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_get_string", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5104,30 +3882,18 @@ static PyObject *
weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5139,30 +3905,18 @@ weechat_python_api_buffer_set (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_set (script_str2ptr (buffer),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5174,29 +3928,17 @@ static PyObject *
weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *args)
{
char *buffer, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PYTHON_RETURN_ERROR;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5210,27 +3952,15 @@ weechat_python_api_buffer_match_list (PyObject *self, PyObject *args)
char *buffer, *string;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
buffer = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5241,21 +3971,16 @@ static PyObject *
weechat_python_api_current_window (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "current_window");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5267,28 +3992,16 @@ static PyObject *
weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args)
{
char *buffer, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5301,27 +4014,15 @@ weechat_python_api_window_get_integer (PyObject *self, PyObject *args)
char *window, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_window_get_integer (script_str2ptr (window), property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5334,27 +4035,15 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
char *window, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_window_get_string (script_str2ptr (window), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5365,30 +4054,18 @@ static PyObject *
weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
{
char *window, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5400,26 +4077,14 @@ weechat_python_api_window_set_title (PyObject *self, PyObject *args)
{
char *title;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
title = NULL;
-
if (!PyArg_ParseTuple (args, "s", &title))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_window_set_title (title);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5431,29 +4096,17 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
{
char *buffer, *parent_group, *name, *color, *result;
int visible;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
buffer = NULL;
parent_group = NULL;
name = NULL;
color = NULL;
visible = 0;
-
if (!PyArg_ParseTuple (args, "ssssi", &buffer, &parent_group, &name,
&color, &visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
@@ -5461,7 +4114,7 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
color,
visible));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5472,32 +4125,20 @@ static PyObject *
weechat_python_api_nicklist_search_group (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5509,17 +4150,9 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
{
char *buffer, *group, *name, *color, *prefix, *prefix_color, *result;
int visible;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
name = NULL;
@@ -5527,13 +4160,9 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix = NULL;
prefix_color = NULL;
visible = 0;
-
if (!PyArg_ParseTuple (args, "ssssssi", &buffer, &group, &name, &color,
&prefix, &prefix_color, &visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
@@ -5543,7 +4172,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix_color,
visible));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5554,32 +4183,20 @@ static PyObject *
weechat_python_api_nicklist_search_nick (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5591,28 +4208,16 @@ weechat_python_api_nicklist_remove_group (PyObject *self, PyObject *args)
{
char *buffer, *group;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &group))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5624,28 +4229,16 @@ weechat_python_api_nicklist_remove_nick (PyObject *self, PyObject *args)
{
char *buffer, *nick;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &nick))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5657,26 +4250,14 @@ weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_all (script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5689,30 +4270,18 @@ weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args)
char *buffer, *group, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5725,30 +4294,18 @@ weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args)
char *buffer, *group, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5759,32 +4316,20 @@ static PyObject *
weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5796,32 +4341,20 @@ weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5834,30 +4367,18 @@ weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args)
char *buffer, *nick, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5870,30 +4391,18 @@ weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args)
char *buffer, *nick, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5904,32 +4413,20 @@ static PyObject *
weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5941,32 +4438,20 @@ weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5977,28 +4462,16 @@ static PyObject *
weechat_python_api_bar_item_search (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_item_search (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6010,26 +4483,26 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ 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])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (item);
- python_argv[2] = script_ptr2str (window);
+ 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", python_argv);
+ "sss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -6045,26 +4518,14 @@ static PyObject *
weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_new");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_bar_item_new (weechat_python_plugin,
python_current_script,
@@ -6073,7 +4534,7 @@ weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6085,26 +4546,14 @@ weechat_python_api_bar_item_update (PyObject *self, PyObject *args)
{
char *name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_update");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_update");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_item_update (name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6116,28 +4565,16 @@ weechat_python_api_bar_item_remove (PyObject *self, PyObject *args)
{
char *item;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_bar_item_remove (weechat_python_plugin,
python_current_script,
script_str2ptr (item));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6148,28 +4585,16 @@ static PyObject *
weechat_python_api_bar_search (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_search (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6182,17 +4607,9 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
char *name, *hidden, *priority, *type, *conditions, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max;
char *color_fg, *color_delim, *color_bg, *separator, *items, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
name = NULL;
hidden = NULL;
priority = NULL;
@@ -6208,15 +4625,11 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
color_bg = NULL;
separator = NULL;
items = NULL;
-
if (!PyArg_ParseTuple (args, "sssssssssssssss", &name, &hidden, &priority,
&type, &conditions, &position, &filling_top_bottom,
&filling_left_right, &size, &size_max, &color_fg,
&color_delim, &color_bg, &separator, &items))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_new (name,
hidden,
@@ -6234,7 +4647,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
separator,
items));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6246,30 +4659,18 @@ weechat_python_api_bar_set (PyObject *self, PyObject *args)
{
char *bar, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
bar = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_set (script_str2ptr (bar),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6281,26 +4682,14 @@ weechat_python_api_bar_update (PyObject *self, PyObject *args)
{
char *name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item", API_RETURN_ERROR);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_update (name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6312,26 +4701,14 @@ weechat_python_api_bar_remove (PyObject *self, PyObject *args)
{
char *bar;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
bar = NULL;
-
if (!PyArg_ParseTuple (args, "s", &bar))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_remove (script_str2ptr (bar));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6343,30 +4720,18 @@ weechat_python_api_command (PyObject *self, PyObject *args)
{
char *buffer, *command;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "command");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "command", API_RETURN_ERROR);
buffer = NULL;
command = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &command))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "command");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_command (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
command);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6379,27 +4744,15 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
char *info_name, *arguments;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "info_get");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
info_name = NULL;
arguments = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "info_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_info_get (info_name, arguments);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6413,22 +4766,10 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
struct t_hashtable *hashtable, *result_hashtable;
PyObject *dict, *result_dict;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
info_name = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -6451,21 +4792,15 @@ static PyObject *
weechat_python_api_infolist_new (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6476,28 +4811,16 @@ static PyObject *
weechat_python_api_infolist_new_item (PyObject *self, PyObject *args)
{
char *infolist, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6510,32 +4833,20 @@ weechat_python_api_infolist_new_var_integer (PyObject *self, PyObject *args)
{
char *infolist, *name, *result;
int value;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6547,32 +4858,20 @@ static PyObject *
weechat_python_api_infolist_new_var_string (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6584,32 +4883,20 @@ static PyObject *
weechat_python_api_infolist_new_var_pointer (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6622,32 +4909,20 @@ weechat_python_api_infolist_new_var_time (PyObject *self, PyObject *args)
{
char *infolist, *name, *result;
int value;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6658,32 +4933,20 @@ static PyObject *
weechat_python_api_infolist_get (PyObject *self, PyObject *args)
{
char *name, *pointer, *arguments, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_get");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6696,26 +4959,14 @@ weechat_python_api_infolist_next (PyObject *self, PyObject *args)
char *infolist;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_next");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_next");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_next (script_str2ptr (infolist));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6728,26 +4979,14 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args)
char *infolist;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_prev");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_prev");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_prev (script_str2ptr (infolist));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6760,26 +4999,14 @@ weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args)
{
char *infolist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6792,26 +5019,14 @@ weechat_python_api_infolist_fields (PyObject *self, PyObject *args)
char *infolist;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_fields");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_fields");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_fields (script_str2ptr (infolist));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6824,28 +5039,16 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args)
char *infolist, *variable;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6858,28 +5061,16 @@ weechat_python_api_infolist_string (PyObject *self, PyObject *args)
char *infolist, *variable;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6890,30 +5081,18 @@ static PyObject *
weechat_python_api_infolist_pointer (PyObject *self, PyObject *args)
{
char *infolist, *variable, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6925,32 +5104,20 @@ weechat_python_api_infolist_time (PyObject *self, PyObject *args)
{
char *infolist, *variable, timebuffer[64], *result;
time_t time;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_time");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_time");
- PYTHON_RETURN_EMPTY;
- }
+ 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);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6962,26 +5129,14 @@ weechat_python_api_infolist_free (PyObject *self, PyObject *args)
{
char *infolist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_free (script_str2ptr (infolist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6992,28 +5147,16 @@ static PyObject *
weechat_python_api_hdata_get (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_get (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7026,27 +5169,15 @@ weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args)
char *hdata, *name;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7060,27 +5191,15 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
char *hdata, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7093,27 +5212,15 @@ weechat_python_api_hdata_get_var_hdata (PyObject *self, PyObject *args)
char *hdata, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7124,30 +5231,18 @@ static PyObject *
weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
{
char *hdata, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7159,32 +5254,20 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args)
{
char *result, *hdata, *pointer;
int count;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7198,30 +5281,18 @@ weechat_python_api_hdata_integer (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7235,30 +5306,18 @@ weechat_python_api_hdata_long (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
long value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
- PYTHON_RETURN_LONG(0);
- }
-
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
- PYTHON_RETURN_LONG(0);
- }
+ API_WRONG_ARGS(API_RETURN_LONG(0));
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_LONG(value);
+ API_RETURN_LONG(value);
}
/*
@@ -7272,30 +5331,18 @@ weechat_python_api_hdata_string (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7307,32 +5354,20 @@ static PyObject *
weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7345,26 +5380,14 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, timebuffer[64], *result;
time_t time;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
- PYTHON_RETURN_EMPTY;
- }
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
@@ -7372,7 +5395,7 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7385,27 +5408,15 @@ weechat_python_api_hdata_get_string (PyObject *self, PyObject *args)
char *hdata, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
hdata = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7417,29 +5428,17 @@ weechat_python_api_upgrade_new (PyObject *self, PyObject *args)
{
char *filename, *result;
int write;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
filename = NULL;
write = 0;
-
if (!PyArg_ParseTuple (args, "si", &filename, &write))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_upgrade_new (filename, write));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7452,30 +5451,18 @@ weechat_python_api_upgrade_write_object (PyObject *self, PyObject *args)
char *upgrade_file, *infolist;
int object_id, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PYTHON_RETURN_INT(0);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7489,7 +5476,7 @@ weechat_python_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -7499,15 +5486,15 @@ weechat_python_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (upgrade_file);
- python_argv[2] = str_object_id;
- python_argv[3] = script_ptr2str (infolist);
+ 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", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -7516,10 +5503,10 @@ weechat_python_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -7537,24 +5524,12 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
char *upgrade_file, *function, *data;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_read");
- PYTHON_RETURN_INT(0);
- }
-
+ 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))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_read");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = script_api_upgrade_read (weechat_python_plugin,
python_current_script,
@@ -7563,7 +5538,7 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
function,
data);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7575,26 +5550,14 @@ weechat_python_api_upgrade_close (PyObject *self, PyObject *args)
{
char *upgrade_file;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_close");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
upgrade_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &upgrade_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_close");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_upgrade_close (script_str2ptr (upgrade_file));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*