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

Add new argument "value" to function config_new_option

This commit is contained in:
Sebastien Helleu
2008-10-18 19:31:40 +02:00
parent 8511f9a77e
commit 3b81a4746a
27 changed files with 354 additions and 374 deletions
+2 -2
View File
@@ -619,7 +619,7 @@ 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, NULL, NULL,
&alias_config_change_cb, NULL,
&alias_config_delete_cb, NULL);
@@ -731,7 +731,7 @@ 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], NULL, NULL,
&alias_config_change_cb, NULL,
&alias_config_delete_cb, NULL);
+5 -5
View File
@@ -154,7 +154,7 @@ weechat_aspell_config_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, NULL, NULL, NULL);
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -232,7 +232,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, 0, 0, "lightred", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* check */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
@@ -252,7 +252,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",
"quit,topic", NULL,
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,
@@ -260,14 +260,14 @@ 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, 0, 0, "", NULL,
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, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
1, 1,
+3 -3
View File
@@ -144,7 +144,7 @@ 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, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -199,13 +199,13 @@ charset_config_init ()
(charset_terminal && charset_internal
&& (strcasecmp (charset_terminal,
charset_internal) != 0)) ?
charset_terminal : "iso-8859-1",
charset_terminal : "iso-8859-1", NULL,
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, 0, 0, "", NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (charset_config_file, "decode",
+69 -39
View File
@@ -590,7 +590,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "boolean",
N_("automatically connect to server when WeeChat is starting"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -599,7 +601,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "boolean",
N_("automatically reconnect to server when disconnected"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -608,7 +612,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "integer",
N_("delay (in seconds) before trying again to reconnect to server"),
NULL, 0, 65535, value, NULL, NULL,
NULL, 0, 65535,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -617,7 +623,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "string",
N_("list of IP/port or hostname/port for server (separated by comma)"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -626,7 +634,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "boolean",
N_("use IPv6 protocol for server communication"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -635,7 +645,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "boolean",
N_("use SSL for server communication"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -644,7 +656,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "string",
N_("password for IRC server"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -653,7 +667,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "string",
N_("nicknames to use on IRC server (separated by comma)"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -662,7 +678,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "string",
N_("user name to use on IRC server"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -671,7 +689,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "string",
N_("real name to use on IRC server"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -681,7 +701,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
option_name, "string",
N_("custom local hostname/IP for server (optional, if empty "
"local hostname is used)"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -692,7 +714,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
N_("command(s) to run when connected to server (many commands should "
"be separated by ';', use '\\;' for a semicolon, special variables "
"$nick, $channel and $server are replaced by their value)"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -702,7 +726,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
option_name, "integer",
N_("delay (in seconds) after command was executed (example: give some "
"time for authentication)"),
NULL, 0, 3600, value, NULL, NULL,
NULL, 0, 3600,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -712,7 +738,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
option_name, "string",
N_("comma separated list of channels to join when connected to server "
"(example: \"#chan1,#chan2,#chan3 key1,key2\")"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -721,7 +749,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
config_file, section,
option_name, "boolean",
N_("automatically rejoin channels when kicked"),
NULL, 0, 0, value, NULL, NULL,
NULL, 0, 0,
irc_config_server_option_default[index_option], value,
NULL, NULL,
callback_change, callback_change_data,
callback_delete, callback_delete_data);
break;
@@ -938,49 +968,49 @@ irc_config_init ()
irc_config_file, ptr_section,
"one_server_buffer", "boolean",
N_("use same buffer for all servers"),
NULL, 0, 0, "off", NULL, NULL, &irc_config_change_one_server_buffer, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_one_server_buffer, NULL, NULL, NULL);
irc_config_look_open_near_server = weechat_config_new_option (
irc_config_file, ptr_section,
"open_near_server", "boolean",
N_("open new channels/privates near server"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_prefix = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefix", "string",
N_("text to display before nick in chat window"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_suffix = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_suffix", "string",
N_("text to display after nick in chat window"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_completion_smart = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_completion_smart", "boolean",
N_("smart completion for nicks (completes with last speakers first)"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_away = weechat_config_new_option (
irc_config_file, ptr_section,
"display_away", "integer",
N_("display message when (un)marking as away"),
"off|local|channel", 0, 0, "local", NULL, NULL, NULL, NULL, NULL, NULL);
"off|local|channel", 0, 0, "local", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_tags = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_tags", "string",
N_("comma separated list of tags for messages that may produce "
"highlight (usually any message from another user, not server "
"messages,..)"),
NULL, 0, 0, "irc_privmsg,irc_notice", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "irc_privmsg,irc_notice", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_show_away_once = weechat_config_new_option (
irc_config_file, ptr_section,
"show_away_once", "boolean",
N_("show remote away message only once in private"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notice_as_pv = weechat_config_new_option (
irc_config_file, ptr_section,
"notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
@@ -998,65 +1028,65 @@ irc_config_init ()
"default_msg_part", "string",
N_("default part message (leaving channel) ('%v' will be replaced by "
"WeeChat version in string)"),
NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_default_msg_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"default_msg_quit", "string",
N_("default quit message (disconnecting from server) ('%v' will be "
"replaced by WeeChat version in string)"),
NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_away_check = weechat_config_new_option (
irc_config_file, ptr_section,
"away_check", "integer",
N_("interval between two checks for away (in minutes, 0 = never "
"check)"),
NULL, 0, INT_MAX, "0", NULL, NULL, &irc_config_change_away_check, NULL, NULL, NULL);
NULL, 0, INT_MAX, "0", NULL, NULL, NULL, &irc_config_change_away_check, NULL, NULL, NULL);
irc_config_network_away_check_max_nicks = weechat_config_new_option (
irc_config_file, ptr_section,
"away_check_max_nicks", "integer",
N_("do not check away nicks on channels with high number of nicks "
"(0 = unlimited)"),
NULL, 0, INT_MAX, "0", NULL, NULL, &irc_config_change_away_check, NULL, NULL, NULL);
NULL, 0, INT_MAX, "0", NULL, NULL, NULL, &irc_config_change_away_check, NULL, NULL, NULL);
irc_config_network_lag_check = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_check", "integer",
N_("interval between two checks for lag (in seconds, 0 = never "
"check)"),
NULL, 0, INT_MAX, "60", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "60", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_lag_min_show = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_min_show", "integer",
N_("minimum lag to show (in seconds)"),
NULL, 0, INT_MAX, "1", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "1", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_lag_disconnect = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_disconnect", "integer",
N_("disconnect after important lag (in minutes, 0 = never "
"disconnect)"),
NULL, 0, INT_MAX, "5", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, INT_MAX, "5", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_anti_flood = weechat_config_new_option (
irc_config_file, ptr_section,
"anti_flood", "integer",
N_("anti-flood: # seconds between two user messages (0 = no "
"anti-flood)"),
NULL, 0, 5, "2", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 5, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_colors_receive = weechat_config_new_option (
irc_config_file, ptr_section,
"colors_receive", "boolean",
N_("when off, colors codes are ignored in incoming messages"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_colors_send = weechat_config_new_option (
irc_config_file, ptr_section,
"colors_send", "boolean",
N_("allow user to send colors with special codes (^Cb=bold, "
"^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, "
"^Cr=reverse)"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_send_unknown_commands = weechat_config_new_option (
irc_config_file, ptr_section,
"send_unknown_commands", "boolean",
N_("send unknown commands to IRC server"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* log */
ptr_section = weechat_config_new_section (irc_config_file, "log",
@@ -1073,22 +1103,22 @@ irc_config_init ()
irc_config_file, ptr_section,
"auto_log_server", "boolean",
N_("automatically log server messages"),
NULL, 0, 0, "off", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_auto_log_channel = weechat_config_new_option (
irc_config_file, ptr_section,
"auto_log_channel", "boolean",
N_("automatically log channel chats"),
NULL, 0, 0, "off", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_auto_log_private = weechat_config_new_option (
irc_config_file, ptr_section,
"auto_log_private", "boolean",
N_("automatically log private chats"),
NULL, 0, 0, "off", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_hide_nickserv_pwd = weechat_config_new_option (
irc_config_file, ptr_section,
"hide_nickserv_pwd", "boolean",
N_("hide password displayed by nickserv"),
NULL, 0, 0, "on", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
/* filters */
ptr_section = weechat_config_new_section (irc_config_file, "ignore",
+6 -6
View File
@@ -73,7 +73,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, 0, INT_MAX, "20", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* file */
ptr_section = weechat_config_new_section (logger_config_file, "file",
@@ -91,30 +91,30 @@ 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, 0, 0, "on", NULL, 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, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, 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, NULL, NULL);
NULL, 0, 0, "%h/logs/", NULL, NULL, NULL, NULL, 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, 0, 0, "off", NULL, 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, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
+1 -1
View File
@@ -291,7 +291,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, 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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
+14 -11
View File
@@ -1369,7 +1369,7 @@ static int
weechat_lua_api_config_new_option (lua_State *L)
{
const char *config_file, *section, *name, *type, *description;
const char *string_values, *default_value;
const char *string_values, *default_value, *value;
const char *function_check_value, *function_change, *function_delete;
char *result;
int n, min, max;
@@ -1392,27 +1392,29 @@ weechat_lua_api_config_new_option (lua_State *L)
min = 0;
max = 0;
default_value = NULL;
value = NULL;
function_check_value = NULL;
function_change = NULL;
function_delete = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 12)
if (n < 13)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
LUA_RETURN_EMPTY;
}
config_file = lua_tostring (lua_current_interpreter, -12);
section = lua_tostring (lua_current_interpreter, -11);
name = lua_tostring (lua_current_interpreter, -10);
type = lua_tostring (lua_current_interpreter, -9);
description = lua_tostring (lua_current_interpreter, -8);
string_values = lua_tostring (lua_current_interpreter, -7);
min = lua_tonumber (lua_current_interpreter, -6);
max = lua_tonumber (lua_current_interpreter, -5);
default_value = lua_tostring (lua_current_interpreter, -4);
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);
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);
@@ -1428,6 +1430,7 @@ weechat_lua_api_config_new_option (lua_State *L)
min,
max,
default_value,
value,
&weechat_lua_api_config_option_check_value_cb,
function_check_value,
&weechat_lua_api_config_option_change_cb,
+6 -4
View File
@@ -1163,7 +1163,7 @@ weechat_perl_api_config_option_delete_cb (void *data,
static XS (XS_weechat_api_config_new_option)
{
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value;
char *description, *string_values, *default_value, *value;
char *function_check_value, *function_change, *function_delete;
dXSARGS;
@@ -1176,7 +1176,7 @@ static XS (XS_weechat_api_config_new_option)
PERL_RETURN_EMPTY;
}
if (items < 12)
if (items < 13)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
PERL_RETURN_EMPTY;
@@ -1189,8 +1189,9 @@ static XS (XS_weechat_api_config_new_option)
description = SvPV (ST (4), PL_na);
string_values = SvPV (ST (5), PL_na);
default_value = SvPV (ST (8), PL_na);
function_check_value = SvPV (ST (9), PL_na);
function_change = SvPV (ST (10), 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);
result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin,
perl_current_script,
@@ -1203,6 +1204,7 @@ static XS (XS_weechat_api_config_new_option)
SvIV (ST (6)), /* min */
SvIV (ST (7)), /* max */
default_value,
value,
&weechat_perl_api_config_option_check_value_cb,
function_check_value,
&weechat_perl_api_config_option_change_cb,
@@ -1222,7 +1222,7 @@ static PyObject *
weechat_python_api_config_new_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *name, *type, *description, *string_values;
char *default_value, *result;
char *default_value, *value, *result;
char *function_check_value, *function_change, *function_delete;
int min, max;
PyObject *object;
@@ -1243,13 +1243,14 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
description = NULL;
string_values = NULL;
default_value = NULL;
value = NULL;
function_check_value = NULL;
function_change = NULL;
function_delete = NULL;
if (!PyArg_ParseTuple (args, "ssssssiissss", &config_file, &section, &name,
if (!PyArg_ParseTuple (args, "ssssssiisssss", &config_file, &section, &name,
&type, &description, &string_values, &min, &max,
&default_value, &function_check_value,
&default_value, &value, &function_check_value,
&function_change, &function_delete))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
@@ -1267,6 +1268,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
min,
max,
default_value,
value,
&weechat_python_api_config_option_check_value_cb,
function_check_value,
&weechat_python_api_config_option_change_cb,
+10 -4
View File
@@ -1377,12 +1377,13 @@ 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 function_check_value,
VALUE function_change,
VALUE function_delete)
{
char *c_config_file, *c_section, *c_name, *c_type, *c_description;
char *c_string_values, *c_default_value, *result;
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;
VALUE return_value;
@@ -1405,14 +1406,16 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min = 0;
c_max = 0;
c_default_value = NULL;
c_value = NULL;
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 (function_check_value)
|| NIL_P (function_change) || NIL_P (function_delete))
|| NIL_P (default_value) || NIL_P (value)
|| NIL_P (function_check_value) || NIL_P (function_change)
|| NIL_P (function_delete))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
RUBY_RETURN_EMPTY;
@@ -1427,6 +1430,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
Check_Type (min, T_FIXNUM);
Check_Type (max, T_FIXNUM);
Check_Type (default_value, T_STRING);
Check_Type (value, T_STRING);
Check_Type (function_check_value, T_STRING);
Check_Type (function_change, T_STRING);
Check_Type (function_delete, T_STRING);
@@ -1440,6 +1444,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min = FIX2INT (min);
c_max = FIX2INT (max);
c_default_value = STR2CSTR (default_value);
c_value = STR2CSTR (value);
c_function_check_value = STR2CSTR (function_check_value);
c_function_change = STR2CSTR (function_change);
c_function_delete = STR2CSTR (function_delete);
@@ -1455,6 +1460,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min,
c_max,
c_default_value,
c_value,
&weechat_ruby_api_config_option_check_value_cb,
c_function_check_value,
&weechat_ruby_api_config_option_change_cb,
@@ -5354,7 +5360,7 @@ 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, 8);
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, 12);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 13);
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);
+4 -2
View File
@@ -290,7 +290,9 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section,
const char *name, const char *type,
const char *description, const char *string_values,
int min, int max, const char *default_value,
int min, int max,
const char *default_value,
const char *value,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -359,7 +361,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,
max, default_value, value,
callback1, new_script_callback1,
callback2, new_script_callback2,
callback3, new_script_callback3);
+3 -1
View File
@@ -60,7 +60,9 @@ extern struct t_config_option *script_api_config_new_option (struct t_weechat_pl
const char *type,
const char *description,
const char *string_values,
int min, int max, const char *default_value,
int min, int max,
const char *default_value,
const char *value,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
+12 -9
View File
@@ -1375,7 +1375,8 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj* objp;
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value, *function_check_value, *function_change, *function_delete;
char *description, *string_values, *default_value, *value;
char *function_check_value, *function_change, *function_delete;
int i,min,max;
/* make C compiler happy */
@@ -1387,19 +1388,19 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 13)
if (objc < 14)
{
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))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
TCL_RETURN_EMPTY;
}
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
@@ -1407,9 +1408,10 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
description = Tcl_GetStringFromObj (objv[5], &i);
string_values = Tcl_GetStringFromObj (objv[6], &i);
default_value = Tcl_GetStringFromObj (objv[9], &i);
function_check_value = Tcl_GetStringFromObj (objv[10], &i);
function_change = Tcl_GetStringFromObj (objv[11], &i);
function_delete = Tcl_GetStringFromObj (objv[12], &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);
result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin,
tcl_current_script,
@@ -1419,9 +1421,10 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
type,
description,
string_values,
min, /* min */
max, /* max */
min,
max,
default_value,
value,
&weechat_tcl_api_config_option_check_value_cb,
function_check_value,
&weechat_tcl_api_config_option_change_cb,
+4 -2
View File
@@ -240,6 +240,7 @@ struct t_weechat_plugin
const char *string_values,
int min, int max,
const char *default_value,
const char *value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -721,7 +722,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->config_search_section(__config, __name)
#define weechat_config_new_option(__config, __section, __name, __type, \
__desc, __string_values, __min, \
__max, __default, __callback_check, \
__max, __default, __value, \
__callback_check, \
__callback_check_data, \
__callback_change, \
__callback_change_data, \
@@ -729,7 +731,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__callback_delete_data) \
weechat_plugin->config_new_option(__config, __section, __name, \
__type, __desc, __string_values, \
__min, __max, __default, \
__min, __max, __default, __value, \
__callback_check, \
__callback_check_data, \
__callback_change, \
+25 -25
View File
@@ -123,12 +123,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, 0, 0, "on", NULL, 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, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "color",
@@ -145,55 +145,55 @@ xfer_config_init ()
xfer_config_file, ptr_section,
"text", "color",
N_("text color"),
NULL, 0, 0, "default",
NULL, 0, 0, "default", NULL,
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, 0, 0, "default", NULL,
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, 0, 0, "white", NULL,
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, 0, 0, "lightcyan", NULL,
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, 0, 0, "yellow", NULL,
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, 0, 0, "lightblue", NULL,
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, 0, 0, "lightgreen", NULL,
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, 0, 0, "lightred", NULL,
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, 0, 0, "lightred", NULL,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "network",
@@ -210,37 +210,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, 5, INT_MAX, "300", NULL, 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, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL,
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, 0, 0, "on", NULL, 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, 0, 0, "", NULL, 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, 0, 0, "", NULL, 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, 0, INT_MAX, "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
@@ -256,44 +256,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, 0, 0, "%h/xfer", NULL, 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, 0, 0, "~", NULL, 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, 0, 0, "on", NULL, 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, 0, 0, "on", NULL, 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, 0, 0, "on", NULL, 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, 0, 0, "on", NULL, 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, 0, 0, "off", NULL, 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, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}