int exec_config_init () { struct t_config_section *ptr_section; exec_config_file = dogechat_config_new (EXEC_CONFIG_NAME, &exec_config_reload_cb, NULL); if (!exec_config_file) return 0; /* command */ ptr_section = dogechat_config_new_section (exec_config_file, "command", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (exec_config_file); return 0; } exec_config_command_default_options = dogechat_config_new_option ( exec_config_file, ptr_section, "default_options", "string", N_("default options for command /exec (see /help exec); example: " "\"-nosh -bg\" to run all commands in background (no output), and " "without using the shell"), NULL, 0, 0, "", NULL, 0, NULL, NULL, &exec_config_change_command_default_options, NULL, NULL, NULL); exec_config_command_purge_delay = dogechat_config_new_option ( exec_config_file, ptr_section, "purge_delay", "integer", N_("delay for purging finished commands (in seconds, 0 = purge " "commands immediately, -1 = never purge)"), NULL, -1, 36000 * 24 * 30, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* color */ ptr_section = dogechat_config_new_section (exec_config_file, "color", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (exec_config_file); return 0; } exec_config_color_flag_running = dogechat_config_new_option ( exec_config_file, ptr_section, "flag_running", "color", N_("text color for a running command flag in list of commands"), NULL, 0, 0, "lightgreen", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); exec_config_color_flag_finished = dogechat_config_new_option ( exec_config_file, ptr_section, "flag_finished", "color", N_("text color for a finished command flag in list of commands"), NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); return 1; }
int xfer_config_init () { struct t_config_section *ptr_section; xfer_config_file = dogechat_config_new (XFER_CONFIG_NAME, &xfer_config_reload, NULL); if (!xfer_config_file) return 0; ptr_section = dogechat_config_new_section (xfer_config_file, "look", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (xfer_config_file); return 0; } xfer_config_look_auto_open_buffer = dogechat_config_new_option ( xfer_config_file, ptr_section, "auto_open_buffer", "boolean", N_("auto open xfer buffer when a new xfer is added " "to list"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_look_progress_bar_size = dogechat_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, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_look_pv_tags = dogechat_config_new_option ( xfer_config_file, ptr_section, "pv_tags", "string", N_("comma separated list of tags used in private messages, for example: " "\"notify_message\", \"notify_private\" or \"notify_highlight\""), NULL, 0, 0, "notify_private", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ptr_section = dogechat_config_new_section (xfer_config_file, "color", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (xfer_config_file); return 0; } xfer_config_color_status[XFER_STATUS_WAITING] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_waiting", "color", N_("text color for \"waiting\" status"), NULL, 0, 0, "lightcyan", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_CONNECTING] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_connecting", "color", N_("text color for \"connecting\" status"), NULL, 0, 0, "yellow", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_ACTIVE] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_active", "color", N_("text color for \"active\" status"), NULL, 0, 0, "lightblue", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_DONE] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_done", "color", N_("text color for \"done\" status"), NULL, 0, 0, "lightgreen", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_FAILED] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_failed", "color", N_("text color for \"failed\" status"), NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_ABORTED] = dogechat_config_new_option ( xfer_config_file, ptr_section, "status_aborted", "color", N_("text color for \"aborted\" status"), NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_text = dogechat_config_new_option ( xfer_config_file, ptr_section, "text", "color", N_("text color in xfer buffer"), NULL, 0, 0, "default", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_text_bg = dogechat_config_new_option ( xfer_config_file, ptr_section, "text_bg", "color", N_("background color in xfer buffer"), NULL, 0, 0, "default", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_text_selected = dogechat_config_new_option ( xfer_config_file, ptr_section, "text_selected", "color", N_("text color of selected line in xfer buffer"), NULL, 0, 0, "white", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); ptr_section = dogechat_config_new_section (xfer_config_file, "network", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (xfer_config_file); return 0; } xfer_config_network_blocksize = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_fast_send = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_own_ip = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_port_range = dogechat_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, it's recommended " "to use ports greater than 1024, because only root can use ports " "below 1024)"), NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_speed_limit = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_timeout = dogechat_config_new_option ( xfer_config_file, ptr_section, "timeout", "integer", N_("timeout for xfer request (in seconds)"), NULL, 5, INT_MAX, "300", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ptr_section = dogechat_config_new_section (xfer_config_file, "file", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { dogechat_config_free (xfer_config_file); return 0; } xfer_config_file_auto_accept_chats = dogechat_config_new_option ( xfer_config_file, ptr_section, "auto_accept_chats", "boolean", N_("automatically accept chat requests (use carefully!)"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_accept_files = dogechat_config_new_option ( xfer_config_file, ptr_section, "auto_accept_files", "boolean", N_("automatically accept incoming files (use carefully!)"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_accept_nicks = dogechat_config_new_option ( xfer_config_file, ptr_section, "auto_accept_nicks", "string", N_("comma-separated list of nicks for which the incoming files and " "chats are automatically accepted; format is \"server.nick\" (for a " "specific server) or \"nick\" (for all servers); example: " "\"freenode.FlashCode,andrew\""), NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_check_crc32 = dogechat_config_new_option ( xfer_config_file, ptr_section, "auto_check_crc32", "boolean", N_("automatically check CRC32 file checksum if it is found in the " "filename (8 hexadecimal chars)"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_rename = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_resume = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_convert_spaces = dogechat_config_new_option ( xfer_config_file, ptr_section, "convert_spaces", "boolean", N_("convert spaces to underscores when sending and receiving files"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_download_path = dogechat_config_new_option ( xfer_config_file, ptr_section, "download_path", "string", N_("path for writing incoming files: \"%h\" at beginning of string is " "replaced by DogeChat home (\"~/.dogechat\" by default) " "(note: content is evaluated, see /help eval)"), NULL, 0, 0, "%h/xfer", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_upload_path = dogechat_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): \"%h\" at beginning of string is replaced by DogeChat " "home (\"~/.dogechat\" by default) " "(note: content is evaluated, see /help eval)"), NULL, 0, 0, "~", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_use_nick_in_filename = dogechat_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, 0, NULL, NULL, NULL, NULL, NULL, NULL); return 1; }