1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 02:03:13 +02:00

Add null values for options, new syntax for /set, reintroduce temporary IRC server feature, improve IRC server options, new functions in API

This commit is contained in:
Sebastien Helleu
2009-01-02 23:05:23 +01:00
parent e9b7d2bc46
commit e7e2da5a9c
60 changed files with 4555 additions and 2881 deletions
+230 -123
View File
@@ -1352,15 +1352,33 @@ command_help (void *data, struct t_gui_buffer *buffer,
_("type"), _("boolean"));
gui_chat_printf (NULL, " %s: on, off",
_("values"));
gui_chat_printf (NULL, " %s: %s",
_("default value"),
(CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
gui_chat_printf (NULL, " %s: %s%s",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
(CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL, " %s: %s%s",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("current value"),
_("(undefined)"));
}
break;
case CONFIG_OPTION_TYPE_INTEGER:
if (ptr_option->string_values)
@@ -1390,15 +1408,34 @@ command_help (void *data, struct t_gui_buffer *buffer,
_("type"), _("string"));
gui_chat_printf (NULL, " %s: %s",
_("values"), string);
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
gui_chat_printf (NULL,
" %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
ptr_option->string_values[CONFIG_INTEGER(ptr_option)],
GUI_COLOR(GUI_COLOR_CHAT));
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL,
" %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
ptr_option->string_values[CONFIG_INTEGER(ptr_option)],
GUI_COLOR(GUI_COLOR_CHAT));
}
else
{
gui_chat_printf (NULL,
" %s: %s",
_("current value"),
_("(undefined)"));
}
free (string);
}
}
@@ -1409,13 +1446,31 @@ command_help (void *data, struct t_gui_buffer *buffer,
gui_chat_printf (NULL, " %s: %d .. %d",
_("values"),
ptr_option->min, ptr_option->max);
gui_chat_printf (NULL, " %s: %d",
_("default value"),
CONFIG_INTEGER_DEFAULT(ptr_option));
gui_chat_printf (NULL, " %s: %s%d",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_INTEGER(ptr_option));
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: %d",
_("default value"),
CONFIG_INTEGER_DEFAULT(ptr_option));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL, " %s: %s%d",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_INTEGER(ptr_option));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("current value"),
_("(undefined)"));
}
}
break;
case CONFIG_OPTION_TYPE_STRING:
@@ -1442,27 +1497,63 @@ command_help (void *data, struct t_gui_buffer *buffer,
ptr_option->max);
break;
}
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
CONFIG_STRING_DEFAULT(ptr_option));
gui_chat_printf (NULL, " %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_STRING(ptr_option),
GUI_COLOR(GUI_COLOR_CHAT));
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
CONFIG_STRING_DEFAULT(ptr_option));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL, " %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_STRING(ptr_option),
GUI_COLOR(GUI_COLOR_CHAT));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("current value"),
_("(undefined)"));
}
break;
case CONFIG_OPTION_TYPE_COLOR:
gui_chat_printf (NULL, " %s: %s",
_("type"), _("color"));
gui_chat_printf (NULL, " %s: %s",
_("values"), _("a color name"));
gui_chat_printf (NULL, " %s: %s",
_("default value"),
gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)));
gui_chat_printf (NULL, " %s: %s%s",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
gui_color_get_name (CONFIG_COLOR(ptr_option)));
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL, " %s: %s%s",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
gui_color_get_name (CONFIG_COLOR(ptr_option)));
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("current value"),
_("(undefined)"));
}
break;
case CONFIG_NUM_OPTION_TYPES:
break;
@@ -2634,23 +2725,12 @@ command_set_display_option (struct t_config_option *option,
const char *message)
{
const char *color_name;
switch (option->type)
if (option->value)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
break;
case CONFIG_OPTION_TYPE_INTEGER:
if (option->string_values)
{
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s",
(message) ? message : " ",
option->config_file->name,
@@ -2658,45 +2738,67 @@ command_set_display_option (struct t_config_option *option,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
option->string_values[CONFIG_INTEGER(option)]);
}
else
{
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%d",
(CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
break;
case CONFIG_OPTION_TYPE_INTEGER:
if (option->string_values)
{
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
option->string_values[CONFIG_INTEGER(option)]);
}
else
{
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%d",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_INTEGER(option));
}
break;
case CONFIG_OPTION_TYPE_STRING:
gui_chat_printf (NULL, "%s%s.%s.%s%s = \"%s%s%s\"",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_INTEGER(option));
}
break;
case CONFIG_OPTION_TYPE_STRING:
gui_chat_printf (NULL, "%s%s.%s.%s%s = \"%s%s%s\"",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(option->value) ? CONFIG_STRING(option) : "",
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
break;
case CONFIG_OPTION_TYPE_COLOR:
color_name = gui_color_get_name (CONFIG_COLOR(option));
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(color_name) ? color_name : _("(unknown)"));
break;
case CONFIG_NUM_OPTION_TYPES:
/* make C compiler happy */
break;
CONFIG_STRING(option),
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
break;
case CONFIG_OPTION_TYPE_COLOR:
color_name = gui_color_get_name (CONFIG_COLOR(option));
gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
(color_name) ? color_name : _("(unknown)"));
break;
case CONFIG_NUM_OPTION_TYPES:
/* make C compiler happy */
break;
}
}
else
{
gui_chat_printf (NULL, "%s%s.%s.%s",
(message) ? message : " ",
option->config_file->name,
option->section->name,
option->name);
}
}
@@ -2823,38 +2925,35 @@ command_set (void *data, struct t_gui_buffer *buffer,
}
/* set option value */
if ((argc >= 4) && (string_strcasecmp (argv[2], "=") == 0))
value =(string_strcasecmp (argv_eol[2], WEECHAT_CONFIG_OPTION_NULL) == 0) ?
NULL : string_remove_quotes (argv_eol[2], "'\"");
rc = config_file_option_set_with_string (argv[1], value);
if (value)
free (value);
switch (rc)
{
value = string_remove_quotes (argv_eol[3], "'\"");
rc = config_file_option_set_with_string (argv[1],
(value) ? value : argv_eol[3]);
if (value)
free (value);
switch (rc)
{
case WEECHAT_CONFIG_OPTION_SET_ERROR:
gui_chat_printf (NULL,
_("%sError: failed to set option \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_ERROR;
case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND:
gui_chat_printf (NULL,
_("%sError: configuration option \"%s\" not "
"found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_ERROR;
default:
config_file_search_with_string (argv[1], NULL, NULL,
&ptr_option, NULL);
if (ptr_option)
command_set_display_option (ptr_option,
_("Option changed: "));
else
gui_chat_printf (NULL, _("Option changed"));
break;
}
case WEECHAT_CONFIG_OPTION_SET_ERROR:
gui_chat_printf (NULL,
_("%sError: failed to set option \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_ERROR;
case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND:
gui_chat_printf (NULL,
_("%sError: configuration option \"%s\" not "
"found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
return WEECHAT_RC_ERROR;
default:
config_file_search_with_string (argv[1], NULL, NULL,
&ptr_option, NULL);
if (ptr_option)
command_set_display_option (ptr_option,
_("Option changed: "));
else
gui_chat_printf (NULL, _("Option changed"));
break;
}
return WEECHAT_RC_OK;
@@ -3659,10 +3758,18 @@ command_init ()
&command_save, NULL);
hook_command (NULL, "set",
N_("set config options"),
N_("[option [ = value]]"),
N_("[option [value]]"),
N_("option: name of an option\n"
" value: value for option"),
"%o = %v",
" value: new value for option\n\n"
"New value can be, according to variable type:\n"
" boolean: on, off ou toggle\n"
" integer: number, ++number ou --number"
" string : any string (\"\" for empty string)\n"
" color : color name, ++number ou --number\n\n"
"For all types, you can use null to remove "
"option value (undefined value). This works only "
"for some special plugin variables."),
"%o %v",
&command_set, NULL);
hook_command (NULL, "unset",
N_("unset/reset config options"),
+791 -511
View File
File diff suppressed because it is too large Load Diff
+12 -2
View File
@@ -119,6 +119,7 @@ struct t_config_option
int min, max; /* min and max for value */
void *default_value; /* default value */
void *value; /* value */
int null_value_allowed; /* null value allowed ? */
int (*callback_check_value) /* called to check value before */
(void *data, /* assiging new value */
struct t_config_option *option,
@@ -189,6 +190,7 @@ extern struct t_config_option *config_file_new_option (struct t_config_file *con
int min, int max,
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -219,18 +221,27 @@ extern int config_file_option_reset (struct t_config_option *option,
int run_callback);
extern int config_file_option_set (struct t_config_option *option,
const char *value, int run_callback);
extern int config_file_option_set_null (struct t_config_option *option,
int run_callback);
extern int config_file_option_unset (struct t_config_option *option);
extern void config_file_option_rename (struct t_config_option *option,
const char *new_name);
extern void *config_file_option_get_pointer (struct t_config_option *option,
const char *property);
extern int config_file_option_is_null (struct t_config_option *option);
extern int config_file_option_default_is_null (struct t_config_option *option);
extern int config_file_option_set_with_string (const char *option_name, const char *value);
extern int config_file_option_unset_with_string (const char *option_name);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_boolean_default (struct t_config_option *option);
extern int config_file_option_integer (struct t_config_option *option);
extern int config_file_option_integer_default (struct t_config_option *option);
extern const char *config_file_option_string (struct t_config_option *option);
extern const char *config_file_option_string_default (struct t_config_option *option);
extern const char *config_file_option_color (struct t_config_option *option);
extern const char *config_file_option_color_default (struct t_config_option *option);
extern void config_file_write_option (struct t_config_file *config_file,
struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...);
extern int config_file_write (struct t_config_file *config_files);
@@ -245,7 +256,6 @@ extern void config_file_free_all ();
extern void config_file_free_all_plugin (struct t_weechat_plugin *plugin);
extern int config_file_add_to_infolist (struct t_infolist *infolist,
const char *option_name);
extern void config_file_print_stdout (struct t_config_file *config_file);
extern void config_file_print_log ();
#endif /* wee-config-file.h */
+148 -148
View File
@@ -524,7 +524,7 @@ config_weechat_debug_create_option (void *data,
config_file, section,
option_name, "integer",
_("debug level for plugin (\"core\" for WeeChat core)"),
NULL, 0, 32, "0", value, NULL, NULL,
NULL, 0, 32, "0", value, 0, NULL, NULL,
&config_weechat_debug_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
@@ -578,13 +578,13 @@ config_weechat_debug_set (const char *plugin_name, const char *value)
}
/*
* config_weechat_proxy_read: read proxy option in config file
* config_weechat_proxy_read_cb: read proxy option in config file
*/
int
config_weechat_proxy_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *proxy_name;
struct t_proxy *ptr_temp_proxy;
@@ -647,13 +647,13 @@ config_weechat_proxy_read (void *data, struct t_config_file *config_file,
}
/*
* config_weechat_bar_read: read bar option in config file
* config_weechat_bar_read_cb: read bar option in config file
*/
int
config_weechat_bar_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
config_weechat_bar_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *bar_name;
struct t_gui_bar *ptr_temp_bar;
@@ -716,13 +716,13 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file,
}
/*
* config_weechat_layout_read: read layout option in config file
* config_weechat_layout_read_cb: read layout option in config file
*/
int
config_weechat_layout_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
int argc;
char **argv, *error1, *error2, *error3, *error4;
@@ -817,12 +817,12 @@ config_weechat_layout_write_tree (struct t_config_file *config_file,
}
/*
* config_weechat_layout_write: write layout section in configuration file
* config_weechat_layout_write_cb: write layout section in configuration file
*/
void
config_weechat_layout_write (void *data, struct t_config_file *config_file,
const char *section_name)
config_weechat_layout_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
@@ -845,14 +845,14 @@ config_weechat_layout_write (void *data, struct t_config_file *config_file,
}
/*
* config_weechat_filter_read: read filter option from config file
* config_weechat_filter_read_cb: read filter option from config file
*/
int
config_weechat_filter_read (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
config_weechat_filter_read_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
char **argv, **argv_eol;
int argc;
@@ -881,12 +881,12 @@ config_weechat_filter_read (void *data,
}
/*
* config_weechat_filter_write: write filter section in configuration file
* config_weechat_filter_write_cb: write filter section in configuration file
*/
void
config_weechat_filter_write (void *data, struct t_config_file *config_file,
const char *section_name)
config_weechat_filter_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_filter *ptr_filter;
@@ -909,13 +909,13 @@ config_weechat_filter_write (void *data, struct t_config_file *config_file,
}
/*
* config_weechat_key_read: read key option in config file
* config_weechat_key_read_cb: read key option in config file
*/
int
config_weechat_key_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
/* make C compiler happy */
(void) data;
@@ -940,12 +940,12 @@ config_weechat_key_read (void *data, struct t_config_file *config_file,
}
/*
* config_weechat_key_write: write key section in configuration file
* config_weechat_key_write_cb: write key section in configuration file
*/
void
config_weechat_key_write (void *data, struct t_config_file *config_file,
const char *section_name)
config_weechat_key_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_key *ptr_key;
char *expanded_name;
@@ -1013,27 +1013,27 @@ config_weechat_init ()
weechat_config_file, ptr_section,
"command_after_plugins", "string",
N_("command executed when WeeChat starts, after loading plugins"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_command_before_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"command_before_plugins", "string",
N_("command executed when WeeChat starts, before loading plugins"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_display_logo = config_file_new_option (
weechat_config_file, ptr_section,
"display_logo", "boolean",
N_("display WeeChat logo at startup"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_display_version = config_file_new_option (
weechat_config_file, ptr_section,
"display_version", "boolean",
N_("display WeeChat version at startup"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_weechat_slogan = config_file_new_option (
weechat_config_file, ptr_section,
"weechat_slogan", "string",
N_("WeeChat slogan (if empty, slogan is not used)"),
NULL, 0, 0, _("the geekiest chat client!"), NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, _("the geekiest chat client!"), NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* look */
ptr_section = config_file_new_section (weechat_config_file, "look",
@@ -1052,18 +1052,18 @@ config_weechat_init ()
N_("default notify level for buffers (used to tell WeeChat if buffer "
"must be displayed in hotlist or not, according to importance "
"of message)"),
"none|highlight|message|all", 0, 0, "all", NULL,
"none|highlight|message|all", 0, 0, "all", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
config_look_buffer_time_format = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_time_format", "string",
N_("time format for buffers"),
NULL, 0, 0, "%H:%M:%S", NULL, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL);
NULL, 0, 0, "%H:%M:%S", NULL, 0, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL);
config_look_color_nicks_number = config_file_new_option (
weechat_config_file, ptr_section,
"color_nicks_number", "integer",
N_("number of colors to use for nicks colors"),
NULL, 1, 10, "10", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 1, 10, "10", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_color_real_white = config_file_new_option (
weechat_config_file, ptr_section,
"color_real_white", "boolean",
@@ -1072,47 +1072,47 @@ config_weechat_init ()
"white background, you should turn on this option to "
"see real white instead of default term foreground "
"color)"),
NULL, 0, 0, "off", NULL, NULL, NULL, &config_change_color, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_look_day_change = config_file_new_option (
weechat_config_file, ptr_section,
"day_change", "boolean",
N_("display special message when day changes"),
NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_day_change, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_day_change, NULL, NULL, NULL);
config_look_day_change_time_format = config_file_new_option (
weechat_config_file, ptr_section,
"day_change_time_format", "string",
N_("time format for date displayed when day changed"),
NULL, 0, 0, "%a, %d %b %Y", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%a, %d %b %Y", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_highlight = config_file_new_option (
weechat_config_file, ptr_section,
"highlight", "string",
N_("comma separated list of words to highlight (case insensitive "
"comparison, words may begin or end with \"*\" for partial match)"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_hotlist_names_count = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_names_count", "integer",
N_("max number of names in hotlist (0 = no name "
"displayed, only buffer numbers)"),
NULL, 0, 32, "3", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
NULL, 0, 32, "3", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_hotlist_names_length = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_names_length", "integer",
N_("max length of names in hotlist (0 = no limit)"),
NULL, 0, 32, "0", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
NULL, 0, 32, "0", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_hotlist_names_level = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_names_level", "integer",
N_("level for displaying names in hotlist (combination "
"of: 1=join/part, 2=message, 4=private, 8=highlight, "
"for example: 12=private+highlight)"),
NULL, 1, 15, "12", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
NULL, 1, 15, "12", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_hotlist_short_names = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_short_names", "boolean",
N_("if set, uses short names to display buffer names in hotlist (start "
"after first '.' in name)"),
NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_hotlist_sort = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_sort", "integer",
@@ -1121,102 +1121,102 @@ config_weechat_init ()
"number_asc, number_desc)"),
"group_time_asc|group_time_desc|group_number_asc|"
"group_number_desc|number_asc|number_desc",
0, 0, "group_time_asc", NULL, NULL, NULL, &config_change_hotlist, NULL, NULL, NULL);
0, 0, "group_time_asc", NULL, 0, NULL, NULL, &config_change_hotlist, NULL, NULL, NULL);
config_look_item_time_format = config_file_new_option (
weechat_config_file, ptr_section,
"item_time_format", "string",
N_("time format for \"time\" bar item"),
NULL, 0, 0, "%H:%M", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%H:%M", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_nickmode = config_file_new_option (
weechat_config_file, ptr_section,
"nickmode", "boolean",
N_("display nick mode ((half)op/voice) before each nick"),
NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_nickmode_empty = config_file_new_option (
weechat_config_file, ptr_section,
"nickmode_empty", "boolean",
N_("display space if nick mode is not (half)op/voice"),
NULL, 0, 0, "off", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_paste_max_lines = config_file_new_option (
weechat_config_file, ptr_section,
"paste_max_lines", "integer",
N_("max number of lines for paste without asking user "
"(0 = disable this feature)"),
NULL, 0, INT_MAX, "3", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "3", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_error", "string",
N_("prefix for error messages"),
NULL, 0, 0, "=!=", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
NULL, 0, 0, "=!=", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
config_look_prefix[GUI_CHAT_PREFIX_NETWORK] = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_network", "string",
N_("prefix for network messages"),
NULL, 0, 0, "--", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
NULL, 0, 0, "--", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
config_look_prefix[GUI_CHAT_PREFIX_ACTION] = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_action", "string",
N_("prefix for action messages"),
NULL, 0, 0, " *", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
NULL, 0, 0, " *", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
config_look_prefix[GUI_CHAT_PREFIX_JOIN] = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_join", "string",
N_("prefix for join messages"),
NULL, 0, 0, "-->", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
NULL, 0, 0, "-->", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
config_look_prefix[GUI_CHAT_PREFIX_QUIT] = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_quit", "string",
N_("prefix for quit messages"),
NULL, 0, 0, "<--", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
NULL, 0, 0, "<--", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
config_look_prefix_align = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_align", "integer",
N_("prefix alignment (none, left, right (default))"),
"none|left|right", 0, 0, "right", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
"none|left|right", 0, 0, "right", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_prefix_align_max = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_align_max", "integer",
N_("max size for prefix (0 = no max size)"),
NULL, 0, 64, "0", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
NULL, 0, 64, "0", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_prefix_suffix = config_file_new_option (
weechat_config_file, ptr_section,
"prefix_suffix", "string",
N_("string displayed after prefix"),
NULL, 0, 0, "|", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
NULL, 0, 0, "|", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_read_marker = config_file_new_option (
weechat_config_file, ptr_section,
"read_marker", "integer",
N_("use a marker (line or char) on buffers to show first unread line"),
"none|line|dotted-line|char",
0, 0, "dotted-line", NULL, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL);
0, 0, "dotted-line", NULL, 0, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL);
config_look_save_config_on_exit = config_file_new_option (
weechat_config_file, ptr_section,
"save_config_on_exit", "boolean",
N_("save configuration file on exit"),
NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL);
config_look_save_layout_on_exit = config_file_new_option (
weechat_config_file, ptr_section,
"save_layout_on_exit", "integer",
N_("save layout on exit (buffers, windows, or both)"),
"none|buffers|windows|all", 0, 0, "all", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
"none|buffers|windows|all", 0, 0, "all", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_scroll_amount = config_file_new_option (
weechat_config_file, ptr_section,
"scroll_amount", "integer",
N_("how many lines to scroll by with scroll_up and "
"scroll_down"),
NULL, 1, INT_MAX, "3", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
NULL, 1, INT_MAX, "3", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_scroll_page_percent = config_file_new_option (
weechat_config_file, ptr_section,
"scroll_page_percent", "integer",
N_("percent of screen to scroll when scrolling one page up or down "
"(for example 100 means one page, 50 half-page)"),
NULL, 1, 100, "100", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 1, 100, "100", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_set_title = config_file_new_option (
weechat_config_file, ptr_section,
"set_title", "boolean",
N_("set title for window (terminal for Curses GUI) with "
"name and version"),
NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_title, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_title, NULL, NULL, NULL);
/* colors */
ptr_section = config_file_new_section (weechat_config_file, "color",
@@ -1234,343 +1234,343 @@ config_weechat_init ()
weechat_config_file, ptr_section,
"separator", "color",
N_("background color for window separators (when splitted)"),
NULL, GUI_COLOR_SEPARATOR, 0, "blue", NULL,
NULL, GUI_COLOR_SEPARATOR, 0, "blue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* bar colors */
config_color_bar_more = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more", "color",
N_("text color for '+' when scrolling bars"),
NULL, -1, 0, "lightmagenta", NULL,
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* chat window */
config_color_chat = config_file_new_option (
weechat_config_file, ptr_section,
"chat", "color",
N_("text color for chat"),
NULL, GUI_COLOR_CHAT, 0, "default", NULL,
NULL, GUI_COLOR_CHAT, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_bg = config_file_new_option (
weechat_config_file, ptr_section,
"chat_bg", "color",
N_("background color for chat"),
NULL, -1, 0, "default", NULL,
NULL, -1, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_time = config_file_new_option (
weechat_config_file, ptr_section,
"chat_time", "color",
N_("text color for time in chat window"),
NULL, GUI_COLOR_CHAT_TIME, 0, "default", NULL,
NULL, GUI_COLOR_CHAT_TIME, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_time_delimiters = config_file_new_option (
weechat_config_file, ptr_section,
"chat_time_delimiters", "color",
N_("text color for time delimiters"),
NULL, GUI_COLOR_CHAT_TIME_DELIMITERS, 0, "brown", NULL,
NULL, GUI_COLOR_CHAT_TIME_DELIMITERS, 0, "brown", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_error", "color",
N_("text color for error prefix"),
NULL, GUI_COLOR_CHAT_PREFIX_ERROR, 0, "yellow", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_ERROR, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_network", "color",
N_("text color for network prefix"),
NULL, GUI_COLOR_CHAT_PREFIX_NETWORK, 0, "magenta", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_NETWORK, 0, "magenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix[GUI_CHAT_PREFIX_ACTION] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_action", "color",
N_("text color for action prefix"),
NULL, GUI_COLOR_CHAT_PREFIX_ACTION, 0, "white", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_ACTION, 0, "white", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix[GUI_CHAT_PREFIX_JOIN] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_join", "color",
N_("text color for join prefix"),
NULL, GUI_COLOR_CHAT_PREFIX_JOIN, 0, "lightgreen", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_JOIN, 0, "lightgreen", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix[GUI_CHAT_PREFIX_QUIT] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_quit", "color",
N_("text color for quit prefix"),
NULL, GUI_COLOR_CHAT_PREFIX_QUIT, 0, "lightred", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_QUIT, 0, "lightred", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix_more = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_more", "color",
N_("text color for '+' when prefix is too long"),
NULL, GUI_COLOR_CHAT_PREFIX_MORE, 0, "lightmagenta", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_MORE, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_prefix_suffix = config_file_new_option (
weechat_config_file, ptr_section,
"chat_prefix_suffix", "color",
N_("text color for suffix (after prefix)"),
NULL, GUI_COLOR_CHAT_PREFIX_SUFFIX, 0, "green", NULL,
NULL, GUI_COLOR_CHAT_PREFIX_SUFFIX, 0, "green", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_buffer = config_file_new_option (
weechat_config_file, ptr_section,
"chat_buffer", "color",
N_("text color for buffer names"),
NULL, GUI_COLOR_CHAT_BUFFER, 0, "white", NULL,
NULL, GUI_COLOR_CHAT_BUFFER, 0, "white", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_server = config_file_new_option (
weechat_config_file, ptr_section,
"chat_server", "color",
N_("text color for server names"),
NULL, GUI_COLOR_CHAT_SERVER, 0, "brown", NULL,
NULL, GUI_COLOR_CHAT_SERVER, 0, "brown", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_channel = config_file_new_option (
weechat_config_file, ptr_section,
"chat_channel", "color",
N_("text color for channel names"),
NULL, GUI_COLOR_CHAT_CHANNEL, 0, "white", NULL,
NULL, GUI_COLOR_CHAT_CHANNEL, 0, "white", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick", "color",
N_("text color for nicks in chat window"),
NULL, GUI_COLOR_CHAT_NICK, 0, "lightcyan", NULL,
NULL, GUI_COLOR_CHAT_NICK, 0, "lightcyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_self = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_self", "color",
N_("text color for local nick in chat window"),
NULL, GUI_COLOR_CHAT_NICK_SELF, 0, "white", NULL,
NULL, GUI_COLOR_CHAT_NICK_SELF, 0, "white", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_other = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_other", "color",
N_("text color for other nick in private buffer"),
NULL, GUI_COLOR_CHAT_NICK_OTHER, 0, "cyan", NULL,
NULL, GUI_COLOR_CHAT_NICK_OTHER, 0, "cyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[0] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color01", "color",
N_("text color #1 for nick"),
NULL, GUI_COLOR_CHAT_NICK1, 0, "cyan", NULL,
NULL, GUI_COLOR_CHAT_NICK1, 0, "cyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[1] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color02", "color",
N_("text color #2 for nick"),
NULL, GUI_COLOR_CHAT_NICK2, 0, "magenta", NULL,
NULL, GUI_COLOR_CHAT_NICK2, 0, "magenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[2] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color03", "color",
N_("text color #3 for nick"),
NULL, GUI_COLOR_CHAT_NICK3, 0, "green", NULL,
NULL, GUI_COLOR_CHAT_NICK3, 0, "green", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[3] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color04", "color",
N_("text color #4 for nick"),
NULL, GUI_COLOR_CHAT_NICK4, 0, "brown", NULL,
NULL, GUI_COLOR_CHAT_NICK4, 0, "brown", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[4] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color05", "color",
N_("text color #5 for nick"),
NULL, GUI_COLOR_CHAT_NICK5, 0, "lightblue", NULL,
NULL, GUI_COLOR_CHAT_NICK5, 0, "lightblue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[5] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color06", "color",
N_("text color #6 for nick"),
NULL, GUI_COLOR_CHAT_NICK6, 0, "default", NULL,
NULL, GUI_COLOR_CHAT_NICK6, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[6] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color07", "color",
N_("text color #7 for nick"),
NULL, GUI_COLOR_CHAT_NICK7, 0, "lightcyan", NULL,
NULL, GUI_COLOR_CHAT_NICK7, 0, "lightcyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[7] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color08", "color",
N_("text color #8 for nick"),
NULL, GUI_COLOR_CHAT_NICK8, 0, "lightmagenta", NULL,
NULL, GUI_COLOR_CHAT_NICK8, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[8] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color09", "color",
N_("text color #9 for nick"),
NULL, GUI_COLOR_CHAT_NICK9, 0, "lightgreen", NULL,
NULL, GUI_COLOR_CHAT_NICK9, 0, "lightgreen", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_nick_colors[9] = config_file_new_option (
weechat_config_file, ptr_section,
"chat_nick_color10", "color",
N_("text color #10 for nick"),
NULL, GUI_COLOR_CHAT_NICK10, 0, "blue", NULL,
NULL, GUI_COLOR_CHAT_NICK10, 0, "blue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_host = config_file_new_option (
weechat_config_file, ptr_section,
"chat_host", "color",
N_("text color for hostnames"),
NULL, GUI_COLOR_CHAT_HOST, 0, "cyan", NULL,
NULL, GUI_COLOR_CHAT_HOST, 0, "cyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_delimiters = config_file_new_option (
weechat_config_file, ptr_section,
"chat_delimiters", "color",
N_("text color for delimiters"),
NULL, GUI_COLOR_CHAT_DELIMITERS, 0, "green", NULL,
NULL, GUI_COLOR_CHAT_DELIMITERS, 0, "green", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_highlight = config_file_new_option (
weechat_config_file, ptr_section,
"chat_highlight", "color",
N_("text color for highlighted prefix"),
NULL, GUI_COLOR_CHAT_HIGHLIGHT, 0, "yellow", NULL,
NULL, GUI_COLOR_CHAT_HIGHLIGHT, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_highlight_bg = config_file_new_option (
weechat_config_file, ptr_section,
"chat_highlight_bg", "color",
N_("background color for highlighted prefix"),
NULL, -1, 0, "magenta", NULL,
NULL, -1, 0, "magenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_read_marker = config_file_new_option (
weechat_config_file, ptr_section,
"chat_read_marker", "color",
N_("text color for unread data marker"),
NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "magenta", NULL,
NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "magenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_read_marker_bg = config_file_new_option (
weechat_config_file, ptr_section,
"chat_read_marker_bg", "color",
N_("background color for unread data marker"),
NULL, -1, 0, "default", NULL,
NULL, -1, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_text_found = config_file_new_option (
weechat_config_file, ptr_section,
"chat_text_found", "color",
N_("text color for marker on lines where text sought is found"),
NULL, GUI_COLOR_CHAT_TEXT_FOUND, 0, "yellow", NULL,
NULL, GUI_COLOR_CHAT_TEXT_FOUND, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_text_found_bg = config_file_new_option (
weechat_config_file, ptr_section,
"chat_text_found_bg", "color",
N_("background color for marker on lines where text sought is found"),
NULL, -1, 0, "lightmagenta", NULL,
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* status window */
config_color_status_number = config_file_new_option (
weechat_config_file, ptr_section,
"status_number", "color",
N_("text color for current buffer number in status bar"),
NULL, -1, 0, "yellow", NULL,
NULL, -1, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_name = config_file_new_option (
weechat_config_file, ptr_section,
"status_name", "color",
N_("text color for current buffer name in status bar"),
NULL, -1, 0, "white", NULL,
NULL, -1, 0, "white", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_data_msg = config_file_new_option (
weechat_config_file, ptr_section,
"status_data_msg", "color",
N_("text color for buffer with new messages (status bar)"),
NULL, -1, 0, "yellow", NULL,
NULL, -1, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_data_private = config_file_new_option (
weechat_config_file, ptr_section,
"status_data_private", "color",
N_("text color for buffer with private message (status bar)"),
NULL, -1, 0, "lightgreen", NULL,
NULL, -1, 0, "lightgreen", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_data_highlight = config_file_new_option (
weechat_config_file, ptr_section,
"status_data_highlight", "color",
N_("text color for buffer with highlight (status bar)"),
NULL, -1, 0, "lightmagenta", NULL,
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_data_other = config_file_new_option (
weechat_config_file, ptr_section,
"status_data_other", "color",
N_("text color for buffer with new data (not messages) "
"(status bar)"),
NULL, -1, 0, "default", NULL,
NULL, -1, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_status_more = config_file_new_option (
weechat_config_file, ptr_section,
"status_more", "color",
N_("text color for buffer with new data (status bar)"),
NULL, -1, 0, "yellow", NULL,
NULL, -1, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* input window */
config_color_input_nick = config_file_new_option (
weechat_config_file, ptr_section,
"input_nick", "color",
N_("text color for nick name in input line"),
NULL, -1, 0, "lightcyan", NULL,
NULL, -1, 0, "lightcyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_input_text_not_found = config_file_new_option (
weechat_config_file, ptr_section,
"input_text_not_found", "color",
N_("text color for unsucessful text search in input line"),
NULL, -1, 0, "red", NULL,
NULL, -1, 0, "red", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_input_actions = config_file_new_option (
weechat_config_file, ptr_section,
"input_actions", "color",
N_("text color for actions in input line"),
NULL, -1, 0, "lightgreen", NULL,
NULL, -1, 0, "lightgreen", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* nicklist window */
config_color_nicklist_group = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_group", "color",
N_("text color for groups in nicklist"),
NULL, -1, 0, "green", NULL,
NULL, -1, 0, "green", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_away = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_away", "color",
N_("text color for away nicknames"),
NULL, -1, 0, "cyan", NULL,
NULL, -1, 0, "cyan", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_prefix1 = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_prefix1", "color",
N_("text color for prefix #1 in nicklist"),
NULL, -1, 0, "lightgreen", NULL,
NULL, -1, 0, "lightgreen", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_prefix2 = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_prefix2", "color",
N_("text color for prefix #2 in nicklist"),
NULL, -1, 0, "lightmagenta", NULL,
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_prefix3 = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_prefix3", "color",
N_("text color for prefix #3 in nicklist"),
NULL, -1, 0, "yellow", NULL,
NULL, -1, 0, "yellow", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_prefix4 = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_prefix4", "color",
N_("text color for prefix #4 in nicklist"),
NULL, -1, 0, "blue", NULL,
NULL, -1, 0, "blue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_prefix5 = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_prefix5", "color",
N_("text color for prefix #5 in nicklist"),
NULL, -1, 0, "brown", NULL,
NULL, -1, 0, "brown", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_more = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_more", "color",
N_("text color for '+' when scrolling nicks in nicklist"),
NULL, -1, 0, "lightmagenta", NULL,
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_nicklist_separator = config_file_new_option (
weechat_config_file, ptr_section,
"nicklist_separator", "color",
N_("text color for nicklist separator"),
NULL, -1, 0, "blue", NULL,
NULL, -1, 0, "blue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
/* completion */
@@ -1588,45 +1588,45 @@ config_weechat_init ()
weechat_config_file, ptr_section,
"nick_completor", "string",
N_("string inserted after nick completion"),
NULL, 0, 0, ":", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, ":", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_first_only = config_file_new_option (
weechat_config_file, ptr_section,
"nick_first_only", "boolean",
N_("complete only with first nick found"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_ignore_chars = config_file_new_option (
weechat_config_file, ptr_section,
"nick_ignore_chars", "string",
N_("chars ignored for nick completion"),
NULL, 0, 0, "[]-^", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "[]-^", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_partial_completion_alert = config_file_new_option (
weechat_config_file, ptr_section,
"partial_completion_alert", "boolean",
N_("alert user when a partial completion occurs"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_partial_completion_nick = config_file_new_option (
weechat_config_file, ptr_section,
"partial_completion_nick", "boolean",
N_("partially complete nicks (stop when many nicks found begin with "
"same letters)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_partial_completion_command = config_file_new_option (
weechat_config_file, ptr_section,
"partial_completion_command", "boolean",
N_("partially complete command names (stop when many commands found "
"begin with same letters)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_partial_completion_command_arg = config_file_new_option (
weechat_config_file, ptr_section,
"partial_completion_command_arg", "boolean",
N_("partially complete command arguments (stop when many arguments "
"found begin with same prefix)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_partial_completion_count = config_file_new_option (
weechat_config_file, ptr_section,
"partial_completion_count", "boolean",
N_("display count for each partial completion in bar item"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* history */
ptr_section = config_file_new_section (weechat_config_file, "history",
@@ -1644,24 +1644,24 @@ config_weechat_init ()
"max_lines", "integer",
N_("maximum number of lines in history per buffer "
"(0 = unlimited)"),
NULL, 0, INT_MAX, "4096", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "4096", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_history_max_commands = config_file_new_option (
weechat_config_file, ptr_section,
"max_commands", "integer",
N_("maximum number of user commands in history (0 = "
"unlimited)"),
NULL, 0, INT_MAX, "100", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "100", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_history_display_default = config_file_new_option (
weechat_config_file, ptr_section,
"display_default", "integer",
N_("maximum number of commands to display by default in "
"history listing (0 = unlimited)"),
NULL, 0, INT_MAX, "5", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* proxies */
ptr_section = config_file_new_section (weechat_config_file, "proxy",
0, 0,
&config_weechat_proxy_read, NULL,
&config_weechat_proxy_read_cb, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
@@ -1690,13 +1690,13 @@ config_weechat_init ()
"at startup, \"*\" means all plugins found (names may "
"be partial, for example \"perl\" is ok for "
"\"perl.so\")"),
NULL, 0, 0, "*", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_plugin_debug = config_file_new_option (
weechat_config_file, ptr_section,
"debug", "boolean",
N_("enable debug messages by default in all plugins (option disabled "
"by default, which is highly recommended)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_plugin_extension = config_file_new_option (
weechat_config_file, ptr_section,
"extension", "string",
@@ -1708,23 +1708,23 @@ config_weechat_init ()
#else
".so",
#endif
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_plugin_path = config_file_new_option (
weechat_config_file, ptr_section,
"path", "string",
N_("path for searching plugins ('%h' will be replaced by "
"WeeChat home, ~/.weechat by default)"),
NULL, 0, 0, "%h/plugins", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%h/plugins", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_plugin_save_config_on_unload = config_file_new_option (
weechat_config_file, ptr_section,
"save_config_on_unload", "boolean",
N_("save configuration files when unloading plugins"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* bars */
ptr_section = config_file_new_section (weechat_config_file, "bar",
0, 0,
&config_weechat_bar_read, NULL,
&config_weechat_bar_read_cb, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
@@ -1738,8 +1738,8 @@ config_weechat_init ()
/* layout */
ptr_section = config_file_new_section (weechat_config_file, "layout",
0, 0,
&config_weechat_layout_read, NULL,
&config_weechat_layout_write, NULL,
&config_weechat_layout_read_cb, NULL,
&config_weechat_layout_write_cb, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
if (!ptr_section)
{
@@ -1750,9 +1750,9 @@ config_weechat_init ()
/* filters */
ptr_section = config_file_new_section (weechat_config_file, "filter",
0, 0,
&config_weechat_filter_read, NULL,
&config_weechat_filter_write, NULL,
&config_weechat_filter_write, NULL,
&config_weechat_filter_read_cb, NULL,
&config_weechat_filter_write_cb, NULL,
&config_weechat_filter_write_cb, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
@@ -1763,9 +1763,9 @@ config_weechat_init ()
/* keys */
ptr_section = config_file_new_section (weechat_config_file, "key",
0, 0,
&config_weechat_key_read, NULL,
&config_weechat_key_write, NULL,
&config_weechat_key_write, NULL,
&config_weechat_key_read_cb, NULL,
&config_weechat_key_write_cb, NULL,
&config_weechat_key_write_cb, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
+6 -6
View File
@@ -264,7 +264,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "integer",
N_("proxy type (http (default), socks4, socks5)"),
"http|socks4|socks5", 0, 0, value, NULL,
"http|socks4|socks5", 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_OPTION_IPV6:
@@ -272,7 +272,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "boolean",
N_("connect to proxy using ipv6"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_OPTION_ADDRESS:
@@ -280,7 +280,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "string",
N_("proxy server address (IP or hostname)"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_OPTION_PORT:
@@ -288,7 +288,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "integer",
N_("port for connecting to proxy server"),
NULL, 0, 65535, value, NULL,
NULL, 0, 65535, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_OPTION_USERNAME:
@@ -296,7 +296,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "string",
N_("username for proxy server"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_OPTION_PASSWORD:
@@ -304,7 +304,7 @@ proxy_create_option (const char *proxy_name, int index_option,
weechat_config_file, weechat_config_section_proxy,
option_name, "string",
N_("password for proxy server"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
case PROXY_NUM_OPTIONS:
+14 -14
View File
@@ -1300,7 +1300,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "boolean",
N_("true if bar is hidden, false if it is displayed"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_hidden, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_PRIORITY:
@@ -1308,7 +1308,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("bar priority (high number means bar displayed first)"),
NULL, 0, INT_MAX, value, NULL,
NULL, 0, INT_MAX, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_priority, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_TYPE:
@@ -1316,7 +1316,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("bar type (root, window, window_active, window_inactive)"),
"root|window|window_active|window_inactive", 0, 0, value, NULL,
"root|window|window_active|window_inactive", 0, 0, value, NULL, 0,
&gui_bar_config_check_type, NULL, NULL, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_CONDITIONS:
@@ -1325,7 +1325,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
option_name, "string",
N_("condition(s) for displaying bar (for bars of type "
"\"window\")"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_conditions, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_POSITION:
@@ -1333,7 +1333,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("bar position (bottom, top, left, right)"),
"bottom|top|left|right", 0, 0, value, NULL,
"bottom|top|left|right", 0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_position, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_FILLING_TOP_BOTTOM:
@@ -1344,7 +1344,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
"right) or \"vertical\" (from top to bottom)) when bar "
"position is top or bottom"),
"horizontal|vertical|columns_horizontal|columns_vertical",
0, 0, value, NULL,
0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_filling, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_FILLING_LEFT_RIGHT:
@@ -1355,7 +1355,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
"right) or \"vertical\" (from top to bottom)) when bar "
"position is left or right"),
"horizontal|vertical|columns_horizontal|columns_vertical",
0, 0, value, NULL,
0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_filling, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_SIZE:
@@ -1363,7 +1363,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("bar size in chars (0 = auto size)"),
NULL, 0, INT_MAX, value, NULL,
NULL, 0, INT_MAX, value, NULL, 0,
&gui_bar_config_check_size, NULL,
&gui_bar_config_change_size, NULL,
NULL, NULL);
@@ -1373,7 +1373,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("max bar size in chars (0 = no limit)"),
NULL, 0, INT_MAX, value, NULL,
NULL, 0, INT_MAX, value, NULL, 0,
NULL, NULL,
&gui_bar_config_change_size_max, NULL,
NULL, NULL);
@@ -1383,7 +1383,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "color",
N_("default text color for bar"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL,
&gui_bar_config_change_color, NULL,
NULL, NULL);
@@ -1393,7 +1393,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "color",
N_("default delimiter color for bar"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL,
&gui_bar_config_change_color, NULL,
NULL, NULL);
@@ -1403,7 +1403,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "color",
N_("default background color for bar"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL,
&gui_bar_config_change_color, NULL,
NULL, NULL);
@@ -1413,7 +1413,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "boolean",
N_("separator line between bar and other bars/windows"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_separator, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_ITEMS:
@@ -1421,7 +1421,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "string",
N_("items of bar"),
NULL, 0, 0, value, NULL,
NULL, 0, 0, value, NULL, 0,
NULL, NULL, &gui_bar_config_change_items, NULL, NULL, NULL);
break;
case GUI_BAR_NUM_OPTIONS:
+96 -44
View File
@@ -760,66 +760,101 @@ gui_completion_list_add_option_value (struct t_gui_completion *completion)
0, WEECHAT_LIST_POS_SORT);
gui_completion_list_add (completion, "toggle",
0, WEECHAT_LIST_POS_END);
if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE)
gui_completion_list_add (completion, "on",
0, WEECHAT_LIST_POS_BEGINNING);
if (option_found->value)
{
if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE)
gui_completion_list_add (completion, "on",
0, WEECHAT_LIST_POS_BEGINNING);
else
gui_completion_list_add (completion, "off",
0, WEECHAT_LIST_POS_BEGINNING);
}
else
gui_completion_list_add (completion, "off",
{
gui_completion_list_add (completion,
WEECHAT_CONFIG_OPTION_NULL,
0, WEECHAT_LIST_POS_BEGINNING);
}
break;
case CONFIG_OPTION_TYPE_INTEGER:
length = 64;
value_string = malloc (length);
if (value_string)
if (option_found->string_values)
{
if (option_found->string_values)
for (i = 0; option_found->string_values[i]; i++)
{
for (i = 0; option_found->string_values[i]; i++)
{
gui_completion_list_add (completion,
option_found->string_values[i],
0, WEECHAT_LIST_POS_SORT);
}
gui_completion_list_add (completion, "++1",
0, WEECHAT_LIST_POS_END);
gui_completion_list_add (completion, "--1",
0, WEECHAT_LIST_POS_END);
snprintf (value_string, length,
"%s",
option_found->string_values[CONFIG_INTEGER(option_found)]);
gui_completion_list_add (completion,
option_found->string_values[i],
0, WEECHAT_LIST_POS_SORT);
}
gui_completion_list_add (completion, "++1",
0, WEECHAT_LIST_POS_END);
gui_completion_list_add (completion, "--1",
0, WEECHAT_LIST_POS_END);
if (option_found->value)
{
gui_completion_list_add (completion,
option_found->string_values[CONFIG_INTEGER(option_found)],
0, WEECHAT_LIST_POS_BEGINNING);
}
else
{
if (CONFIG_INTEGER(option_found) > option_found->min)
gui_completion_list_add (completion, "--1",
0, WEECHAT_LIST_POS_BEGINNING);
if (CONFIG_INTEGER(option_found) < option_found->max)
gui_completion_list_add (completion, "++1",
0, WEECHAT_LIST_POS_BEGINNING);
snprintf (value_string, length,
"%d", CONFIG_INTEGER(option_found));
gui_completion_list_add (completion,
WEECHAT_CONFIG_OPTION_NULL,
0, WEECHAT_LIST_POS_BEGINNING);
}
}
else
{
if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min)
gui_completion_list_add (completion, "--1",
0, WEECHAT_LIST_POS_BEGINNING);
if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max)
gui_completion_list_add (completion, "++1",
0, WEECHAT_LIST_POS_BEGINNING);
if (option_found->value)
{
value_string = malloc (64);
if (value_string)
{
snprintf (value_string, length,
"%d", CONFIG_INTEGER(option_found));
gui_completion_list_add (completion,
value_string,
0, WEECHAT_LIST_POS_BEGINNING);
free (value_string);
}
}
else
{
gui_completion_list_add (completion,
WEECHAT_CONFIG_OPTION_NULL,
0, WEECHAT_LIST_POS_BEGINNING);
}
gui_completion_list_add (completion,
value_string,
0, WEECHAT_LIST_POS_BEGINNING);
free (value_string);
}
break;
case CONFIG_OPTION_TYPE_STRING:
gui_completion_list_add (completion,
"\"\"",
0, WEECHAT_LIST_POS_BEGINNING);
length = strlen (CONFIG_STRING(option_found)) + 2 + 1;
value_string = malloc (length);
if (value_string)
if (option_found->value)
{
length = strlen (CONFIG_STRING(option_found)) + 2 + 1;
value_string = malloc (length);
if (value_string)
{
snprintf (value_string, length,
"\"%s\"",
CONFIG_STRING(option_found));
gui_completion_list_add (completion,
value_string,
0, WEECHAT_LIST_POS_BEGINNING);
free (value_string);
}
}
else
{
snprintf (value_string, length,
"\"%s\"",
CONFIG_STRING(option_found));
gui_completion_list_add (completion,
value_string,
WEECHAT_CONFIG_OPTION_NULL,
0, WEECHAT_LIST_POS_BEGINNING);
free (value_string);
}
break;
case CONFIG_OPTION_TYPE_COLOR:
@@ -836,17 +871,34 @@ gui_completion_list_add_option_value (struct t_gui_completion *completion)
0, WEECHAT_LIST_POS_END);
gui_completion_list_add (completion, "--1",
0, WEECHAT_LIST_POS_END);
color_name = gui_color_get_name (CONFIG_INTEGER(option_found));
if (color_name)
if (option_found->value)
{
color_name = gui_color_get_name (CONFIG_INTEGER(option_found));
if (color_name)
{
gui_completion_list_add (completion,
color_name,
0, WEECHAT_LIST_POS_BEGINNING);
}
}
else
{
gui_completion_list_add (completion,
color_name,
WEECHAT_CONFIG_OPTION_NULL,
0, WEECHAT_LIST_POS_BEGINNING);
}
break;
case CONFIG_NUM_OPTION_TYPES:
break;
}
if (option_found->value
&& option_found->null_value_allowed)
{
gui_completion_list_add (completion,
WEECHAT_CONFIG_OPTION_NULL,
0,
WEECHAT_LIST_POS_END);
}
}
}
}
+4 -2
View File
@@ -631,7 +631,8 @@ alias_config_create_option (void *data, struct t_config_file *config_file,
weechat_config_new_option (
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, NULL, NULL,
NULL, 0, 0, "", value, 0,
NULL, NULL,
&alias_config_change_cb, NULL,
&alias_config_delete_cb, NULL);
@@ -750,7 +751,8 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_config_new_option (
alias_config_file, alias_config_section_cmd,
alias_name, "string", NULL,
NULL, 0, 0, "", argv_eol[2], NULL, NULL,
NULL, 0, 0, "", argv_eol[2], 0,
NULL, NULL,
&alias_config_change_cb, NULL,
&alias_config_delete_cb, NULL);
+7 -6
View File
@@ -191,7 +191,8 @@ weechat_aspell_config_dict_create_option (void *data,
config_file, section,
option_name, "string",
_("comma separated list of dictionaries to use on this buffer"),
NULL, 0, 0, "", value, NULL, NULL,
NULL, 0, 0, "", value, 0,
NULL, NULL,
&weechat_aspell_config_dict_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
@@ -272,7 +273,7 @@ weechat_aspell_config_init ()
weechat_aspell_config_file, ptr_section,
"color", "color",
N_("color used for mispelled words"),
NULL, 0, 0, "lightred", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* check */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
@@ -293,7 +294,7 @@ weechat_aspell_config_init ()
"enabled (spell checking is disabled for all other commands)"),
NULL, 0, 0,
"ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,"
"quit,topic", NULL,
"quit,topic", NULL, 0,
NULL, NULL, &weechat_aspell_config_change_commands, NULL, NULL, NULL);
weechat_aspell_config_check_default_dict = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
@@ -301,19 +302,19 @@ weechat_aspell_config_init ()
N_("default dictionary (or comma separated list of dictionaries) to "
"use when buffer has no dictionary defined (leave blank to disable "
"aspell on buffers for which you didn't explicitely enabled it)"),
NULL, 0, 0, "", NULL,
NULL, 0, 0, "", NULL, 0,
NULL, NULL, &weechat_aspell_config_change_default_dict, NULL, NULL, NULL);
weechat_aspell_config_check_word_min_length = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"word_min_length", "integer",
N_("minimum length for a word to be spell checked (use 0 to check all "
"words)"),
NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_check_during_search = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"during_search", "boolean",
N_("check words during text search in buffer"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* dict */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
+4 -3
View File
@@ -109,7 +109,8 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", value, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -163,13 +164,13 @@ charset_config_init ()
(charset_terminal && charset_internal
&& (strcasecmp (charset_terminal,
charset_internal) != 0)) ?
charset_terminal : "iso-8859-1", NULL,
charset_terminal : "iso-8859-1", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
charset_default_encode = weechat_config_new_option (
charset_config_file, ptr_section,
"encode", "string",
N_("global encoding charset"),
NULL, 0, 0, "", NULL,
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (charset_config_file, "decode",
+155 -228
View File
@@ -530,10 +530,8 @@ int
irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_irc_server server_tmp;
int i, nb_connect, connect_ok, all_servers, no_join, port, ipv6, ssl;
int default_ipv6, default_ssl;
char *error, value[16];
char *name, *error;
long number;
IRC_GET_SERVER(buffer);
@@ -606,65 +604,21 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
}
else
{
irc_server_init (&server_tmp);
default_ipv6 = server_tmp.ipv6;
default_ssl = server_tmp.ssl;
server_tmp.name = irc_server_get_name_without_port (argv[i]);
server_tmp.addresses = strdup (argv[i]);
server_tmp.ipv6 = ipv6;
server_tmp.ssl = ssl;
ptr_server = irc_server_new (server_tmp.name,
server_tmp.autoconnect,
server_tmp.autoreconnect,
server_tmp.autoreconnect_delay,
server_tmp.proxy,
server_tmp.addresses,
server_tmp.ipv6,
server_tmp.ssl,
server_tmp.password,
server_tmp.nicks,
server_tmp.username,
server_tmp.realname,
server_tmp.local_hostname,
server_tmp.command,
1, /* command_delay */
server_tmp.autojoin,
1); /* autorejoin */
name = irc_server_get_name_without_port (argv[i]);
ptr_server = irc_server_alloc ((name) ? name : argv[i]);
if (name)
free (name);
if (ptr_server)
{
ptr_server->temp_server = 1;
weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES],
argv[i], 1);
weechat_printf (NULL,
_("%s: server %s%s%s created"),
_("%s: server %s%s%s created (temporary server, NOT SAVED!)"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
server_tmp.name,
ptr_server->name,
IRC_COLOR_CHAT);
/* create server options */
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_ADDRESSES,
server_tmp.addresses);
if (default_ipv6 != server_tmp.ipv6)
{
snprintf (value, sizeof (value),
"%s",
(server_tmp.ipv6) ? "on" : "off");
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_IPV6,
value);
}
if (default_ssl != server_tmp.ssl)
{
snprintf (value, sizeof (value),
"%s",
(server_tmp.ssl) ? "on" : "off");
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_SSL,
value);
}
if (!irc_command_connect_one_server (ptr_server, 0))
connect_ok = 0;
}
@@ -2776,12 +2730,9 @@ int
irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
int i, detailed_list, one_server_found, length;
int default_autoconnect, default_ipv6, default_ssl;
struct t_irc_server server_tmp, *ptr_server2, *server_found, *new_server;
char *server_name, *mask, value[16], charset_modifier[256];
struct t_infolist *infolist;
struct t_config_option *ptr_option;
int i, detailed_list, one_server_found;
struct t_irc_server *ptr_server2, *server_found, *new_server;
char *server_name, charset_modifier[256];
IRC_GET_SERVER_CHANNEL(buffer);
@@ -2852,6 +2803,124 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "add") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server add");
}
if (irc_server_search (argv[2]))
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists, "
"can't create it!"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[2]);
return WEECHAT_RC_ERROR;
}
new_server = irc_server_alloc (argv[2]);
if (!new_server)
{
weechat_printf (NULL,
_("%s%s: unable to create server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES],
argv[3], 1);
/* parse arguments */
for (i = 4; i < argc; i++)
{
if (argv[i][0] == '-')
{
if (weechat_strcasecmp (argv[i], "-auto") == 0)
{
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT],
"on", 1);
}
if (weechat_strcasecmp (argv[i], "-noauto") == 0)
{
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT],
"off", 1);
}
if (weechat_strcasecmp (argv[i], "-ipv6") == 0)
{
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_IPV6],
"on", 1);
}
if (weechat_strcasecmp (argv[i], "-ssl") == 0)
{
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_SSL],
"on", 1);
}
}
}
weechat_printf (NULL,
_("%s: server %s%s%s created"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
new_server->name,
IRC_COLOR_CHAT);
if (IRC_SERVER_OPTION_BOOLEAN(new_server, IRC_SERVER_OPTION_AUTOCONNECT))
irc_server_connect (new_server, 0);
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "copy") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy");
}
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
{
weechat_printf (NULL,
_("%s%s: server \"%s\" not found for "
"\"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[2], "server copy");
return WEECHAT_RC_ERROR;
}
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists for "
"\"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[3], "server copy");
return WEECHAT_RC_ERROR;
}
/* copy server */
new_server = irc_server_copy (server_found, argv[3]);
if (new_server)
{
weechat_printf (NULL,
_("%s: server %s%s%s has been copied to "
"%s%s"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_SERVER,
argv[3]);
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;
}
if (weechat_strcasecmp (argv[1], "rename") == 0)
{
if (argc < 4)
@@ -2900,129 +2969,11 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_ERROR;
}
if (weechat_strcasecmp (argv[1], "add") == 0)
if (weechat_strcasecmp (argv[1], "keep") == 0)
{
if (argc < 4)
if (argc < 3)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server add");
}
if (irc_server_search (argv[2]))
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists, "
"can't create it!"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[2]);
return WEECHAT_RC_ERROR;
}
/* init server struct */
irc_server_init (&server_tmp);
default_autoconnect = server_tmp.autoconnect;
default_ipv6 = server_tmp.ipv6;
default_ssl = server_tmp.ssl;
server_tmp.name = strdup (argv[2]);
server_tmp.addresses = strdup (argv[3]);
/* parse arguments */
for (i = 4; i < argc; i++)
{
if (argv[i][0] == '-')
{
if (weechat_strcasecmp (argv[i], "-auto") == 0)
server_tmp.autoconnect = 1;
if (weechat_strcasecmp (argv[i], "-noauto") == 0)
server_tmp.autoconnect = 0;
if (weechat_strcasecmp (argv[i], "-ipv6") == 0)
server_tmp.ipv6 = 1;
if (weechat_strcasecmp (argv[i], "-ssl") == 0)
server_tmp.ssl = 1;
}
}
/* create new server */
new_server = irc_server_new (server_tmp.name,
server_tmp.autoconnect,
server_tmp.autoreconnect,
server_tmp.autoreconnect_delay,
server_tmp.proxy,
server_tmp.addresses,
server_tmp.ipv6,
server_tmp.ssl,
server_tmp.password,
server_tmp.nicks,
server_tmp.username,
server_tmp.realname,
server_tmp.local_hostname,
server_tmp.command,
1, /* command_delay */
server_tmp.autojoin,
1); /* autorejoin */
if (new_server)
{
weechat_printf (NULL,
_("%s: server %s%s%s created"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
server_tmp.name,
IRC_COLOR_CHAT);
/* create server options */
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_ADDRESSES,
server_tmp.addresses);
if (default_autoconnect != server_tmp.autoconnect)
{
snprintf (value, sizeof (value),
"%s",
(server_tmp.autoconnect) ? "on" : "off");
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_AUTOCONNECT,
value);
}
if (default_ipv6 != server_tmp.ipv6)
{
snprintf (value, sizeof (value),
"%s",
(server_tmp.ipv6) ? "on" : "off");
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_IPV6,
value);
}
if (default_ssl != server_tmp.ssl)
{
snprintf (value, sizeof (value),
"%s",
(server_tmp.ssl) ? "on" : "off");
irc_server_new_option (&server_tmp,
IRC_CONFIG_SERVER_SSL,
value);
}
}
else
{
weechat_printf (NULL,
_("%s%s: unable to create server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
irc_server_free_data (&server_tmp);
return WEECHAT_RC_ERROR;
}
if (new_server->autoconnect)
irc_server_connect (new_server, 0);
irc_server_free_data (&server_tmp);
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "copy") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy");
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server keep");
}
/* look for server by name */
@@ -3033,38 +2984,31 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
_("%s%s: server \"%s\" not found for "
"\"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[2], "server copy");
argv[2], "server keep");
return WEECHAT_RC_ERROR;
}
/* check if target name already exists */
if (irc_server_search (argv[3]))
/* check that is it temporary server */
if (!server_found->temp_server)
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists for "
"\"%s\" command"),
_("%s%s: server \"%s\" is not a temporary server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[3], "server copy");
argv[2], "server keep");
return WEECHAT_RC_ERROR;
}
/* duplicate server */
new_server = irc_server_duplicate (server_found, argv[3]);
if (new_server)
{
weechat_printf (NULL,
_("%s: server %s%s%s has been copied to "
"%s%s"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_SERVER,
argv[3]);
return WEECHAT_RC_OK;
}
/* remove temporary flag on server */
server_found->temp_server = 0;
return WEECHAT_RC_ERROR;
weechat_printf (NULL,
_("%s: server %s%s%s is not temporary any more"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_CHAT);
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "del") == 0)
@@ -3097,27 +3041,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
}
server_name = strdup (server_found->name);
/* remove all options (server will be removed when last option is removed) */
length = 32 + strlen (server_found->name) + 1;
mask = malloc (length);
if (mask)
{
snprintf (mask, length, "irc.server.%s.*", server_found->name);
infolist = weechat_infolist_get ("option", NULL, mask);
free (mask);
while (weechat_infolist_next (infolist))
{
weechat_config_search_with_string (weechat_infolist_string (infolist,
"full_name"),
NULL, NULL, &ptr_option,
NULL);
if (ptr_option)
weechat_config_option_unset (ptr_option);
}
weechat_infolist_free (infolist);
}
irc_server_free (server_found);
weechat_printf (NULL,
_("%s: Server %s%s%s has been deleted"),
IRC_PLUGIN_NAME,
@@ -4114,7 +4038,8 @@ irc_command_init ()
"[-auto | -noauto] [-ipv6] [-ssl]] | "
"[copy servername newservername] | "
"[rename servername newservername] | "
"[del servername] | [deloutq] | [switch]"),
"[keep servername] | [del servername] | "
"[deloutq] | [switch]"),
N_(" list: list servers (no parameter implies "
"this list)\n"
" listfull: list servers with detailed info for "
@@ -4132,6 +4057,8 @@ irc_command_init ()
" ssl: use SSL protocol\n"
" copy: duplicate a server\n"
" rename: rename a server\n"
" keep: keep server in config file (for "
"temporary servers only)\n"
" del: delete a server\n"
" deloutq: delete messages out queue for all "
"servers (all messages WeeChat is currently "
@@ -4150,7 +4077,7 @@ irc_command_init ()
" /server del freenode\n"
" /server deloutq\n"
" /server switch"),
"add|copy|rename|del|deloutq|list|listfull|switch "
"add|copy|rename|keep|del|deloutq|list|listfull|switch "
"%(irc_servers) %(irc_servers)",
&irc_command_server, NULL);
weechat_hook_command ("servlist",
File diff suppressed because it is too large Load Diff
+4 -29
View File
@@ -26,29 +26,6 @@
#define IRC_CONFIG_DISPLAY_AWAY_LOCAL 1
#define IRC_CONFIG_DISPLAY_AWAY_CHANNEL 2
enum t_irc_config_server_option
{
IRC_CONFIG_SERVER_AUTOCONNECT = 0,
IRC_CONFIG_SERVER_AUTORECONNECT,
IRC_CONFIG_SERVER_AUTORECONNECT_DELAY,
IRC_CONFIG_SERVER_PROXY,
IRC_CONFIG_SERVER_ADDRESSES,
IRC_CONFIG_SERVER_IPV6,
IRC_CONFIG_SERVER_SSL,
IRC_CONFIG_SERVER_PASSWORD,
IRC_CONFIG_SERVER_NICKS,
IRC_CONFIG_SERVER_USERNAME,
IRC_CONFIG_SERVER_REALNAME,
IRC_CONFIG_SERVER_LOCAL_HOSTNAME,
IRC_CONFIG_SERVER_COMMAND,
IRC_CONFIG_SERVER_COMMAND_DELAY,
IRC_CONFIG_SERVER_AUTOJOIN,
IRC_CONFIG_SERVER_AUTOREJOIN,
IRC_CONFIG_SERVER_NOTIFY_LEVELS,
/* number of server options */
IRC_CONFIG_NUM_SERVER_OPTIONS,
};
#define IRC_CONFIG_SERVER_DEFAULT_AUTOCONNECT 0
#define IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT 1
#define IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT_DELAY 30
@@ -58,7 +35,6 @@ enum t_irc_config_server_option
#define IRC_CONFIG_SERVER_DEFAULT_AUTOREJOIN 0
extern char *irc_config_server_option_string[];
extern struct t_config_file *irc_config_file;
extern struct t_config_section *irc_config_section_server_default;
extern struct t_config_section *irc_config_section_server;
@@ -96,7 +72,6 @@ extern struct t_config_option *irc_config_network_send_unknown_commands;
extern struct t_config_option *irc_config_server_default[];
extern int irc_config_search_server_option (const char *option_name);
extern void irc_config_server_change_cb (void *data,
struct t_config_option *option);
extern void irc_config_server_delete_cb (void *data,
@@ -105,14 +80,14 @@ struct t_config_option *irc_config_server_new_option (struct t_config_file *conf
struct t_config_section *section,
int index_option,
const char *option_name,
const char *default_value,
const char *value,
int null_value_allowed,
void *callback_change,
void *callback_change_data,
void *callback_delete,
void *callback_delete_data);
void *callback_change_data);
extern int irc_config_init ();
extern int irc_config_read ();
extern int irc_config_write ();
extern int irc_config_write (int write_temp_servers);
extern void irc_config_free ();
#endif /* irc-config.h */
+144 -53
View File
@@ -152,11 +152,11 @@ irc_display_server (struct t_irc_server *server, int with_detail)
{
char *string;
int num_channels, num_pv;
if (with_detail)
{
weechat_printf (NULL, "");
weechat_printf (NULL, _("%sServer: %s%s %s[%s%s%s]"),
weechat_printf (NULL, _("%sServer: %s%s %s[%s%s%s]%s%s"),
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_SERVER,
server->name,
@@ -164,61 +164,150 @@ irc_display_server (struct t_irc_server *server, int with_detail)
IRC_COLOR_CHAT,
(server->is_connected) ?
_("connected") : _("not connected"),
IRC_COLOR_CHAT_DELIMITERS);
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT,
(server->temp_server) ? _(" (temporary)") : "");
weechat_printf (NULL, " autoconnect . . . . : %s",
(server->autoconnect) ? _("on") : _("off"));
weechat_printf (NULL, " autoreconnect . . . : %s",
(server->autoreconnect) ? _("on") : _("off"));
weechat_printf (NULL, " autoreconnect_delay : %d %s",
server->autoreconnect_delay,
NG_("second", "seconds", server->autoreconnect_delay));
weechat_printf (NULL, " addresses . . . . . : %s",
(server->addresses && server->addresses[0]) ?
server->addresses : "");
weechat_printf (NULL, " ipv6 . . . . . . . : %s",
(server->ipv6) ? _("on") : _("off"));
weechat_printf (NULL, " ssl . . . . . . . . : %s",
(server->ssl) ? _("on") : _("off"));
weechat_printf (NULL, " password . . . . . : %s",
(server->password && server->password[0]) ?
_("(hidden)") : "");
weechat_printf (NULL, " nicks . . . . . . . : %s",
(server->nicks && server->nicks[0]) ?
server->nicks : "");
weechat_printf (NULL, " username . . . . . : %s",
(server->username && server->username[0]) ?
server->username : "");
weechat_printf (NULL, " realname . . . . . : %s",
(server->realname && server->realname[0]) ?
server->realname : "");
weechat_printf (NULL, " local_hostname . . : %s",
(server->local_hostname && server->local_hostname[0]) ?
server->local_hostname : "");
if (server->command && server->command[0])
string = strdup (server->command);
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_ADDRESSES]))
weechat_printf (NULL, " addresses. . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_ADDRESSES));
else
string = NULL;
if (string)
weechat_printf (NULL, " addresses. . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_ADDRESSES]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PROXY]))
weechat_printf (NULL, " proxy. . . . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY));
else
weechat_printf (NULL, " proxy. . . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_PROXY]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_IPV6]))
weechat_printf (NULL, " ipv6 . . . . . . . . : (%s)",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ?
_("on") : _("off"));
else
weechat_printf (NULL, " ipv6 . . . . . . . . : %s%s",
IRC_COLOR_CHAT_HOST,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_IPV6]) ?
_("on") : _("off"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL]))
weechat_printf (NULL, " ssl. . . . . . . . . : (%s)",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
_("on") : _("off"));
else
weechat_printf (NULL, " ssl. . . . . . . . . : %s%s",
IRC_COLOR_CHAT_HOST,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL]) ?
_("on") : _("off"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PASSWORD]))
weechat_printf (NULL, " password . . . . . . : %s",
_("(hidden)"));
else
weechat_printf (NULL, " password . . . . . . : %s%s",
IRC_COLOR_CHAT_HOST,
_("(hidden)"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOCONNECT]))
weechat_printf (NULL, " autoconnect. . . . . : (%s)",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOCONNECT)) ?
_("on") : _("off"));
else
weechat_printf (NULL, " autoconnect. . . . . : %s%s",
IRC_COLOR_CHAT_HOST,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOCONNECT]) ?
_("on") : _("off"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT]))
weechat_printf (NULL, " autoreconnect. . . . : (%s)",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT)) ?
_("on") : _("off"));
else
weechat_printf (NULL, " autoreconnect. . . . : %s%s",
IRC_COLOR_CHAT_HOST,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTORECONNECT]) ?
_("on") : _("off"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY]))
weechat_printf (NULL, " autoreconnect_delay. : (%d %s)",
IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY),
NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY)));
else
weechat_printf (NULL, " autoreconnect_delay. : %s%d %s",
IRC_COLOR_CHAT_HOST,
weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY]),
NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_NICKS]))
weechat_printf (NULL, " nicks. . . . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NICKS));
else
weechat_printf (NULL, " nicks. . . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_NICKS]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_USERNAME]))
weechat_printf (NULL, " username . . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME));
else
weechat_printf (NULL, " username . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_USERNAME]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_REALNAME]))
weechat_printf (NULL, " realname . . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME));
else
weechat_printf (NULL, " realname . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_REALNAME]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME]))
weechat_printf (NULL, " local_hostname . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME));
else
weechat_printf (NULL, " local_hostname . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND]))
{
if (weechat_config_boolean (irc_config_look_hide_nickserv_pwd))
string = strdup (IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND));
if (string && weechat_config_boolean (irc_config_look_hide_nickserv_pwd))
irc_display_hide_password (string, 1);
weechat_printf (NULL, " command . . . . . . : %s",
string);
free (string);
weechat_printf (NULL, " command. . . . . . . : ('%s')",
(string) ? string : IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND));
if (string)
free (string);
}
else
{
weechat_printf (NULL, " command . . . . . . : %s",
(server->command && server->command[0]) ?
server->command : "");
string = strdup (weechat_config_string (server->options[IRC_SERVER_OPTION_COMMAND]));
if (string && weechat_config_boolean (irc_config_look_hide_nickserv_pwd))
irc_display_hide_password (string, 1);
weechat_printf (NULL, " command. . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
(string) ? string : weechat_config_string (server->options[IRC_SERVER_OPTION_COMMAND]));
if (string)
free (string);
}
weechat_printf (NULL, " command_delay . . . : %d %s",
server->command_delay,
NG_("second", "seconds", server->command_delay));
weechat_printf (NULL, " autojoin . . . . . : %s",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]))
weechat_printf (NULL, " command_delay. . . . : (%d %s)",
IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY),
NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY)));
else
weechat_printf (NULL, " command_delay. . . . : %s%d %s",
IRC_COLOR_CHAT_HOST,
weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]),
NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY])));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOJOIN]))
weechat_printf (NULL, " autojoin . . . . . . : ('%s')",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN));
else
weechat_printf (NULL, " autojoin . . . . . . : %s'%s'",
IRC_COLOR_CHAT_HOST,
weechat_config_string (server->options[IRC_SERVER_OPTION_AUTOJOIN]));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOREJOIN]))
weechat_printf (NULL, " autorejoin . . . . . : (%s)",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN)) ?
_("on") : _("off"));
else
weechat_printf (NULL, " autorejoin . . . . . : %s%s",
IRC_COLOR_CHAT_HOST,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOREJOIN]) ?
_("on") : _("off"));
}
else
{
@@ -226,7 +315,7 @@ irc_display_server (struct t_irc_server *server, int with_detail)
{
num_channels = irc_server_get_channel_count (server);
num_pv = irc_server_get_pv_count (server);
weechat_printf (NULL, " %s %s%s %s[%s%s%s]%s, %d %s, %d pv",
weechat_printf (NULL, " %s %s%s %s[%s%s%s]%s%s, %d %s, %d pv",
(server->is_connected) ? "*" : " ",
IRC_COLOR_CHAT_SERVER,
server->name,
@@ -236,16 +325,18 @@ irc_display_server (struct t_irc_server *server, int with_detail)
_("connected") : _("not connected"),
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT,
(server->temp_server) ? _(" (temporary)") : "",
num_channels,
NG_("channel", "channels", num_channels),
num_pv);
}
else
{
weechat_printf (NULL, " %s %s%s",
(server->is_connected) ? "*" : " ",
weechat_printf (NULL, " %s%s%s%s",
IRC_COLOR_CHAT_SERVER,
server->name);
server->name,
IRC_COLOR_CHAT,
(server->temp_server) ? _(" (temporary)") : "");
}
}
}
+10 -6
View File
@@ -456,7 +456,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
/* my nick was kicked => free all nicks, channel is not active any
more */
irc_nick_free_all (ptr_channel);
if (server->autorejoin)
if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN))
irc_command_join_server (server, ptr_channel->name);
}
else
@@ -1589,7 +1589,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
weechat_infolist_new_var_string (item, "local_nick", server->nick);
weechat_infolist_new_var_string (item, "filename", pos_file);
weechat_infolist_new_var_string (item, "size", pos_size);
weechat_infolist_new_var_string (item, "proxy", server->proxy);
weechat_infolist_new_var_string (item, "proxy",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY));
weechat_infolist_new_var_string (item, "address", pos_addr);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
weechat_hook_signal_send ("xfer_add",
@@ -1922,7 +1923,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
weechat_infolist_new_var_string (item, "type", "chat_recv");
weechat_infolist_new_var_string (item, "remote_nick", nick);
weechat_infolist_new_var_string (item, "local_nick", server->nick);
weechat_infolist_new_var_string (item, "proxy", server->proxy);
weechat_infolist_new_var_string (item, "proxy",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY));
weechat_infolist_new_var_string (item, "address", pos_addr);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
weechat_hook_signal_send ("xfer_add",
@@ -2382,6 +2384,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
{
char **commands, **ptr_cmd, *vars_replaced;
char *away_msg;
const char *ptr_command;
/* 001 message looks like:
:server 001 mynick :Welcome to the dancer-ircd Network
@@ -2416,10 +2419,11 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
WEECHAT_HOOK_SIGNAL_STRING, server->name);
/* execute command when connected */
if (server->command && server->command[0])
ptr_command = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND);
if (ptr_command && ptr_command[0])
{
/* splitting command on ';' which can be escaped with '\;' */
commands = weechat_string_split_command (server->command, ';');
commands = weechat_string_split_command (ptr_command, ';');
if (commands)
{
for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++)
@@ -2434,7 +2438,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
weechat_string_free_splitted_command (commands);
}
if (server->command_delay > 0)
if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY) > 0)
server->command_time = time (NULL) + 1;
else
irc_server_autojoin_channels (server);
File diff suppressed because it is too large Load Diff
+52 -27
View File
@@ -31,6 +31,49 @@
#define NI_MAXHOST 256
#endif
enum t_irc_server_option
{
IRC_SERVER_OPTION_ADDRESSES = 0,
IRC_SERVER_OPTION_PROXY,
IRC_SERVER_OPTION_IPV6,
IRC_SERVER_OPTION_SSL,
IRC_SERVER_OPTION_PASSWORD,
IRC_SERVER_OPTION_AUTOCONNECT,
IRC_SERVER_OPTION_AUTORECONNECT,
IRC_SERVER_OPTION_AUTORECONNECT_DELAY,
IRC_SERVER_OPTION_NICKS,
IRC_SERVER_OPTION_USERNAME,
IRC_SERVER_OPTION_REALNAME,
IRC_SERVER_OPTION_LOCAL_HOSTNAME,
IRC_SERVER_OPTION_COMMAND,
IRC_SERVER_OPTION_COMMAND_DELAY,
IRC_SERVER_OPTION_AUTOJOIN,
IRC_SERVER_OPTION_AUTOREJOIN,
/* number of server options */
IRC_SERVER_NUM_OPTIONS,
};
#define IRC_SERVER_OPTION_BOOLEAN(__server, __index) \
((!weechat_config_option_is_null (__server->options[__index])) ? \
weechat_config_boolean(__server->options[__index]) : \
((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \
weechat_config_boolean(irc_config_server_default[__index]) \
: weechat_config_boolean_default(irc_config_server_default[__index])))
#define IRC_SERVER_OPTION_INTEGER(__server, __index) \
((!weechat_config_option_is_null (__server->options[__index])) ? \
weechat_config_integer(__server->options[__index]) : \
((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \
weechat_config_integer(irc_config_server_default[__index]) \
: weechat_config_integer_default(irc_config_server_default[__index])))
#define IRC_SERVER_OPTION_STRING(__server, __index) \
((!weechat_config_option_is_null (__server->options[__index])) ? \
weechat_config_string(__server->options[__index]) : \
((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \
weechat_config_string(irc_config_server_default[__index]) \
: weechat_config_string_default(irc_config_server_default[__index])))
#define IRC_SERVER_DEFAULT_PORT 6667
#define IRC_SERVER_DEFAULT_PREFIXES_LIST "@%+~&!-"
#define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3," \
@@ -59,25 +102,12 @@ struct t_irc_outqueue
struct t_irc_server
{
/* user choices */
char *name; /* internal name of server */
int autoconnect; /* = 1 if auto connect at startup */
int autoreconnect; /* = 1 if auto reco when disconnected */
int autoreconnect_delay; /* delay before trying again reconnect */
char *proxy; /* proxy used for this server (optional) */
char *addresses; /* server addresses (IP/name with port) */
int ipv6; /* use IPv6 protocol */
int ssl; /* SSL protocol */
char *password; /* password for server */
char *nicks; /* nicknames as one string */
char *username; /* user name */
char *realname; /* real name */
char *local_hostname; /* custom local hostname */
char *command; /* command to run once connected */
int command_delay; /* delay after execution of command */
char *autojoin; /* channels to automatically join */
int autorejoin; /* auto rejoin channels when kicked */
char *name; /* internal name of server */
struct t_config_option *options[IRC_SERVER_NUM_OPTIONS];
/* internal vars */
int temp_server; /* temporary server (not saved) */
int reloading_from_config; /* 1 if reloading from config file */
int reloaded_from_config; /* 1 if reloaded from config file */
int addresses_count; /* number of addresses */
char **addresses_array; /* exploded addresses */
@@ -138,21 +168,16 @@ extern const int gnutls_cert_type_prio[];
extern const int gnutls_prot_prio[];
#endif
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern char *irc_server_option_string[];
extern char *irc_server_option_default[];
extern int irc_server_valid (struct t_irc_server *server);
extern int irc_server_search_option (const char *option_name);
extern char *irc_server_get_name_without_port (const char *name);
extern void irc_server_new_option (struct t_irc_server *server,
int index_option,
const char *value);
extern void irc_server_set_addresses (struct t_irc_server *server,
const char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
extern void irc_server_set_with_option (struct t_irc_server *server,
int index_option,
struct t_config_option *option);
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
extern void irc_server_init (struct t_irc_server *server);
extern struct t_irc_server *irc_server_alloc (const char *name);
extern int irc_server_alloc_with_url (const char *irc_url);
extern void irc_server_free_all ();
@@ -172,8 +197,8 @@ extern struct t_irc_server *irc_server_new (const char *name, int autoconnect,
int command_delay,
const char *autojoin,
int autorejoin);
extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server,
const char *new_name);
extern struct t_irc_server *irc_server_copy (struct t_irc_server *server,
const char *new_name);
extern int irc_server_rename (struct t_irc_server *server, const char *new_name);
extern void irc_server_send_signal (struct t_irc_server *server,
const char *signal, const char *command,
+2
View File
@@ -184,6 +184,8 @@ irc_upgrade_read_cb (int object_id,
irc_upgrade_current_server = irc_server_search (weechat_infolist_string (infolist, "name"));
if (irc_upgrade_current_server)
{
irc_upgrade_current_server->temp_server =
weechat_infolist_integer (infolist, "temp_server");
irc_upgrade_current_server->buffer = NULL;
buffer_name = weechat_infolist_string (infolist, "buffer_name");
if (buffer_name && buffer_name[0])
+6 -2
View File
@@ -193,12 +193,16 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
if (irc_hook_timer_check_away)
weechat_unhook (irc_hook_timer_check_away);
irc_config_write ();
if (irc_signal_upgrade_received)
{
irc_config_write (1);
irc_upgrade_save ();
}
else
{
irc_config_write (0);
irc_server_disconnect_all ();
}
irc_server_free_all ();
+9 -9
View File
@@ -148,7 +148,7 @@ logger_config_level_create_option (void *data,
option_name, "integer",
_("logging level for this buffer (0 = logging disabled, "
"1 = a few messages (most important) .. 9 = all messages)"),
NULL, 0, 9, "9", value, NULL, NULL,
NULL, 0, 9, "9", value, 0, NULL, NULL,
&logger_config_level_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
@@ -275,7 +275,7 @@ logger_config_mask_create_option (void *data,
option_name, "string",
_("file mask for log file; local buffer variables are "
"permitted"),
NULL, 0, 0, "", value, NULL, NULL,
NULL, 0, 0, "", value, 0, NULL, NULL,
&logger_config_mask_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
@@ -339,7 +339,7 @@ logger_config_init ()
"backlog", "integer",
N_("maximum number of lines to display from log file when creating "
"new buffer (0 = no backlog)"),
NULL, 0, INT_MAX, "20", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "20", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* file */
ptr_section = weechat_config_new_section (logger_config_file, "file",
@@ -358,19 +358,19 @@ logger_config_init ()
"auto_log", "boolean",
N_("automatically save content of buffers to files (unless a buffer "
"disables log)"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_name_lower_case = weechat_config_new_option (
logger_config_file, ptr_section,
"name_lower_case", "boolean",
N_("use only lower case for log filenames"),
NULL, 0, 0, "on", NULL, NULL, NULL,
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_path = weechat_config_new_option (
logger_config_file, ptr_section,
"path", "string",
N_("path for WeeChat log files ('%h' will be replaced by WeeChat "
"home, ~/.weechat by default)"),
NULL, 0, 0, "%h/logs/", NULL, NULL, NULL,
NULL, 0, 0, "%h/logs/", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_mask = weechat_config_new_option (
logger_config_file, ptr_section,
@@ -378,20 +378,20 @@ logger_config_init ()
N_("default file name mask for log files (format is 'directory/to/file' "
"or 'file', without first '/' because 'path' option is used to "
"build complete path to file); local buffer variables are permitted"),
NULL, 0, 0, "$plugin.$name.weechatlog", NULL, NULL, NULL,
NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_info_lines = weechat_config_new_option (
logger_config_file, ptr_section,
"info_lines", "boolean",
N_("write information line in log file when log starts or ends for a "
"buffer"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_time_format = weechat_config_new_option (
logger_config_file, ptr_section,
"time_format", "string",
N_("timestamp used in log files (see man strftime for date/time "
"specifiers)"),
NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
/* level */
ptr_section = weechat_config_new_section (logger_config_file, "level",
+3 -3
View File
@@ -987,11 +987,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" disable logging for current buffer:\n"
" /logger disable\n\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" /set logger.level.irc 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" /set logger.level.core.weechat 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n\n"
" /set logger.mask.irc \"$server/$channel.weechatlog\"\n\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
+1 -1
View File
@@ -263,7 +263,7 @@ notify_config_create_option (void *data, struct t_config_file *config_file,
config_file, section,
option_name, "integer", NULL,
"none|highlight|message|all",
0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
+2 -2
View File
@@ -96,7 +96,7 @@ plugin_config_set_internal (const char *option, const char *value)
ptr_option = config_file_new_option (
plugin_config_file, plugin_config_section_var,
option, "string", NULL,
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -164,7 +164,7 @@ plugin_config_create_option (void *data, struct t_config_file *config_file,
ptr_option = config_file_new_option (
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
+7
View File
@@ -397,13 +397,20 @@ plugin_load (const char *filename)
new_plugin->config_string_to_boolean = &config_file_string_to_boolean;
new_plugin->config_option_reset = &config_file_option_reset;
new_plugin->config_option_set = &config_file_option_set;
new_plugin->config_option_set_null = &config_file_option_set_null;
new_plugin->config_option_unset = &config_file_option_unset;
new_plugin->config_option_rename = &config_file_option_rename;
new_plugin->config_option_get_pointer = &config_file_option_get_pointer;
new_plugin->config_option_is_null = &config_file_option_is_null;
new_plugin->config_boolean = &config_file_option_boolean;
new_plugin->config_boolean_default = &config_file_option_boolean_default;
new_plugin->config_integer = &config_file_option_integer;
new_plugin->config_integer_default = &config_file_option_integer_default;
new_plugin->config_string = &config_file_option_string;
new_plugin->config_string_default = &config_file_option_string_default;
new_plugin->config_color = &config_file_option_color;
new_plugin->config_color_default = &config_file_option_color_default;
new_plugin->config_write_option = &config_file_write_option;
new_plugin->config_write_line = &config_file_write_line;
new_plugin->config_write = &config_file_write;
new_plugin->config_read = &config_file_read;
+10 -10
View File
@@ -106,7 +106,7 @@ relay_config_init ()
relay_config_file, ptr_section,
"auto_open_buffer", "boolean",
N_("auto open relay buffer when a new client is connecting"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (relay_config_file, "color",
0, 0,
@@ -123,49 +123,49 @@ relay_config_init ()
relay_config_file, ptr_section,
"text", "color",
N_("text color"),
NULL, 0, 0, "default", NULL,
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_text_bg = weechat_config_new_option (
relay_config_file, ptr_section,
"text_bg", "color",
N_("background color"),
NULL, 0, 0, "default", NULL,
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_text_selected = weechat_config_new_option (
relay_config_file, ptr_section,
"text_selected", "color",
N_("text color of selected client line"),
NULL, 0, 0, "white", NULL,
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_connecting", "color",
N_("text color for \"connecting\" status"),
NULL, 0, 0, "yellow", NULL,
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_waiting_auth", "color",
N_("text color for \"waiting authentication\" status"),
NULL, 0, 0, "brown", NULL,
NULL, 0, 0, "brown", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_active", "color",
N_("text color for \"connected\" status"),
NULL, 0, 0, "lightblue", NULL,
NULL, 0, 0, "lightblue", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_auth_failed", "color",
N_("text color for \"authentication failed\" status"),
NULL, 0, 0, "lightred", NULL,
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_disconnected", "color",
N_("text color for \"disconnected\" status"),
NULL, 0, 0, "lightred", NULL,
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (relay_config_file, "network",
@@ -185,7 +185,7 @@ relay_config_init ()
N_("port number (or range of ports) that relay plugin listens on "
"(syntax: a single port, ie. 5000 or a port "
"range, ie. 5000-5015)"),
NULL, 0, 0, "22373-22400", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "22373-22400", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
+176 -17
View File
@@ -1461,7 +1461,7 @@ weechat_lua_api_config_new_option (lua_State *L)
const char *string_values, *default_value, *value;
const char *function_check_value, *function_change, *function_delete;
char *result;
int n, min, max;
int n, min, max, null_value_allowed;
/* make C compiler happy */
(void) L;
@@ -1482,28 +1482,30 @@ weechat_lua_api_config_new_option (lua_State *L)
max = 0;
default_value = NULL;
value = NULL;
null_value_allowed = 0;
function_check_value = NULL;
function_change = NULL;
function_delete = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 13)
if (n < 14)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
LUA_RETURN_EMPTY;
}
config_file = lua_tostring (lua_current_interpreter, -13);
section = lua_tostring (lua_current_interpreter, -12);
name = lua_tostring (lua_current_interpreter, -11);
type = lua_tostring (lua_current_interpreter, -10);
description = lua_tostring (lua_current_interpreter, -9);
string_values = lua_tostring (lua_current_interpreter, -8);
min = lua_tonumber (lua_current_interpreter, -7);
max = lua_tonumber (lua_current_interpreter, -6);
default_value = lua_tostring (lua_current_interpreter, -5);
value = lua_tostring (lua_current_interpreter, -4);
config_file = lua_tostring (lua_current_interpreter, -14);
section = lua_tostring (lua_current_interpreter, -13);
name = lua_tostring (lua_current_interpreter, -12);
type = lua_tostring (lua_current_interpreter, -11);
description = lua_tostring (lua_current_interpreter, -10);
string_values = lua_tostring (lua_current_interpreter, -9);
min = lua_tonumber (lua_current_interpreter, -8);
max = lua_tonumber (lua_current_interpreter, -7);
default_value = lua_tostring (lua_current_interpreter, -6);
value = lua_tostring (lua_current_interpreter, -5);
null_value_allowed = lua_tonumber (lua_current_interpreter, -4);
function_check_value = lua_tostring (lua_current_interpreter, -3);
function_change = lua_tostring (lua_current_interpreter, -2);
function_delete = lua_tostring (lua_current_interpreter, -1);
@@ -1520,6 +1522,7 @@ weechat_lua_api_config_new_option (lua_State *L)
max,
default_value,
value,
null_value_allowed,
&weechat_lua_api_config_option_check_value_cb,
function_check_value,
&weechat_lua_api_config_option_change_cb,
@@ -1664,7 +1667,7 @@ weechat_lua_api_config_option_set (lua_State *L)
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set");
LUA_RETURN_INT(0);
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = NULL;
@@ -1676,7 +1679,7 @@ weechat_lua_api_config_option_set (lua_State *L)
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
LUA_RETURN_INT(0);
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = lua_tostring (lua_current_interpreter, -3);
@@ -1690,6 +1693,46 @@ weechat_lua_api_config_option_set (lua_State *L)
LUA_RETURN_INT(rc);
}
/*
* weechat_lua_api_config_option_set_null: set null (undefined) value for
* option
*/
static int
weechat_lua_api_config_option_set_null (lua_State *L)
{
const char *option;
int n, run_callback, rc;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null");
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = NULL;
run_callback = 0;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
LUA_RETURN_INT(rc);
}
/*
* weechat_lua_api_config_option_unset: unset an option
*/
@@ -1706,7 +1749,7 @@ weechat_lua_api_config_option_unset (lua_State *L)
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
LUA_RETURN_INT(0);
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = NULL;
@@ -1716,7 +1759,7 @@ weechat_lua_api_config_option_unset (lua_State *L)
if (n < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
LUA_RETURN_INT(0);
LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = lua_tostring (lua_current_interpreter, -1);
@@ -1741,7 +1784,7 @@ weechat_lua_api_config_option_rename (lua_State *L)
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_rename");;
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_rename");
LUA_RETURN_ERROR;
}
@@ -1765,6 +1808,79 @@ weechat_lua_api_config_option_rename (lua_State *L)
LUA_RETURN_OK;
}
/*
* weechat_lua_api_config_option_is_null: return 1 if value of option is null
*/
static int
weechat_lua_api_config_option_is_null (lua_State *L)
{
const char *option;
int n, value;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null");
LUA_RETURN_INT(1);
}
option = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null");
LUA_RETURN_INT(1);
}
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_option_is_null (script_str2ptr (option));
LUA_RETURN_INT(value);
}
/*
* weechat_lua_api_config_option_default_is_null: return 1 if default value of
* option is null
*/
static int
weechat_lua_api_config_option_default_is_null (lua_State *L)
{
const char *option;
int n, value;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null");
LUA_RETURN_INT(1);
}
option = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null");
LUA_RETURN_INT(1);
}
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_option_default_is_null (script_str2ptr (option));
LUA_RETURN_INT(value);
}
/*
* weechat_lua_api_config_boolean: return boolean value of option
*/
@@ -1909,6 +2025,45 @@ weechat_lua_api_config_color (lua_State *L)
LUA_RETURN_STRING(result);
}
/*
* weechat_lua_api_config_write_option: write an option in configuration file
*/
static int
weechat_lua_api_config_write_option (lua_State *L)
{
const char *config_file, *option;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option");
LUA_RETURN_ERROR;
}
config_file = NULL;
option = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option");
LUA_RETURN_ERROR;
}
config_file = lua_tostring (lua_current_interpreter, -2);
option = lua_tostring (lua_current_interpreter, -1);
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
LUA_RETURN_OK;
}
/*
* weechat_lua_api_config_write_line: write a line in configuration file
*/
@@ -5880,12 +6035,16 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_string_to_boolean", &weechat_lua_api_config_string_to_boolean },
{ "config_option_reset", &weechat_lua_api_config_option_reset },
{ "config_option_set", &weechat_lua_api_config_option_set },
{ "config_option_set_null", &weechat_lua_api_config_option_set_null },
{ "config_option_unset", &weechat_lua_api_config_option_unset },
{ "config_option_rename", &weechat_lua_api_config_option_rename },
{ "config_option_is_null", &weechat_lua_api_config_option_is_null },
{ "config_option_default_is_null", &weechat_lua_api_config_option_default_is_null },
{ "config_boolean", &weechat_lua_api_config_boolean },
{ "config_integer", &weechat_lua_api_config_integer },
{ "config_string", &weechat_lua_api_config_string },
{ "config_color", &weechat_lua_api_config_color },
{ "config_write_option", &weechat_lua_api_config_write_option },
{ "config_write_line", &weechat_lua_api_config_write_line },
{ "config_write", &weechat_lua_api_config_write },
{ "config_read", &weechat_lua_api_config_read },
+136 -8
View File
@@ -1260,7 +1260,7 @@ static XS (XS_weechat_api_config_new_option)
PERL_RETURN_EMPTY;
}
if (items < 13)
if (items < 14)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
PERL_RETURN_EMPTY;
@@ -1274,9 +1274,9 @@ static XS (XS_weechat_api_config_new_option)
string_values = SvPV (ST (5), PL_na);
default_value = SvPV (ST (8), PL_na);
value = SvPV (ST (9), PL_na);
function_check_value = SvPV (ST (10), PL_na);
function_change = SvPV (ST (11), PL_na);
function_delete = SvPV (ST (12), PL_na);
function_check_value = SvPV (ST (11), PL_na);
function_change = SvPV (ST (12), PL_na);
function_delete = SvPV (ST (13), PL_na);
result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin,
perl_current_script,
script_str2ptr (config_file),
@@ -1289,6 +1289,7 @@ static XS (XS_weechat_api_config_new_option)
SvIV (ST (7)), /* max */
default_value,
value,
SvIV (ST (10)), /* null_value_allowed */
&weechat_perl_api_config_option_check_value_cb,
function_check_value,
&weechat_perl_api_config_option_change_cb,
@@ -1410,13 +1411,13 @@ static XS (XS_weechat_api_config_option_set)
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set");
PERL_RETURN_INT(0);
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
PERL_RETURN_INT(0);
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = SvPV (ST (0), PL_na);
@@ -1428,6 +1429,38 @@ static XS (XS_weechat_api_config_option_set)
PERL_RETURN_INT(rc);
}
/*
* weechat::config_option_set_null: set null (undefined) value for option
*/
static XS (XS_weechat_api_config_option_set_null)
{
int rc;
char *option;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null");
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = SvPV (ST (0), PL_na);
rc = weechat_config_option_set_null (script_str2ptr (option),
SvIV (ST (1))); /* run_callback */
PERL_RETURN_INT(rc);
}
/*
* weechat::config_option_unset: unset an option
*/
@@ -1444,13 +1477,13 @@ static XS (XS_weechat_api_config_option_unset)
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
PERL_RETURN_INT(0);
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
PERL_RETURN_INT(0);
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = SvPV (ST (0), PL_na);
@@ -1491,6 +1524,65 @@ static XS (XS_weechat_api_config_option_rename)
PERL_RETURN_OK;
}
/*
* weechat::config_option_is_null: return 1 if value of option is null
*/
static XS (XS_weechat_api_config_option_is_null)
{
int value;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null");
PERL_RETURN_INT(1);
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null");
PERL_RETURN_INT(1);
}
value = weechat_config_option_is_null (script_str2ptr (SvPV (ST (0), PL_na))); /* option */
PERL_RETURN_INT(value);
}
/*
* weechat::config_option_default_is_null: return 1 if default value of option
* is null
*/
static XS (XS_weechat_api_config_option_default_is_null)
{
int value;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null");
PERL_RETURN_INT(1);
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null");
PERL_RETURN_INT(1);
}
value = weechat_config_option_default_is_null (script_str2ptr (SvPV (ST (0), PL_na))); /* option */
PERL_RETURN_INT(value);
}
/*
* weechat::config_boolean: return boolean value of option
*/
@@ -1607,6 +1699,38 @@ static XS (XS_weechat_api_config_color)
PERL_RETURN_STRING(result);
}
/*
* weechat::config_write_option: write an option in configuration file
*/
static XS (XS_weechat_api_config_write_option)
{
char *config_file, *option;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option");
PERL_RETURN_ERROR;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option");
PERL_RETURN_ERROR;
}
config_file = SvPV (ST (0), PL_na);
option = SvPV (ST (1), PL_na);
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
PERL_RETURN_OK;
}
/*
* weechat::config_write_line: write a line in configuration file
*/
@@ -4624,12 +4748,16 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_string_to_boolean", XS_weechat_api_config_string_to_boolean, "weechat");
newXS ("weechat::config_option_reset", XS_weechat_api_config_option_reset, "weechat");
newXS ("weechat::config_option_set", XS_weechat_api_config_option_set, "weechat");
newXS ("weechat::config_option_set_null", XS_weechat_api_config_option_set_null, "weechat");
newXS ("weechat::config_option_unset", XS_weechat_api_config_option_unset, "weechat");
newXS ("weechat::config_option_rename", XS_weechat_api_config_option_rename, "weechat");
newXS ("weechat::config_option_is_null", XS_weechat_api_config_option_is_null, "weechat");
newXS ("weechat::config_option_default_is_null", XS_weechat_api_config_option_default_is_null, "weechat");
newXS ("weechat::config_boolean", XS_weechat_api_config_boolean, "weechat");
newXS ("weechat::config_integer", XS_weechat_api_config_integer, "weechat");
newXS ("weechat::config_string", XS_weechat_api_config_string, "weechat");
newXS ("weechat::config_color", XS_weechat_api_config_color, "weechat");
newXS ("weechat::config_write_option", XS_weechat_api_config_write_option, "weechat");
newXS ("weechat::config_write_line", XS_weechat_api_config_write_line, "weechat");
newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat");
newXS ("weechat::config_read", XS_weechat_api_config_read, "weechat");
+147 -8
View File
@@ -1316,7 +1316,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
char *config_file, *section, *name, *type, *description, *string_values;
char *default_value, *value, *result;
char *function_check_value, *function_change, *function_delete;
int min, max;
int min, max, null_value_allowed;
PyObject *object;
/* make C compiler happy */
@@ -1340,10 +1340,11 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
function_change = NULL;
function_delete = NULL;
if (!PyArg_ParseTuple (args, "ssssssiisssss", &config_file, &section, &name,
if (!PyArg_ParseTuple (args, "ssssssiississs", &config_file, &section, &name,
&type, &description, &string_values, &min, &max,
&default_value, &value, &function_check_value,
&function_change, &function_delete))
&default_value, &value, &null_value_allowed,
&function_check_value, &function_change,
&function_delete))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
PYTHON_RETURN_EMPTY;
@@ -1361,6 +1362,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
max,
default_value,
value,
null_value_allowed,
&weechat_python_api_config_option_check_value_cb,
function_check_value,
&weechat_python_api_config_option_change_cb,
@@ -1489,7 +1491,7 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set");
PYTHON_RETURN_INT(0);
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = NULL;
@@ -1499,7 +1501,7 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
PYTHON_RETURN_INT(0);
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
rc = weechat_config_option_set (script_str2ptr (option),
@@ -1509,6 +1511,41 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
PYTHON_RETURN_INT(rc);
}
/*
* weechat_python_api_config_option_set_null: set null (undefined) value for
* option
*/
static PyObject *
weechat_python_api_config_option_set_null (PyObject *self, PyObject *args)
{
char *option;
int run_callback, rc;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null");
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
PYTHON_RETURN_INT(rc);
}
/*
* weechat_python_api_config_option_unset: unset an option
*/
@@ -1525,7 +1562,7 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
PYTHON_RETURN_INT(0);
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = NULL;
@@ -1533,7 +1570,7 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
PYTHON_RETURN_INT(0);
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
rc = weechat_config_option_unset (script_str2ptr (option));
@@ -1574,6 +1611,71 @@ weechat_python_api_config_option_rename (PyObject *self, PyObject *args)
PYTHON_RETURN_OK;
}
/*
* weechat_python_api_config_option_is_null: return 1 if value of option is null
*/
static PyObject *
weechat_python_api_config_option_is_null (PyObject *self, PyObject *args)
{
char *option;
int value;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null");
PYTHON_RETURN_INT(1);
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null");
PYTHON_RETURN_INT(1);
}
value = weechat_config_option_is_null (script_str2ptr (option));
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_option_default_is_null: return 1 if default value
* of option is null
*/
static PyObject *
weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args)
{
char *option;
int value;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null");
PYTHON_RETURN_INT(1);
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null");
PYTHON_RETURN_INT(1);
}
value = weechat_config_option_default_is_null (script_str2ptr (option));
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_boolean: return boolean value of option
*/
@@ -1702,6 +1804,39 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_config_write_option: write an option in configuration file
*/
static PyObject *
weechat_python_api_config_write_option (PyObject *self, PyObject *args)
{
char *config_file, *option;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option");
PYTHON_RETURN_ERROR;
}
config_file = NULL;
option = NULL;
if (!PyArg_ParseTuple (args, "ss", &config_file, &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option");
PYTHON_RETURN_ERROR;
}
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
PYTHON_RETURN_OK;
}
/*
* weechat_python_api_config_write_line: write a line in configuration file
*/
@@ -4911,12 +5046,16 @@ PyMethodDef weechat_python_funcs[] =
{ "config_string_to_boolean", &weechat_python_api_config_string_to_boolean, METH_VARARGS, "" },
{ "config_option_reset", &weechat_python_api_config_option_reset, METH_VARARGS, "" },
{ "config_option_set", &weechat_python_api_config_option_set, METH_VARARGS, "" },
{ "config_option_set_null", &weechat_python_api_config_option_set_null, METH_VARARGS, "" },
{ "config_option_unset", &weechat_python_api_config_option_unset, METH_VARARGS, "" },
{ "config_option_rename", &weechat_python_api_config_option_rename, METH_VARARGS, "" },
{ "config_option_is_null", &weechat_python_api_config_option_is_null, METH_VARARGS, "" },
{ "config_option_default_is_null", &weechat_python_api_config_option_default_is_null, METH_VARARGS, "" },
{ "config_boolean", &weechat_python_api_config_boolean, METH_VARARGS, "" },
{ "config_integer", &weechat_python_api_config_integer, METH_VARARGS, "" },
{ "config_string", &weechat_python_api_config_string, METH_VARARGS, "" },
{ "config_color", &weechat_python_api_config_color, METH_VARARGS, "" },
{ "config_write_option", &weechat_python_api_config_write_option, METH_VARARGS, "" },
{ "config_write_line", &weechat_python_api_config_write_line, METH_VARARGS, "" },
{ "config_write", &weechat_python_api_config_write, METH_VARARGS, "" },
{ "config_read", &weechat_python_api_config_read, METH_VARARGS, "" },
+170 -8
View File
@@ -1477,7 +1477,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
VALUE section, VALUE name, VALUE type,
VALUE description, VALUE string_values,
VALUE min, VALUE max, VALUE default_value,
VALUE value,
VALUE value, VALUE null_value_allowed,
VALUE function_check_value,
VALUE function_change,
VALUE function_delete)
@@ -1485,7 +1485,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
char *c_config_file, *c_section, *c_name, *c_type, *c_description;
char *c_string_values, *c_default_value, *c_value, *result;
char *c_function_check_value, *c_function_change, *c_function_delete;
int c_min, c_max;
int c_min, c_max, c_null_value_allowed;
VALUE return_value;
/* make C compiler happy */
@@ -1507,13 +1507,14 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_max = 0;
c_default_value = NULL;
c_value = NULL;
c_null_value_allowed = 0;
c_function_check_value = NULL;
c_function_change = NULL;
c_function_delete = NULL;
if (NIL_P (config_file) || NIL_P (section) || NIL_P (name) || NIL_P (type)
|| NIL_P (description) || NIL_P (string_values)
|| NIL_P (default_value) || NIL_P (value)
|| NIL_P (default_value) || NIL_P (value) || NIL_P (null_value_allowed)
|| NIL_P (function_check_value) || NIL_P (function_change)
|| NIL_P (function_delete))
{
@@ -1531,6 +1532,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
Check_Type (max, T_FIXNUM);
Check_Type (default_value, T_STRING);
Check_Type (value, T_STRING);
Check_Type (null_value_allowed, T_FIXNUM);
Check_Type (function_check_value, T_STRING);
Check_Type (function_change, T_STRING);
Check_Type (function_delete, T_STRING);
@@ -1545,6 +1547,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_max = FIX2INT (max);
c_default_value = STR2CSTR (default_value);
c_value = STR2CSTR (value);
c_null_value_allowed = FIX2INT (null_value_allowed);
c_function_check_value = STR2CSTR (function_check_value);
c_function_change = STR2CSTR (function_change);
c_function_delete = STR2CSTR (function_delete);
@@ -1561,6 +1564,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_max,
c_default_value,
c_value,
c_null_value_allowed,
&weechat_ruby_api_config_option_check_value_cb,
c_function_check_value,
&weechat_ruby_api_config_option_change_cb,
@@ -1710,7 +1714,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set");
RUBY_RETURN_INT(0);
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
c_option = NULL;
@@ -1720,7 +1724,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
if (NIL_P (option) || NIL_P (new_value) || NIL_P (run_callback))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
RUBY_RETURN_INT(0);
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
Check_Type (option, T_STRING);
@@ -1738,6 +1742,48 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
RUBY_RETURN_INT(rc);
}
/*
* weechat_ruby_api_config_option_set_null: set null (undefined) value for
* option
*/
static VALUE
weechat_ruby_api_config_option_set_null (VALUE class, VALUE option,
VALUE run_callback)
{
char *c_option;
int c_run_callback, rc;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null");
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
c_option = NULL;
c_run_callback = 0;
if (NIL_P (option) || NIL_P (run_callback))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
Check_Type (option, T_STRING);
Check_Type (run_callback, T_FIXNUM);
c_option = STR2CSTR (option);
c_run_callback = FIX2INT (run_callback);
rc = weechat_config_option_set_null (script_str2ptr (c_option),
c_run_callback);
RUBY_RETURN_INT(rc);
}
/*
* weechat_ruby_api_config_option_unset: unset an option
*/
@@ -1754,7 +1800,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
RUBY_RETURN_INT(0);
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
c_option = NULL;
@@ -1762,7 +1808,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
if (NIL_P (option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
RUBY_RETURN_INT(0);
RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
Check_Type (option, T_STRING);
@@ -1814,6 +1860,78 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
RUBY_RETURN_OK;
}
/*
* weechat_ruby_api_config_option_is_null: return 1 if value of option is null
*/
static VALUE
weechat_ruby_api_config_option_is_null (VALUE class, VALUE option)
{
char *c_option;
int value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null");
RUBY_RETURN_INT(1);
}
c_option = NULL;
if (NIL_P (option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null");
RUBY_RETURN_INT(1);
}
Check_Type (option, T_STRING);
c_option = STR2CSTR (option);
value = weechat_config_option_is_null (script_str2ptr (c_option));
RUBY_RETURN_INT(value);
}
/*
* weechat_ruby_api_config_option_default_is_null: return 1 if value of option is null
*/
static VALUE
weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option)
{
char *c_option;
int value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null");
RUBY_RETURN_INT(1);
}
c_option = NULL;
if (NIL_P (option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null");
RUBY_RETURN_INT(1);
}
Check_Type (option, T_STRING);
c_option = STR2CSTR (option);
value = weechat_config_option_default_is_null (script_str2ptr (c_option));
RUBY_RETURN_INT(value);
}
/*
* weechat_ruby_api_config_boolean: return boolean value of option
*/
@@ -1958,6 +2076,46 @@ weechat_ruby_api_config_color (VALUE class, VALUE option)
RUBY_RETURN_STRING(result);
}
/*
* weechat_ruby_api_config_write_option: write an option in configuration file
*/
static VALUE
weechat_ruby_api_config_write_option (VALUE class, VALUE config_file,
VALUE option)
{
char *c_config_file, *c_option;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option");
RUBY_RETURN_ERROR;
}
c_config_file = NULL;
c_option = NULL;
if (NIL_P (config_file) || NIL_P (option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option");
RUBY_RETURN_ERROR;
}
Check_Type (config_file, T_STRING);
Check_Type (option, T_STRING);
c_config_file = STR2CSTR (config_file);
c_option = STR2CSTR (option);
weechat_config_write_option (script_str2ptr (c_config_file),
script_str2ptr (c_option));
RUBY_RETURN_OK;
}
/*
* weechat_ruby_api_config_write_line: write a line in configuration file
*/
@@ -5636,17 +5794,21 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_new", &weechat_ruby_api_config_new, 2);
rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 9);
rb_define_module_function (ruby_mWeechat, "config_search_section", &weechat_ruby_api_config_search_section, 2);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 13);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 14);
rb_define_module_function (ruby_mWeechat, "config_search_option", &weechat_ruby_api_config_search_option, 3);
rb_define_module_function (ruby_mWeechat, "config_string_to_boolean", &weechat_ruby_api_config_string_to_boolean, 1);
rb_define_module_function (ruby_mWeechat, "config_option_reset", &weechat_ruby_api_config_option_reset, 2);
rb_define_module_function (ruby_mWeechat, "config_option_set", &weechat_ruby_api_config_option_set, 3);
rb_define_module_function (ruby_mWeechat, "config_option_set_null", &weechat_ruby_api_config_option_set_null, 2);
rb_define_module_function (ruby_mWeechat, "config_option_unset", &weechat_ruby_api_config_option_unset, 1);
rb_define_module_function (ruby_mWeechat, "config_option_rename", &weechat_ruby_api_config_option_rename, 2);
rb_define_module_function (ruby_mWeechat, "config_option_is_null", &weechat_ruby_api_config_option_is_null, 1);
rb_define_module_function (ruby_mWeechat, "config_option_default_is_null", &weechat_ruby_api_config_option_default_is_null, 1);
rb_define_module_function (ruby_mWeechat, "config_boolean", &weechat_ruby_api_config_boolean, 1);
rb_define_module_function (ruby_mWeechat, "config_integer", &weechat_ruby_api_config_integer, 1);
rb_define_module_function (ruby_mWeechat, "config_string", &weechat_ruby_api_config_string, 1);
rb_define_module_function (ruby_mWeechat, "config_color", &weechat_ruby_api_config_color, 1);
rb_define_module_function (ruby_mWeechat, "config_write_option", &weechat_ruby_api_config_write_option, 2);
rb_define_module_function (ruby_mWeechat, "config_write_line", &weechat_ruby_api_config_write_line, 3);
rb_define_module_function (ruby_mWeechat, "config_write", &weechat_ruby_api_config_write, 1);
rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1);
+2
View File
@@ -347,6 +347,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
int min, int max,
const char *default_value,
const char *value,
int null_value_allowed,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -416,6 +417,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
new_option = weechat_config_new_option (config_file, section, name, type,
description, string_values, min,
max, default_value, value,
null_value_allowed,
callback1, new_script_callback1,
callback2, new_script_callback2,
callback3, new_script_callback3);
+1
View File
@@ -68,6 +68,7 @@ extern struct t_config_option *script_api_config_new_option (struct t_weechat_pl
int min, int max,
const char *default_value,
const char *value,
int null_value_allowed,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
+165 -18
View File
@@ -1458,10 +1458,6 @@ weechat_tcl_api_config_option_delete_cb (void *data,
}
}
/*
* weechat_tcl_api_config_new_option: create a new option in section
*/
@@ -1474,7 +1470,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value, *value;
char *function_check_value, *function_change, *function_delete;
int i,min,max;
int i, min, max, null_value_allowed;
/* make C compiler happy */
(void) clientData;
@@ -1485,14 +1481,15 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 14)
if (objc < 15)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
TCL_RETURN_EMPTY;
}
if ((Tcl_GetIntFromObj (interp, objv[7], &min) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK))
|| (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[11], &null_value_allowed) != TCL_OK))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
TCL_RETURN_EMPTY;
@@ -1506,9 +1503,9 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
string_values = Tcl_GetStringFromObj (objv[6], &i);
default_value = Tcl_GetStringFromObj (objv[9], &i);
value = Tcl_GetStringFromObj (objv[10], &i);
function_check_value = Tcl_GetStringFromObj (objv[11], &i);
function_change = Tcl_GetStringFromObj (objv[12], &i);
function_delete = Tcl_GetStringFromObj (objv[13], &i);
function_check_value = Tcl_GetStringFromObj (objv[12], &i);
function_change = Tcl_GetStringFromObj (objv[13], &i);
function_delete = Tcl_GetStringFromObj (objv[14], &i);
result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin,
tcl_current_script,
@@ -1522,6 +1519,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
max,
default_value,
value,
null_value_allowed,
&weechat_tcl_api_config_option_check_value_cb,
function_check_value,
&weechat_tcl_api_config_option_change_cb,
@@ -1653,7 +1651,7 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj* objp;
int rc;
char *option, *new_value;
int i,run_cb;
int i, run_callback;
/* make C compiler happy */
(void) clientData;
@@ -1661,26 +1659,67 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set");
TCL_RETURN_INT(0);
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
TCL_RETURN_INT(0);
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (Tcl_GetIntFromObj (interp, objv[3], &run_cb) != TCL_OK)
if (Tcl_GetIntFromObj (interp, objv[3], &run_callback) != TCL_OK)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set");
TCL_RETURN_INT(0);
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = Tcl_GetStringFromObj (objv[1], &i);
new_value = Tcl_GetStringFromObj (objv[2], &i);
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_cb); /* run_callback */
run_callback);
TCL_RETURN_INT(rc);
}
/*
* weechat_tcl_api_config_option_set_null: set null (undefined)value for option
*/
static int
weechat_tcl_api_config_option_set_null (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
int rc;
char *option;
int i, run_callback;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null");
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null");
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = Tcl_GetStringFromObj (objv[1], &i);
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
TCL_RETURN_INT(rc);
}
@@ -1704,13 +1743,13 @@ weechat_tcl_api_config_option_unset (ClientData clientData, Tcl_Interp *interp,
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
TCL_RETURN_INT(0);
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
if (objc < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
TCL_RETURN_INT(0);
TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = Tcl_GetStringFromObj (objv[1], &i);
@@ -1748,12 +1787,77 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp,
option = Tcl_GetStringFromObj (objv[1], &i);
new_name = Tcl_GetStringFromObj (objv[2], &i);
weechat_config_option_rename (script_str2ptr (option),
new_name);
TCL_RETURN_OK;
}
/*
* weechat_tcl_api_config_option_is_null: return 1 if value of option is null
*/
static int
weechat_tcl_api_config_option_is_null (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
int result, i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null");
TCL_RETURN_INT(1);
}
if (objc < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null");
TCL_RETURN_INT(1);
}
result = weechat_config_option_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
TCL_RETURN_INT(result);
}
/*
* weechat_tcl_api_config_option_default_is_null: return 1 if default value of
* option is null
*/
static int
weechat_tcl_api_config_option_default_is_null (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
int result, i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null");
TCL_RETURN_INT(1);
}
if (objc < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null");
TCL_RETURN_INT(1);
}
result = weechat_config_option_default_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
TCL_RETURN_INT(result);
}
/*
* weechat_tcl_api_config_boolean: return boolean value of option
*/
@@ -1880,6 +1984,41 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_STRING(result);
}
/*
* weechat_tcl_api_config_write_option: write an option in configuration file
*/
static int
weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *config_file, *option;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option");
TCL_RETURN_ERROR;
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option");
TCL_RETURN_ERROR;
}
config_file = Tcl_GetStringFromObj (objv[1], &i);
option = Tcl_GetStringFromObj (objv[2], &i);
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
TCL_RETURN_OK;
}
/*
* weechat_tcl_api_config_write_line: write a line in configuration file
*/
@@ -5324,10 +5463,16 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
weechat_tcl_api_config_option_reset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_set",
weechat_tcl_api_config_option_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_set_null",
weechat_tcl_api_config_option_set_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_unset",
weechat_tcl_api_config_option_unset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_rename",
weechat_tcl_api_config_option_rename, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_is_null",
weechat_tcl_api_config_option_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_option_default_is_null",
weechat_tcl_api_config_option_default_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_boolean",
weechat_tcl_api_config_boolean, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_integer",
@@ -5336,6 +5481,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
weechat_tcl_api_config_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_color",
weechat_tcl_api_config_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_write_option",
weechat_tcl_api_config_write_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_write_line",
weechat_tcl_api_config_write_line, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::config_write",
+32
View File
@@ -60,6 +60,9 @@ struct t_weelist;
#define WEECHAT_CONFIG_WRITE_ERROR -1
#define WEECHAT_CONFIG_WRITE_MEMORY_ERROR -2
/* null value for option */
#define WEECHAT_CONFIG_OPTION_NULL "null"
/* return codes for config option set */
#define WEECHAT_CONFIG_OPTION_SET_OK_CHANGED 2
#define WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE 1
@@ -254,6 +257,7 @@ struct t_weechat_plugin
int max,
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -282,15 +286,25 @@ struct t_weechat_plugin
int run_callback);
int (*config_option_set) (struct t_config_option *option,
const char *value, int run_callback);
int (*config_option_set_null) (struct t_config_option *option,
int run_callback);
int (*config_option_unset) (struct t_config_option *option);
void (*config_option_rename) (struct t_config_option *option,
const char *new_name);
void *(*config_option_get_pointer) (struct t_config_option *option,
const char *property);
int (*config_option_is_null) (struct t_config_option *option);
int (*config_option_default_is_null) (struct t_config_option *option);
int (*config_boolean) (struct t_config_option *option);
int (*config_boolean_default) (struct t_config_option *option);
int (*config_integer) (struct t_config_option *option);
int (*config_integer_default) (struct t_config_option *option);
const char *(*config_string) (struct t_config_option *option);
const char *(*config_string_default) (struct t_config_option *option);
const char *(*config_color) (struct t_config_option *option);
const char *(*config_color_default) (struct t_config_option *option);
void (*config_write_option) (struct t_config_file *config_file,
struct t_config_option *option);
void (*config_write_line) (struct t_config_file *config_file,
const char *option_name,
const char *value, ...);
@@ -761,6 +775,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_config_new_option(__config, __section, __name, __type, \
__desc, __string_values, __min, \
__max, __default, __value, \
__null_value_allowed, \
__callback_check, \
__callback_check_data, \
__callback_change, \
@@ -770,6 +785,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->config_new_option(__config, __section, __name, \
__type, __desc, __string_values, \
__min, __max, __default, __value, \
__null_value_allowed, \
__callback_check, \
__callback_check_data, \
__callback_change, \
@@ -797,20 +813,36 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_config_option_set(__option, __value, __run_callback) \
weechat_plugin->config_option_set(__option, __value, \
__run_callback)
#define weechat_config_option_set_null(__option, __run_callback) \
weechat_plugin->config_option_set_null(__option, __run_callback)
#define weechat_config_option_unset(__option) \
weechat_plugin->config_option_unset(__option)
#define weechat_config_option_rename(__option, __new_name) \
weechat_plugin->config_option_rename(__option, __new_name)
#define weechat_config_option_get_pointer(__option, __property) \
weechat_plugin->config_option_get_pointer(__option, __property)
#define weechat_config_option_is_null(__option) \
weechat_plugin->config_option_is_null(__option)
#define weechat_config_option_default_is_null(__option) \
weechat_plugin->config_option_default_is_null(__option)
#define weechat_config_boolean(__option) \
weechat_plugin->config_boolean(__option)
#define weechat_config_boolean_default(__option) \
weechat_plugin->config_boolean_default(__option)
#define weechat_config_integer(__option) \
weechat_plugin->config_integer(__option)
#define weechat_config_integer_default(__option) \
weechat_plugin->config_integer_default(__option)
#define weechat_config_string(__option) \
weechat_plugin->config_string(__option)
#define weechat_config_string_default(__option) \
weechat_plugin->config_string_default(__option)
#define weechat_config_color(__option) \
weechat_plugin->config_color(__option)
#define weechat_config_color_default(__option) \
weechat_plugin->config_color_default(__option)
#define weechat_config_write_option(__config, __option) \
weechat_plugin->config_write_option(__config, __option)
#define weechat_config_write_line(__config, __option, __value...) \
weechat_plugin->config_write_line(__config, __option, ##__value)
#define weechat_config_write(__config) \
+25 -25
View File
@@ -124,12 +124,12 @@ xfer_config_init ()
"auto_open_buffer", "boolean",
N_("auto open xfer buffer when a new xfer is added "
"to list"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_look_progress_bar_size = weechat_config_new_option (
xfer_config_file, ptr_section,
"progress_bar_size", "integer",
N_("size of progress bar, in chars (if 0, progress bar is disabled)"),
NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL,
NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "color",
@@ -147,55 +147,55 @@ xfer_config_init ()
xfer_config_file, ptr_section,
"text", "color",
N_("text color"),
NULL, 0, 0, "default", NULL,
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_text_bg = weechat_config_new_option (
xfer_config_file, ptr_section,
"text_bg", "color",
N_("background color"),
NULL, 0, 0, "default", NULL,
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_text_selected = weechat_config_new_option (
xfer_config_file, ptr_section,
"text_selected", "color",
N_("text color of selected xfer line"),
NULL, 0, 0, "white", NULL,
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_WAITING] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_waiting", "color",
N_("text color for \"waiting\" status"),
NULL, 0, 0, "lightcyan", NULL,
NULL, 0, 0, "lightcyan", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_CONNECTING] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_connecting", "color",
N_("text color for \"connecting\" status"),
NULL, 0, 0, "yellow", NULL,
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_ACTIVE] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_active", "color",
N_("text color for \"active\" status"),
NULL, 0, 0, "lightblue", NULL,
NULL, 0, 0, "lightblue", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_DONE] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_done", "color",
N_("text color for \"done\" status"),
NULL, 0, 0, "lightgreen", NULL,
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_FAILED] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_failed", "color",
N_("text color for \"failed\" status"),
NULL, 0, 0, "lightred", NULL,
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_ABORTED] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_aborted", "color",
N_("text color for \"aborted\" status"),
NULL, 0, 0, "lightred", NULL,
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "network",
@@ -213,37 +213,37 @@ xfer_config_init ()
xfer_config_file, ptr_section,
"timeout", "integer",
N_("timeout for xfer request (in seconds)"),
NULL, 5, INT_MAX, "300", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 5, INT_MAX, "300", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_blocksize = weechat_config_new_option (
xfer_config_file, ptr_section,
"blocksize", "integer",
N_("block size for sending packets, in bytes"),
NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL,
NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_fast_send = weechat_config_new_option (
xfer_config_file, ptr_section,
"fast_send", "boolean",
N_("does not wait for ACK when sending file"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_port_range = weechat_config_new_option (
xfer_config_file, ptr_section,
"port_range", "string",
N_("restricts outgoing files/chats to use only ports in the given "
"range (useful for NAT) (syntax: a single port, ie. 5000 or a port "
"range, ie. 5000-5015, empty value means any port)"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_own_ip = weechat_config_new_option (
xfer_config_file, ptr_section,
"own_ip", "string",
N_("IP or DNS address used for sending files/chats "
"(if empty, local interface IP is used)"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_speed_limit = weechat_config_new_option (
xfer_config_file, ptr_section,
"speed_limit", "integer",
N_("speed limit for sending files, in kilo-bytes by second (0 means "
"no limit)"),
NULL, 0, INT_MAX, "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
@@ -260,44 +260,44 @@ xfer_config_init ()
xfer_config_file, ptr_section,
"download_path", "string",
N_("path for writing incoming files"),
NULL, 0, 0, "%h/xfer", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%h/xfer", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_upload_path = weechat_config_new_option (
xfer_config_file, ptr_section,
"upload_path", "string",
N_("path for reading files when sending (when no path is "
"specified by user)"),
NULL, 0, 0, "~", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "~", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_use_nick_in_filename = weechat_config_new_option (
xfer_config_file, ptr_section,
"use_nick_in_filename", "boolean",
N_("use remote nick as prefix in local filename when receiving a file"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_convert_spaces = weechat_config_new_option (
xfer_config_file, ptr_section,
"convert_spaces", "boolean",
N_("convert spaces to underscores when sending files"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_rename = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_rename", "boolean",
N_("rename incoming files if already exists (add '.1', '.2', ...)"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_resume = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_resume", "boolean",
N_("automatically resume file transfer if connection with remote host "
"is lost"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_accept_files = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_accept_files", "boolean",
N_("automatically accept incoming files (use carefully!)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_accept_chats = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_accept_chats", "boolean",
N_("automatically accept chat requests (use carefully!)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}