mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 22:36:38 +02:00
core: add configuration version, add API function config_set_version
This commit is contained in:
@@ -1072,6 +1072,58 @@ API_FUNC(config_new)
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
struct t_hashtable *
|
||||
weechat_php_api_config_update_cb (const void *pointer, void *data,
|
||||
struct t_config_file *config_file,
|
||||
int version_read,
|
||||
struct t_hashtable *data_read)
|
||||
{
|
||||
struct t_hashtable *rc;
|
||||
void *func_argv[4];
|
||||
|
||||
func_argv[1] = (char *)API_PTR2STR(config_file);
|
||||
func_argv[2] = &version_read;
|
||||
func_argv[3] = data_read;
|
||||
|
||||
weechat_php_cb (pointer, data, func_argv, "ssih",
|
||||
WEECHAT_SCRIPT_EXEC_HASHTABLE, &rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
API_FUNC(config_set_version)
|
||||
{
|
||||
zend_string *z_config_file;
|
||||
zend_long z_version;
|
||||
zval *z_callback_update;
|
||||
zend_string *z_data;
|
||||
struct t_config_file *config_file;
|
||||
char *data;
|
||||
int rc, version;
|
||||
|
||||
API_INIT_FUNC(1, "config_set_version", API_RETURN_INT(0));
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SlzS", &z_config_file,
|
||||
&z_version, &z_callback_update,
|
||||
&z_data) == FAILURE)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
config_file = (struct t_config_file *)API_STR2PTR(ZSTR_VAL(z_config_file));
|
||||
version = (int)z_version;
|
||||
weechat_php_get_function_name (z_callback_update, callback_update_name);
|
||||
data = ZSTR_VAL(z_data);
|
||||
|
||||
rc = plugin_script_api_config_set_version (
|
||||
weechat_php_plugin,
|
||||
php_current_script,
|
||||
config_file,
|
||||
version,
|
||||
&weechat_php_api_config_update_cb,
|
||||
(const char *)callback_update_name,
|
||||
(const char *)data);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_php_api_config_section_read_cb (const void *pointer, void *data,
|
||||
struct t_config_file *config_file,
|
||||
|
||||
@@ -85,6 +85,7 @@ PHP_FUNCTION(weechat_list_remove);
|
||||
PHP_FUNCTION(weechat_list_remove_all);
|
||||
PHP_FUNCTION(weechat_list_free);
|
||||
PHP_FUNCTION(weechat_config_new);
|
||||
PHP_FUNCTION(weechat_config_set_version);
|
||||
PHP_FUNCTION(weechat_config_new_section);
|
||||
PHP_FUNCTION(weechat_config_search_section);
|
||||
PHP_FUNCTION(weechat_config_new_option);
|
||||
|
||||
@@ -143,6 +143,7 @@ const zend_function_entry weechat_functions[] = {
|
||||
PHP_FE(weechat_list_remove_all, arginfo_weechat_list_remove_all)
|
||||
PHP_FE(weechat_list_free, arginfo_weechat_list_free)
|
||||
PHP_FE(weechat_config_new, arginfo_weechat_config_new)
|
||||
PHP_FE(weechat_config_set_version, arginfo_weechat_config_set_version)
|
||||
PHP_FE(weechat_config_new_section, arginfo_weechat_config_new_section)
|
||||
PHP_FE(weechat_config_search_section, arginfo_weechat_config_search_section)
|
||||
PHP_FE(weechat_config_new_option, arginfo_weechat_config_new_option)
|
||||
|
||||
@@ -51,6 +51,7 @@ function weechat_list_remove(string $p0, string $p1): int {}
|
||||
function weechat_list_remove_all(string $p0): int {}
|
||||
function weechat_list_free(string $p0): int {}
|
||||
function weechat_config_new(string $p0, mixed $p1, string $p2): string {}
|
||||
function weechat_config_set_version(string $p0, int $p1, mixed $p2, string $p3): int {}
|
||||
function weechat_config_new_section(): string {}
|
||||
function weechat_config_search_section(string $p0, string $p1): string {}
|
||||
function weechat_config_new_option(): string {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: a89a2f8dfa145afbf1c86bf246715c88babebb07 */
|
||||
* Stub hash: 5c460494eac0e2ed6729ab210df6679f990070d6 */
|
||||
|
||||
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)
|
||||
@@ -130,6 +130,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_config_new, 0, 3, IS_STR
|
||||
ZEND_ARG_TYPE_INFO(0, p2, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_config_set_version, 0, 4, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, p1, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, p2, IS_MIXED, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, p3, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_config_new_section arginfo_weechat_list_new
|
||||
|
||||
#define arginfo_weechat_config_search_section arginfo_weechat_iconv_to_internal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: a89a2f8dfa145afbf1c86bf246715c88babebb07 */
|
||||
* Stub hash: 5c460494eac0e2ed6729ab210df6679f990070d6 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7)
|
||||
ZEND_ARG_INFO(0, p0)
|
||||
@@ -46,7 +46,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_string_format_size arginfo_weechat_plugin_get_name
|
||||
|
||||
#define arginfo_weechat_string_parse_size arginfo_weechat_charset_set
|
||||
#define arginfo_weechat_string_parse_size arginfo_weechat_plugin_get_name
|
||||
|
||||
#define arginfo_weechat_string_color_code_size arginfo_weechat_plugin_get_name
|
||||
|
||||
@@ -104,6 +104,8 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_config_new arginfo_weechat_ngettext
|
||||
|
||||
#define arginfo_weechat_config_set_version arginfo_weechat_string_eval_expression
|
||||
|
||||
#define arginfo_weechat_config_new_section arginfo_weechat_list_new
|
||||
|
||||
#define arginfo_weechat_config_search_section arginfo_weechat_iconv_to_internal
|
||||
|
||||
Reference in New Issue
Block a user