1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

scripts: add configuration file for each script plugin

This commit is contained in:
Sébastien Helleu
2018-01-15 21:32:24 +01:00
parent ee79e11b15
commit 21e63e7958
113 changed files with 2032 additions and 354 deletions
+72
View File
@@ -0,0 +1,72 @@
/*
* 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 "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);
return 1;
}