diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-16 20:00:48 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-16 20:00:48 +0200 |
commit | 91bcfbb4e89f2964820915c258ef79e944c47ae4 (patch) | |
tree | f514caf50d3bd1574d21472bdc0fd81870bf3494 | |
parent | 17f3687e282d2e1756a3b15dbea9ddc781e9da53 (diff) | |
download | weechat-91bcfbb4e89f2964820915c258ef79e944c47ae4.zip |
core: move creation of info_hashtable "secured_data" in plugin-api-info.c
-rw-r--r-- | src/core/wee-secure.c | 28 | ||||
-rw-r--r-- | src/plugins/plugin-api-info.c | 29 |
2 files changed, 29 insertions, 28 deletions
diff --git a/src/core/wee-secure.c b/src/core/wee-secure.c index 892dfaf57..39ff5d199 100644 --- a/src/core/wee-secure.c +++ b/src/core/wee-secure.c @@ -495,24 +495,6 @@ secure_decrypt_data_not_decrypted (const char *passphrase) } /* - * Returns secured data hashtable. - */ - -struct t_hashtable * -secure_info_hashtable_secured_data_cb (const void *pointer, void *data, - const char *info_name, - struct t_hashtable *hashtable) -{ - /* make C compiler happy */ - (void) pointer; - (void) data; - (void) info_name; - (void) hashtable; - - return hashtable_dup (secure_hashtable_data); -} - -/* * Initializes secured data. * * Returns: @@ -554,16 +536,6 @@ secure_init () return 0; } - /* info (hashtable) with the secured data */ - hook_info_hashtable ( - NULL, - "secured_data", - N_("secured data"), - NULL, - N_("secured data: names and values (be careful: the values are " - "sensitive data: do NOT print/log them anywhere)"), - &secure_info_hashtable_secured_data_cb, NULL, NULL); - return 1; } diff --git a/src/plugins/plugin-api-info.c b/src/plugins/plugin-api-info.c index a476a015e..3546491f8 100644 --- a/src/plugins/plugin-api-info.c +++ b/src/plugins/plugin-api-info.c @@ -32,9 +32,11 @@ #include "../core/weechat.h" #include "../core/wee-config.h" #include "../core/wee-crypto.h" +#include "../core/wee-hashtable.h" #include "../core/wee-hook.h" #include "../core/wee-infolist.h" #include "../core/wee-proxy.h" +#include "../core/wee-secure.h" #include "../core/wee-string.h" #include "../core/wee-url.h" #include "../core/wee-util.h" @@ -1025,6 +1027,24 @@ error: } /* + * Returns secured data hashtable. + */ + +struct t_hashtable * +plugin_api_info_hashtable_secured_data_cb (const void *pointer, void *data, + const char *info_name, + struct t_hashtable *hashtable) +{ + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) info_name; + (void) hashtable; + + return hashtable_dup (secure_hashtable_data); +} + +/* * Returns WeeChat infolist "bar". * * Note: result must be freed after use with function weechat_infolist_free(). @@ -2039,6 +2059,15 @@ plugin_api_info_init () "\"y\": y coordinate (string with integer >= 0)"), N_("see function \"hook_focus\" in Plugin API reference"), &gui_focus_info_hashtable_gui_focus_info_cb, NULL, NULL); + /* info (hashtable) with the secured data */ + hook_info_hashtable ( + NULL, + "secured_data", + N_("secured data"), + NULL, + N_("secured data: names and values (be careful: the values are " + "sensitive data: do NOT print/log them anywhere)"), + &plugin_api_info_hashtable_secured_data_cb, NULL, NULL); /* WeeChat core infolist hooks */ hook_infolist (NULL, "bar", |