1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* plugin-script-config.c - configuration options, used by script plugins
*
* Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include "weechat-plugin.h"
#include "plugin-script.h"
/*
* Initializes script configuration.
*
* Returns:
* 1: OK
* 0: error
*/
int
plugin_script_config_init (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script_data *plugin_data)
{
struct t_config_section *ptr_section;
*(plugin_data->config_file) = weechat_config_new (weechat_plugin->name,
NULL, NULL, NULL);
if (!(*plugin_data->config_file))
return 0;
/* look */
ptr_section = weechat_config_new_section (*(plugin_data->config_file),
"look",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (*(plugin_data->config_file));
*(plugin_data->config_file) = NULL;
return 0;
}
*(plugin_data->config_look_check_license) = weechat_config_new_option (
*(plugin_data->config_file), ptr_section,
"check_license", "boolean",
N_("check the license of scripts when they are loaded: if the license "
"is different from the plugin license, a warning is displayed"),
NULL, 0, 0, "off", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
*(plugin_data->config_look_eval_keep_context) = weechat_config_new_option (
*(plugin_data->config_file), ptr_section,
"eval_keep_context", "boolean",
N_("keep context between two calls to the source code evaluation "
"(option \"eval\" of script command or info \"%s_eval\"); "
"a hidden script is used to eval script code; "
"if this option is disabled, this hidden script is unloaded after "
"each eval: this uses less memory, but is slower"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
|