diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-10 17:42:53 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-10 17:42:53 +0100 |
commit | 437767c0ca37ab06d0f2c2ff2831c7ebe1c3e61f (patch) | |
tree | cc89ab5a0aa0d9a7fe280fcac8e72dcf590937eb /src/plugins/python | |
parent | a0bf3938f18c275fe585639db7ad9d945e462d94 (diff) | |
download | weechat-437767c0ca37ab06d0f2c2ff2831c7ebe1c3e61f.zip |
api: add integer return code for functions hook_{signal|hsignal}_send
Diffstat (limited to 'src/plugins/python')
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 35 | ||||
-rw-r--r-- | src/plugins/python/weechat-python.c | 9 |
2 files changed, 23 insertions, 21 deletions
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 0a8df4c6e..91812fae1 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -2584,38 +2584,38 @@ static PyObject * weechat_python_api_hook_signal_send (PyObject *self, PyObject *args) { char *signal, *type_data, *signal_data, *error; - int number; + int number, rc; - API_FUNC(1, "hook_signal_send", API_RETURN_ERROR); + API_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR)); signal = NULL; type_data = NULL; signal_data = NULL; if (!PyArg_ParseTuple (args, "sss", &signal, &type_data, &signal_data)) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0) { - weechat_hook_signal_send (signal, type_data, signal_data); - API_RETURN_OK; + rc = weechat_hook_signal_send (signal, type_data, signal_data); + API_RETURN_INT(rc); } else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0) { error = NULL; number = (int)strtol (signal_data, &error, 10); if (error && !error[0]) - { - weechat_hook_signal_send (signal, type_data, &number); - } - API_RETURN_OK; + rc = weechat_hook_signal_send (signal, type_data, &number); + else + rc = WEECHAT_RC_ERROR; + API_RETURN_INT(rc); } else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0) { - weechat_hook_signal_send (signal, type_data, - API_STR2PTR(signal_data)); - API_RETURN_OK; + rc = weechat_hook_signal_send (signal, type_data, + API_STR2PTR(signal_data)); + API_RETURN_INT(rc); } - API_RETURN_ERROR; + API_RETURN_INT(WEECHAT_RC_ERROR); } int @@ -2687,24 +2687,25 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args) char *signal; struct t_hashtable *hashtable; PyObject *dict; + int rc; - API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR); + API_FUNC(1, "hook_hsignal_send", API_RETURN_INT(WEECHAT_RC_ERROR)); signal = NULL; dict = NULL; if (!PyArg_ParseTuple (args, "sO", &signal, &dict)) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); hashtable = weechat_python_dict_to_hashtable (dict, WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_STRING); - weechat_hook_hsignal_send (signal, hashtable); + rc = weechat_hook_hsignal_send (signal, hashtable); if (hashtable) weechat_hashtable_free (hashtable); - API_RETURN_OK; + API_RETURN_INT(rc); } int diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index b40f5d323..e0b556cad 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -766,8 +766,9 @@ weechat_python_load (const char *filename) &weechat_python_api_buffer_input_data_cb, &weechat_python_api_buffer_close_cb); - weechat_hook_signal_send ("python_script_loaded", WEECHAT_HOOK_SIGNAL_STRING, - python_current_script->filename); + (void) weechat_hook_signal_send ("python_script_loaded", + WEECHAT_HOOK_SIGNAL_STRING, + python_current_script->filename); return 1; } @@ -832,8 +833,8 @@ weechat_python_unload (struct t_plugin_script *script) if (old_interpreter) PyThreadState_Swap (old_interpreter); - weechat_hook_signal_send ("python_script_unloaded", - WEECHAT_HOOK_SIGNAL_STRING, filename); + (void) weechat_hook_signal_send ("python_script_unloaded", + WEECHAT_HOOK_SIGNAL_STRING, filename); if (filename) free (filename); } |