1 /* settings.h 2 * 3 * 4 * Copyright (C) 2014 Toxic All Rights Reserved. 5 * 6 * This file is part of Toxic. 7 * 8 * Toxic is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * Toxic is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with Toxic. If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23 #ifndef SETTINGS_H 24 #define SETTINGS_H 25 26 #include <limits.h> 27 28 #include <tox/tox.h> 29 30 /* Represents line_* hints max strlen */ 31 #define LINE_HINT_MAX 3 32 33 #define PASSWORD_EVAL_MAX 512 34 35 /* Holds user setting values defined in the toxic config file. */ 36 struct user_settings { 37 int autolog; /* boolean */ 38 int alerts; /* boolean */ 39 40 /* boolean (is set to NT_BEEP or 0 after loading) */ 41 int bell_on_message; 42 int bell_on_filetrans; 43 int bell_on_filetrans_accept; 44 int bell_on_invite; 45 46 int timestamps; /* boolean */ 47 char timestamp_format[TIME_STR_SIZE]; 48 char log_timestamp_format[TIME_STR_SIZE]; 49 50 int colour_theme; /* boolean (0 for default toxic colours) */ 51 int history_size; /* int between MIN_HISTORY and MAX_HISTORY */ 52 int notification_timeout; 53 int show_typing_self; /* boolean */ 54 int show_typing_other; /* boolean */ 55 int show_welcome_msg; /* boolean */ 56 int show_connection_msg; /* boolean */ 57 int nodeslist_update_freq; /* int (<= 0 to disable updates) */ 58 int autosave_freq; /* int (<= 0 to disable autosave) */ 59 60 char line_join[LINE_HINT_MAX + 1]; 61 char line_quit[LINE_HINT_MAX + 1]; 62 char line_alert[LINE_HINT_MAX + 1]; 63 char line_normal[LINE_HINT_MAX + 1]; 64 65 char download_path[PATH_MAX]; 66 char chatlogs_path[PATH_MAX]; 67 char avatar_path[PATH_MAX]; 68 char autorun_path[PATH_MAX]; 69 char password_eval[PASSWORD_EVAL_MAX]; 70 71 char color_bar_bg[COLOR_STR_SIZE]; 72 char color_bar_fg[COLOR_STR_SIZE]; 73 char color_bar_accent[COLOR_STR_SIZE]; 74 char color_bar_notify[COLOR_STR_SIZE]; 75 76 int key_next_tab; 77 int key_prev_tab; 78 int key_scroll_line_up; 79 int key_scroll_line_down; 80 int key_half_page_up; 81 int key_half_page_down; 82 int key_page_bottom; 83 int key_toggle_peerlist; 84 int key_toggle_pastemode; 85 86 int mplex_away; /* boolean (1 for reaction to terminal attach/detach) */ 87 char mplex_away_note [TOX_MAX_STATUS_MESSAGE_LENGTH]; 88 89 #ifdef AUDIO 90 int audio_in_dev; 91 int audio_out_dev; 92 double VAD_threshold; 93 int conference_audio_channels; 94 int chat_audio_channels; 95 int push_to_talk; /* boolean */ 96 #endif 97 }; 98 99 extern struct user_settings *user_settings; 100 101 enum settings_values { 102 AUTOLOG_OFF = 0, 103 AUTOLOG_ON = 1, 104 105 TIMESTAMPS_OFF = 0, 106 TIMESTAMPS_ON = 1, 107 108 ALERTS_DISABLED = 0, 109 ALERTS_ENABLED = 1, 110 111 DFLT_COLS = 0, 112 NATIVE_COLS = 1, 113 114 SHOW_TYPING_OFF = 0, 115 SHOW_TYPING_ON = 1, 116 117 SHOW_WELCOME_MSG_OFF = 0, 118 SHOW_WELCOME_MSG_ON = 1, 119 120 SHOW_CONNECTION_MSG_OFF = 0, 121 SHOW_CONNECTION_MSG_ON = 1, 122 123 DFLT_HST_SIZE = 700, 124 125 MPLEX_OFF = 0, 126 MPLEX_ON = 1, 127 }; 128 129 #define LINE_JOIN "-->" 130 #define LINE_QUIT "<--" 131 #define LINE_ALERT "-!-" 132 #define LINE_NORMAL "-" 133 #define TIMESTAMP_DEFAULT "%H:%M" 134 #define LOG_TIMESTAMP_DEFAULT "%Y/%m/%d [%H:%M:%S]" 135 #define MPLEX_AWAY_NOTE "Away from keyboard, be back soon!" 136 137 int settings_load(struct user_settings *s, const char *patharg); 138 139 #endif /* SETTINGS_H */ 140