summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/de/weechat_scripting.de.adoc2
-rw-r--r--doc/en/weechat_scripting.en.adoc2
-rw-r--r--doc/fr/weechat_scripting.fr.adoc2
-rw-r--r--doc/it/weechat_scripting.it.adoc2
-rw-r--r--doc/ja/weechat_scripting.ja.adoc2
-rw-r--r--doc/pl/weechat_scripting.pl.adoc2
-rw-r--r--doc/sr/weechat_scripting.sr.adoc2
-rw-r--r--src/plugins/guile/weechat-guile-api.c37
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp35
-rw-r--r--src/plugins/lua/weechat-lua-api.c37
-rw-r--r--src/plugins/perl/weechat-perl-api.c39
-rw-r--r--src/plugins/php/weechat-php-api.c43
-rw-r--r--src/plugins/php/weechat-php-api.h2
-rw-r--r--src/plugins/php/weechat-php.c2
-rw-r--r--src/plugins/php/weechat-php.stub.php2
-rw-r--r--src/plugins/php/weechat-php_arginfo.h7
-rw-r--r--src/plugins/php/weechat-php_legacy_arginfo.h7
-rw-r--r--src/plugins/python/weechat-python-api.c35
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c48
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c37
-rw-r--r--tests/scripts/python/testapi.py6
22 files changed, 349 insertions, 3 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index b51464ccf..8cbb74a83 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -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
diff --git a/doc/de/weechat_scripting.de.adoc b/doc/de/weechat_scripting.de.adoc
index 2b7fe85a3..8f75aa889 100644
--- a/doc/de/weechat_scripting.de.adoc
+++ b/doc/de/weechat_scripting.de.adoc
@@ -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 +
diff --git a/doc/en/weechat_scripting.en.adoc b/doc/en/weechat_scripting.en.adoc
index b26da4780..d6e8cf8ee 100644
--- a/doc/en/weechat_scripting.en.adoc
+++ b/doc/en/weechat_scripting.en.adoc
@@ -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 +
diff --git a/doc/fr/weechat_scripting.fr.adoc b/doc/fr/weechat_scripting.fr.adoc
index 0b5f6dae3..dc7699b92 100644
--- a/doc/fr/weechat_scripting.fr.adoc
+++ b/doc/fr/weechat_scripting.fr.adoc
@@ -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 +
diff --git a/doc/it/weechat_scripting.it.adoc b/doc/it/weechat_scripting.it.adoc
index 7670bf0d9..bd01da28c 100644
--- a/doc/it/weechat_scripting.it.adoc
+++ b/doc/it/weechat_scripting.it.adoc
@@ -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 +
diff --git a/doc/ja/weechat_scripting.ja.adoc b/doc/ja/weechat_scripting.ja.adoc
index c48826643..b48197d77 100644
--- a/doc/ja/weechat_scripting.ja.adoc
+++ b/doc/ja/weechat_scripting.ja.adoc
@@ -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 +
diff --git a/doc/pl/weechat_scripting.pl.adoc b/doc/pl/weechat_scripting.pl.adoc
index dd79ad490..126521559 100644
--- a/doc/pl/weechat_scripting.pl.adoc
+++ b/doc/pl/weechat_scripting.pl.adoc
@@ -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 +
diff --git a/doc/sr/weechat_scripting.sr.adoc b/doc/sr/weechat_scripting.sr.adoc
index dd5ce3e30..3fa685ce9 100644
--- a/doc/sr/weechat_scripting.sr.adoc
+++ b/doc/sr/weechat_scripting.sr.adoc
@@ -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 +
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index d67559338..290e069b2 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -1516,6 +1516,41 @@ weechat_guile_api_config_option_rename (SCM option, SCM new_name)
}
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)
{
int value;
@@ -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);
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 9bf8b1c54..12d1c79ae 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -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);
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 5b2de2079..222ed500a 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -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),
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 69a872d20..62caf2984 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -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);
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c
index d4cc5a352..bc6328f42 100644
--- a/src/plugins/php/weechat-php-api.c
+++ b/src/plugins/php/weechat-php-api.c
@@ -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,
diff --git a/src/plugins/php/weechat-php-api.h b/src/plugins/php/weechat-php-api.h
index dceb64f6f..40b8dd1aa 100644
--- a/src/plugins/php/weechat-php-api.h
+++ b/src/plugins/php/weechat-php-api.h
@@ -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);
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 9ea05d4cb..5324d8320 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -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)
diff --git a/src/plugins/php/weechat-php.stub.php b/src/plugins/php/weechat-php.stub.php
index 3fa47053b..32ef0dcca 100644
--- a/src/plugins/php/weechat-php.stub.php
+++ b/src/plugins/php/weechat-php.stub.php
@@ -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 {}
diff --git a/src/plugins/php/weechat-php_arginfo.h b/src/plugins/php/weechat-php_arginfo.h
index 250d2ea5f..225a00abe 100644
--- a/src/plugins/php/weechat-php_arginfo.h
+++ b/src/plugins/php/weechat-php_arginfo.h
@@ -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
+
diff --git a/src/plugins/php/weechat-php_legacy_arginfo.h b/src/plugins/php/weechat-php_legacy_arginfo.h
index 2622d66b0..9b620112b 100644
--- a/src/plugins/php/weechat-php_legacy_arginfo.h
+++ b/src/plugins/php/weechat-php_legacy_arginfo.h
@@ -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
+
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index 068981bdd..d4a1118c4 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -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),
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 21a6e3521..7d31d374c 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -1811,6 +1811,52 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
}
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)
{
char *c_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);
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index c0f8dc812..b05a0b7da 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -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);
diff --git a/tests/scripts/python/testapi.py b/tests/scripts/python/testapi.py
index 22602cc1c..4cbe6ddab 100644
--- a/tests/scripts/python/testapi.py
+++ b/tests/scripts/python/testapi.py
@@ -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