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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user