mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
api: return value in function command(), remove WeeChat error after command callback if return code is WEECHAT_RC_ERROR
This commit is contained in:
@@ -4249,6 +4249,7 @@ static int
|
||||
weechat_lua_api_command (lua_State *L)
|
||||
{
|
||||
const char *buffer, *command;
|
||||
int rc;
|
||||
|
||||
API_FUNC(1, "command", API_RETURN_ERROR);
|
||||
if (lua_gettop (L) < 2)
|
||||
@@ -4257,12 +4258,12 @@ weechat_lua_api_command (lua_State *L)
|
||||
buffer = lua_tostring (L, -2);
|
||||
command = lua_tostring (L, -1);
|
||||
|
||||
plugin_script_api_command (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
command);
|
||||
rc = plugin_script_api_command (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
command);
|
||||
|
||||
API_RETURN_OK;
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -645,7 +645,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
weechat_lua_unload_all ();
|
||||
}
|
||||
else
|
||||
return WEECHAT_RC_ERROR;
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -695,7 +695,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
lua_quiet = 0;
|
||||
}
|
||||
else
|
||||
return WEECHAT_RC_ERROR;
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
Reference in New Issue
Block a user