mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 11:43: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:
+14
-14
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user