1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

core: move creation of info_hashtable "secured_data" in plugin-api-info.c

This commit is contained in:
Sébastien Helleu
2023-05-16 20:00:48 +02:00
parent 17f3687e28
commit 91bcfbb4e8
2 changed files with 29 additions and 28 deletions
-28
View File
@@ -494,24 +494,6 @@ secure_decrypt_data_not_decrypted (const char *passphrase)
return num_ok;
}
/*
* 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.
*
@@ -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;
}
+29
View File
@@ -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"
@@ -1024,6 +1026,24 @@ error:
return NULL;
}
/*
* 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".
*
@@ -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",