mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
api: add functions config_option_get_string and config_option_get_pointer in scripting API
This commit is contained in:
@@ -19,6 +19,7 @@ New features::
|
||||
* core: add option `-s` in command `/command` to execute multiple commands separated by semicolons
|
||||
* core: allow case insensitive search of partial buffer name with `(?i)name` in command `/buffer`
|
||||
* core: use function util_strftimeval in evaluation of expression `date:xxx`
|
||||
* api: add functions config_option_get_string and config_option_get_pointer in scripting API
|
||||
* api: add info "plugin_loaded"
|
||||
* api: add support of specifier `%!` for timestamp in function util_strftimeval
|
||||
* api: add support of base64url in encode/decode functions
|
||||
|
||||
@@ -629,6 +629,8 @@ Liste der Skript API Funktionen:
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -614,6 +614,8 @@ List of functions in script API:
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -635,6 +635,8 @@ Liste des fonctions de l'API script :
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -644,6 +644,8 @@ Elenco di funzioni nelle API per gli script:
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -636,6 +636,8 @@ link:weechat_plugin_api.ja.html[WeeChat プラグイン API リファレンス
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -622,6 +622,8 @@ Lista funkcji w API skryptów:
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -575,6 +575,8 @@ weechat_hook_timer(1000, 0, 1, $timer_cb, 'test');
|
||||
config_option_set_null +
|
||||
config_option_unset +
|
||||
config_option_rename +
|
||||
config_option_get_string +
|
||||
config_option_get_pointer +
|
||||
config_option_is_null +
|
||||
config_option_default_is_null +
|
||||
config_boolean +
|
||||
|
||||
@@ -1515,6 +1515,41 @@ weechat_guile_api_config_option_rename (SCM option, SCM new_name)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
SCM
|
||||
weechat_guile_api_config_option_get_string (SCM option, SCM property)
|
||||
{
|
||||
const char *result;
|
||||
SCM return_value;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (!scm_is_string (option) || !scm_is_string (property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
result = weechat_config_option_get_string (
|
||||
API_STR2PTR(API_SCM_TO_STRING(option)),
|
||||
API_SCM_TO_STRING(property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
SCM
|
||||
weechat_guile_api_config_option_get_pointer (SCM option, SCM property)
|
||||
{
|
||||
const char *result;
|
||||
SCM return_value;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (!scm_is_string (option) || !scm_is_string (property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
result = API_PTR2STR(
|
||||
weechat_config_option_get_pointer (
|
||||
API_STR2PTR(API_SCM_TO_STRING(option)),
|
||||
API_SCM_TO_STRING(property)));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
SCM
|
||||
weechat_guile_api_config_option_is_null (SCM option)
|
||||
{
|
||||
@@ -5366,6 +5401,8 @@ weechat_guile_api_module_init (void *data)
|
||||
API_DEF_FUNC(config_option_set_null, 2);
|
||||
API_DEF_FUNC(config_option_unset, 1);
|
||||
API_DEF_FUNC(config_option_rename, 2);
|
||||
API_DEF_FUNC(config_option_get_string, 2);
|
||||
API_DEF_FUNC(config_option_get_pointer, 2);
|
||||
API_DEF_FUNC(config_option_is_null, 1);
|
||||
API_DEF_FUNC(config_option_default_is_null, 1);
|
||||
API_DEF_FUNC(config_boolean, 1);
|
||||
|
||||
@@ -1425,6 +1425,39 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", "ss", API_RETURN_EMPTY);
|
||||
|
||||
v8::String::Utf8Value option(args[0]);
|
||||
v8::String::Utf8Value property(args[1]);
|
||||
|
||||
result = weechat_config_option_get_string (
|
||||
(struct t_config_option *)API_STR2PTR(*option),
|
||||
*property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", "ss", API_RETURN_EMPTY);
|
||||
|
||||
v8::String::Utf8Value option(args[0]);
|
||||
v8::String::Utf8Value property(args[1]);
|
||||
|
||||
result = API_PTR2STR(
|
||||
weechat_config_option_get_pointer (
|
||||
(struct t_config_option *)API_STR2PTR(*option),
|
||||
*property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
int value;
|
||||
@@ -5319,6 +5352,8 @@ WeechatJsV8::loadLibs()
|
||||
API_DEF_FUNC(config_option_set_null);
|
||||
API_DEF_FUNC(config_option_unset);
|
||||
API_DEF_FUNC(config_option_rename);
|
||||
API_DEF_FUNC(config_option_get_string);
|
||||
API_DEF_FUNC(config_option_get_pointer);
|
||||
API_DEF_FUNC(config_option_is_null);
|
||||
API_DEF_FUNC(config_option_default_is_null);
|
||||
API_DEF_FUNC(config_boolean);
|
||||
|
||||
@@ -1552,6 +1552,41 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
const char *option, *property, *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (lua_gettop (L) < 2)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = lua_tostring (L, -2);
|
||||
property = lua_tostring (L, -1);
|
||||
|
||||
result = weechat_config_option_get_string (API_STR2PTR(option),
|
||||
property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
const char *option, *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (lua_gettop (L) < 2)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = lua_tostring (L, -2);
|
||||
property = lua_tostring (L, -1);
|
||||
|
||||
result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option),
|
||||
property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
const char *option;
|
||||
@@ -5686,6 +5721,8 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
|
||||
API_DEF_FUNC(config_option_set_null),
|
||||
API_DEF_FUNC(config_option_unset),
|
||||
API_DEF_FUNC(config_option_rename),
|
||||
API_DEF_FUNC(config_option_get_string),
|
||||
API_DEF_FUNC(config_option_get_pointer),
|
||||
API_DEF_FUNC(config_option_is_null),
|
||||
API_DEF_FUNC(config_option_default_is_null),
|
||||
API_DEF_FUNC(config_boolean),
|
||||
|
||||
@@ -1491,6 +1491,43 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
dXSARGS;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (items < 2)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = SvPV_nolen (ST (0));
|
||||
property = SvPV_nolen (ST (1));
|
||||
|
||||
result = weechat_config_option_get_string (API_STR2PTR(option), property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
dXSARGS;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (items < 2)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = SvPV_nolen (ST (0));
|
||||
property = SvPV_nolen (ST (1));
|
||||
|
||||
result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option),
|
||||
property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
int value;
|
||||
@@ -5623,6 +5660,8 @@ weechat_perl_api_init (pTHX)
|
||||
API_DEF_FUNC(config_option_set_null);
|
||||
API_DEF_FUNC(config_option_unset);
|
||||
API_DEF_FUNC(config_option_rename);
|
||||
API_DEF_FUNC(config_option_get_string);
|
||||
API_DEF_FUNC(config_option_get_pointer);
|
||||
API_DEF_FUNC(config_option_is_null);
|
||||
API_DEF_FUNC(config_option_default_is_null);
|
||||
API_DEF_FUNC(config_boolean);
|
||||
|
||||
@@ -1570,6 +1570,47 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
zend_string *z_option, *z_property;
|
||||
struct t_config_option *option;
|
||||
char *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_option,
|
||||
&z_property) == FAILURE)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option));
|
||||
property = ZSTR_VAL(z_property);
|
||||
|
||||
result = weechat_config_option_get_string (option, (const char *)property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
zend_string *z_option, *z_property;
|
||||
struct t_config_option *option;
|
||||
char *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_option,
|
||||
&z_property) == FAILURE)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option));
|
||||
property = ZSTR_VAL(z_property);
|
||||
|
||||
result = API_PTR2STR(
|
||||
weechat_config_option_get_pointer (option, (const char *)property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
zend_string *z_option;
|
||||
@@ -3764,9 +3805,9 @@ API_FUNC(buffer_get_integer)
|
||||
API_FUNC(buffer_get_string)
|
||||
{
|
||||
zend_string *z_buffer, *z_property;
|
||||
const char *result;
|
||||
struct t_gui_buffer *buffer;
|
||||
char *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_buffer,
|
||||
|
||||
@@ -96,6 +96,8 @@ PHP_FUNCTION(weechat_config_option_set);
|
||||
PHP_FUNCTION(weechat_config_option_set_null);
|
||||
PHP_FUNCTION(weechat_config_option_unset);
|
||||
PHP_FUNCTION(weechat_config_option_rename);
|
||||
PHP_FUNCTION(weechat_config_option_get_string);
|
||||
PHP_FUNCTION(weechat_config_option_get_pointer);
|
||||
PHP_FUNCTION(weechat_config_option_is_null);
|
||||
PHP_FUNCTION(weechat_config_option_default_is_null);
|
||||
PHP_FUNCTION(weechat_config_boolean);
|
||||
|
||||
@@ -154,6 +154,8 @@ const zend_function_entry weechat_functions[] = {
|
||||
PHP_FE(weechat_config_option_set_null, arginfo_weechat_config_option_set_null)
|
||||
PHP_FE(weechat_config_option_unset, arginfo_weechat_config_option_unset)
|
||||
PHP_FE(weechat_config_option_rename, arginfo_weechat_config_option_rename)
|
||||
PHP_FE(weechat_config_option_get_string, arginfo_weechat_config_option_get_string)
|
||||
PHP_FE(weechat_config_option_get_pointer, arginfo_weechat_config_option_get_pointer)
|
||||
PHP_FE(weechat_config_option_is_null, arginfo_weechat_config_option_is_null)
|
||||
PHP_FE(weechat_config_option_default_is_null, arginfo_weechat_config_option_default_is_null)
|
||||
PHP_FE(weechat_config_boolean, arginfo_weechat_config_boolean)
|
||||
|
||||
@@ -62,6 +62,8 @@ function weechat_config_option_set(string $p0, string $p1, int $p2): int {}
|
||||
function weechat_config_option_set_null(string $p0, int $p1): int {}
|
||||
function weechat_config_option_unset(string $p0): int {}
|
||||
function weechat_config_option_rename(string $p0, string $p1): int {}
|
||||
function weechat_config_option_get_string(string $p0, string $p1): string {}
|
||||
function weechat_config_option_get_pointer(string $p0, string $p1): string {}
|
||||
function weechat_config_option_is_null(string $p0): int {}
|
||||
function weechat_config_option_default_is_null(string $p0): int {}
|
||||
function weechat_config_boolean(string $p0): int {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
|
||||
* Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_register, 0, 7, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
|
||||
@@ -161,6 +161,10 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_config_option_rename arginfo_weechat_string_has_highlight
|
||||
|
||||
#define arginfo_weechat_config_option_get_string arginfo_weechat_iconv_to_internal
|
||||
|
||||
#define arginfo_weechat_config_option_get_pointer arginfo_weechat_iconv_to_internal
|
||||
|
||||
#define arginfo_weechat_config_option_is_null arginfo_weechat_charset_set
|
||||
|
||||
#define arginfo_weechat_config_option_default_is_null arginfo_weechat_charset_set
|
||||
@@ -639,3 +643,4 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_forget_class, 0, 1, _IS_BOOL, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_forget_function arginfo_forget_class
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
|
||||
* Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7)
|
||||
ZEND_ARG_INFO(0, p0)
|
||||
@@ -126,6 +126,10 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_config_option_rename arginfo_weechat_iconv_to_internal
|
||||
|
||||
#define arginfo_weechat_config_option_get_string arginfo_weechat_iconv_to_internal
|
||||
|
||||
#define arginfo_weechat_config_option_get_pointer arginfo_weechat_iconv_to_internal
|
||||
|
||||
#define arginfo_weechat_config_option_is_null arginfo_weechat_plugin_get_name
|
||||
|
||||
#define arginfo_weechat_config_option_default_is_null arginfo_weechat_plugin_get_name
|
||||
@@ -462,3 +466,4 @@ ZEND_END_ARG_INFO()
|
||||
#define arginfo_forget_class arginfo_weechat_plugin_get_name
|
||||
|
||||
#define arginfo_forget_function arginfo_weechat_plugin_get_name
|
||||
|
||||
|
||||
@@ -1480,6 +1480,39 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
option = NULL;
|
||||
property = NULL;
|
||||
if (!PyArg_ParseTuple (args, "ss", &option, &property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
result = weechat_config_option_get_string (API_STR2PTR(option), property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
option = NULL;
|
||||
property = NULL;
|
||||
if (!PyArg_ParseTuple (args, "ss", &option, &property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option),
|
||||
property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
char *option;
|
||||
@@ -5552,6 +5585,8 @@ PyMethodDef weechat_python_funcs[] =
|
||||
API_DEF_FUNC(config_option_set_null),
|
||||
API_DEF_FUNC(config_option_unset),
|
||||
API_DEF_FUNC(config_option_rename),
|
||||
API_DEF_FUNC(config_option_get_string),
|
||||
API_DEF_FUNC(config_option_get_pointer),
|
||||
API_DEF_FUNC(config_option_is_null),
|
||||
API_DEF_FUNC(config_option_default_is_null),
|
||||
API_DEF_FUNC(config_boolean),
|
||||
|
||||
@@ -1810,6 +1810,52 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_option_get_string (VALUE class, VALUE option,
|
||||
VALUE property)
|
||||
{
|
||||
char *c_option, *c_property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (NIL_P (option) || NIL_P (property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (property, T_STRING);
|
||||
|
||||
c_option = StringValuePtr (option);
|
||||
c_property = StringValuePtr (property);
|
||||
|
||||
result = weechat_config_option_get_string (API_STR2PTR(c_option),
|
||||
c_property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_option_get_pointer (VALUE class, VALUE option,
|
||||
VALUE property)
|
||||
{
|
||||
char *c_option, *c_property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (NIL_P (option) || NIL_P (property))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (property, T_STRING);
|
||||
|
||||
c_option = StringValuePtr (option);
|
||||
c_property = StringValuePtr (property);
|
||||
|
||||
result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(c_option),
|
||||
c_property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_option_is_null (VALUE class, VALUE option)
|
||||
{
|
||||
@@ -6883,6 +6929,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
API_DEF_FUNC(config_option_set_null, 2);
|
||||
API_DEF_FUNC(config_option_unset, 1);
|
||||
API_DEF_FUNC(config_option_rename, 2);
|
||||
API_DEF_FUNC(config_option_get_string, 2);
|
||||
API_DEF_FUNC(config_option_get_pointer, 2);
|
||||
API_DEF_FUNC(config_option_is_null, 1);
|
||||
API_DEF_FUNC(config_option_default_is_null, 1);
|
||||
API_DEF_FUNC(config_boolean, 1);
|
||||
|
||||
@@ -1557,6 +1557,41 @@ API_FUNC(config_option_rename)
|
||||
API_RETURN_OK;
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_string)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
|
||||
if (objc < 3)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = Tcl_GetString (objv[1]);
|
||||
property = Tcl_GetString (objv[2]);
|
||||
|
||||
result = weechat_config_option_get_string (API_STR2PTR(option), property);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_get_pointer)
|
||||
{
|
||||
char *option, *property;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
|
||||
if (objc < 3)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
option = Tcl_GetString (objv[1]);
|
||||
property = Tcl_GetString (objv[2]);
|
||||
|
||||
result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option),
|
||||
property));
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(config_option_is_null)
|
||||
{
|
||||
int result;
|
||||
@@ -5659,6 +5694,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
API_DEF_FUNC(config_option_set_null);
|
||||
API_DEF_FUNC(config_option_unset);
|
||||
API_DEF_FUNC(config_option_rename);
|
||||
API_DEF_FUNC(config_option_get_string);
|
||||
API_DEF_FUNC(config_option_get_pointer);
|
||||
API_DEF_FUNC(config_option_is_null);
|
||||
API_DEF_FUNC(config_option_default_is_null);
|
||||
API_DEF_FUNC(config_boolean);
|
||||
|
||||
@@ -355,6 +355,12 @@ def test_config():
|
||||
check(weechat.config_string_to_boolean('1') == 1)
|
||||
# rename option
|
||||
weechat.config_option_rename(ptr_opt_bool, 'option_bool_renamed')
|
||||
# get string property of option
|
||||
check(weechat.config_option_get_string(ptr_opt_bool, 'type') == 'boolean')
|
||||
check(weechat.config_option_get_string(ptr_opt_bool, 'name') == 'option_bool_renamed')
|
||||
# get pointer property of option
|
||||
check(weechat.config_option_get_pointer(ptr_opt_bool, 'config_file') == ptr_config)
|
||||
check(weechat.config_option_get_pointer(ptr_opt_bool, 'section') == ptr_section)
|
||||
# read config (create it because it does not exist yet)
|
||||
check(weechat.config_read(ptr_config) == 0) # CONFIG_READ_OK
|
||||
# write config
|
||||
|
||||
Reference in New Issue
Block a user