"Fossies" - the Fresh Open Source Software Archive 
Member "tin-2.6.2/src/options_menu.c" (9 Dec 2022, 108592 Bytes) of package /linux/misc/tin-2.6.2.tar.xz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "options_menu.c" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
2.6.1_vs_2.6.2.
1 /*
2 * Project : tin - a Usenet reader
3 * Module : options_menu.c
4 * Author : Michael Bienia <michael@vorlon.ping.de>
5 * Created : 2004-09-05
6 * Updated : 2022-09-19
7 * Notes : Split from config.c
8 *
9 * Copyright (c) 2004-2023 Michael Bienia <michael@vorlon.ping.de>
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 *
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * 3. Neither the name of the copyright holder nor the names of its
24 * contributors may be used to endorse or promote products derived from
25 * this software without specific prior written permission.
26 *
27 * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40
41 #ifndef TIN_H
42 # include "tin.h"
43 #endif /* !TIN_H */
44 #ifndef TINCFG_H
45 # include "tincfg.h"
46 #endif /* !TINCFG_H */
47 #ifndef TCURSES_H
48 # include "tcurses.h"
49 #endif /* !TCURSES_H */
50
51
52 #define option_lines_per_page (cLINES - INDEX_TOP - 3)
53
54 #define UPDATE_BOOL_ATTRIBUTES(option) do { \
55 scopes[0].attribute->option = CAST_BOOL(tinrc.option); \
56 changed |= MISC_OPTS; \
57 } while (0)
58
59 #define UPDATE_INT_ATTRIBUTES(option) do { \
60 scopes[0].attribute->option = CAST_BITS(tinrc.option, option); \
61 changed |= MISC_OPTS; \
62 } while (0)
63
64 #define CAO(A, O) A ## O
65
66 #define SET_BOOL_ATTRIBUTE(option) do { \
67 curr_scope->attribute->option = CAST_BOOL(CAO(tinrc.attrib_, option)); \
68 curr_scope->state->option = TRUE; \
69 changed |= MISC_OPTS; \
70 } while (0)
71
72 #define SET_NUM_ATTRIBUTE(option) do { \
73 curr_scope->attribute->option = CAST_BITS(CAO(tinrc.attrib_, option), option); \
74 curr_scope->state->option = TRUE; \
75 changed |= MISC_OPTS; \
76 } while (0)
77
78 #define SET_STRING_ATTRIBUTE(opt) do { \
79 if (!strlen(CAO(tinrc.attrib_, opt))) { \
80 reset_state(option); \
81 redraw_screen(option); \
82 } else { \
83 FreeIfNeeded(curr_scope->attribute->opt); \
84 curr_scope->state->opt = TRUE; \
85 curr_scope->attribute->opt = my_strdup(CAO(tinrc.attrib_, opt)); \
86 } \
87 changed |= MISC_OPTS; \
88 } while (0)
89
90 static enum option_enum first_option_on_screen, last_option_on_screen, last_opt;
91
92 /*
93 * local prototypes
94 */
95 static enum option_enum get_first_opt(void);
96 static enum option_enum move_cursor(enum option_enum cur_option, t_bool down);
97 static enum option_enum next_option(enum option_enum option, t_bool incl_titles);
98 static enum option_enum opt_scroll_down(enum option_enum option);
99 static enum option_enum opt_scroll_up(enum option_enum option);
100 static enum option_enum prev_option(enum option_enum option, t_bool incl_titles);
101 static enum option_enum set_option_num(int num);
102 static int add_new_scope(void);
103 static int find_scope(const char *scope);
104 static int get_option_num(enum option_enum option);
105 static int move_scope(int curr_pos);
106 static t_bool check_state(enum option_enum option);
107 static t_bool delete_scope(int curr_pos);
108 static t_bool option_is_title(enum option_enum option);
109 static t_bool option_on_page(enum option_enum option);
110 static t_bool rename_scope(struct t_scope *scope);
111 static t_bool scope_is_empty(void);
112 static t_function option_left(void);
113 static t_function option_right(void);
114 static t_function scope_left(void);
115 static t_function scope_right(void);
116 static void build_scope_line(int i);
117 static void do_delete_scope(int curr_pos);
118 static void do_move_scope(int from, int to);
119 static void draw_scope_arrow(void);
120 static void free_scopes_and_attributes(void);
121 static void highlight_option(enum option_enum option);
122 static void initialize_attributes(void);
123 static void print_any_option(enum option_enum option);
124 static void redraw_screen(enum option_enum option);
125 static void repaint_option(enum option_enum option);
126 static void reset_state(enum option_enum option);
127 static void scope_page(enum context level);
128 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
129 static void set_art_mark_width(void);
130 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
131 static void set_first_option_on_screen(enum option_enum last_option);
132 static void set_last_opt(void);
133 static void set_last_option_on_screen(enum option_enum first_option);
134 static void show_config_page(void);
135 static void show_scope_page(void);
136 static void unhighlight_option(enum option_enum option);
137 #ifdef USE_CURSES
138 static void do_scroll(int jump);
139 #endif /* USE_CURSES */
140
141 static t_menu scopemenu = { 0, 0, 0, show_scope_page, draw_scope_arrow, build_scope_line };
142 static struct t_scope *curr_scope = NULL;
143
144 /*
145 * returns the row on the screen of an option
146 * note: option should be on this page
147 */
148 int
149 option_row(
150 enum option_enum option)
151 {
152 int i = 0;
153 enum option_enum j = first_option_on_screen;
154
155 while (j < option) {
156 if (option_is_visible(j))
157 i++;
158 j++;
159 }
160
161 return INDEX_TOP + i;
162 }
163
164
165 /*
166 * returns the number of an option
167 */
168 static int
169 get_option_num(
170 enum option_enum option)
171 {
172 enum option_enum i;
173 int result = 0;
174
175 for (i = 0; i < option && result < (int) last_opt; i = next_option(i, FALSE))
176 result++;
177
178 return result;
179 }
180
181
182 /*
183 * returns the option with the given number
184 */
185 static enum option_enum
186 set_option_num(
187 int num)
188 {
189 enum option_enum result = 0;
190
191 while (num > 0 && result < last_opt) {
192 result = next_option(result, FALSE);
193 num--;
194 }
195 return result;
196 }
197
198
199 /*
200 * returns TRUE if an option is visible in the menu
201 */
202 t_bool
203 option_is_visible(
204 enum option_enum option)
205 {
206 switch (option) {
207 #ifdef HAVE_COLOR
208 case OPT_COL_BACK:
209 case OPT_COL_FROM:
210 case OPT_COL_HEAD:
211 case OPT_COL_HELP:
212 case OPT_COL_INVERS_BG:
213 case OPT_COL_INVERS_FG:
214 case OPT_COL_MESSAGE:
215 case OPT_COL_MINIHELP:
216 case OPT_COL_NEWSHEADERS:
217 case OPT_COL_NORMAL:
218 case OPT_COL_QUOTE:
219 case OPT_COL_QUOTE2:
220 case OPT_COL_QUOTE3:
221 case OPT_COL_EXTQUOTE:
222 case OPT_COL_RESPONSE:
223 case OPT_COL_SIGNATURE:
224 case OPT_COL_SUBJECT:
225 case OPT_COL_TEXT:
226 case OPT_COL_TITLE:
227 case OPT_COL_URLS:
228 case OPT_QUOTE_REGEX:
229 case OPT_QUOTE_REGEX2:
230 case OPT_QUOTE_REGEX3:
231 case OPT_EXTQUOTE_HANDLING:
232 return curr_scope ? FALSE : tinrc.use_color;
233
234 case OPT_COL_MARKSTAR:
235 case OPT_COL_MARKDASH:
236 case OPT_COL_MARKSLASH:
237 case OPT_COL_MARKSTROKE:
238 return curr_scope ? FALSE : (tinrc.word_highlight && tinrc.use_color);
239
240 case OPT_COL_VERBATIM:
241 return curr_scope ? FALSE : (tinrc.verbatim_handling && tinrc.use_color);
242
243 case OPT_EXTQUOTE_REGEX:
244 return curr_scope ? FALSE : (tinrc.extquote_handling && tinrc.use_color);
245 #endif /* HAVE_COLOR */
246
247 case OPT_WORD_H_DISPLAY_MARKS:
248 case OPT_SLASHES_REGEX:
249 case OPT_STARS_REGEX:
250 case OPT_STROKES_REGEX:
251 case OPT_UNDERSCORES_REGEX:
252 return curr_scope ? FALSE : tinrc.word_highlight;
253
254 case OPT_MONO_MARKSTAR:
255 case OPT_MONO_MARKDASH:
256 case OPT_MONO_MARKSLASH:
257 case OPT_MONO_MARKSTROKE:
258 #ifdef HAVE_COLOR
259 return curr_scope ? FALSE : (tinrc.word_highlight && !tinrc.use_color);
260 #else
261 return curr_scope ? FALSE : tinrc.word_highlight;
262 #endif /* HAVE_COLOR */
263
264 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
265 case OPT_UTF8_GRAPHICS:
266 return curr_scope ? FALSE : IS_LOCAL_CHARSET("UTF-8");
267 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
268
269 case OPT_VERBATIM_BEGIN_REGEX:
270 case OPT_VERBATIM_END_REGEX:
271 return curr_scope ? FALSE : tinrc.verbatim_handling;
272
273 #ifndef USE_CURSES
274 case OPT_STRIP_BLANKS:
275 #endif /* !USE_CURSES */
276 case OPT_GETART_LIMIT_OPTIONS:
277 return curr_scope ? FALSE : TRUE;
278
279 #ifdef HAVE_COLOR
280 case OPT_COLOR_OPTIONS:
281 return curr_scope ? tinrc.use_color : TRUE;
282 #endif /* HAVE_COLOR */
283
284 case OPT_DISPLAY_OPTIONS:
285 case OPT_FILTERING_OPTIONS:
286 case OPT_SAVING_OPTIONS:
287 case OPT_POSTING_OPTIONS:
288 case OPT_EXPERT_OPTIONS:
289 return TRUE;
290
291 case OPT_ATTRIB_ADD_POSTED_TO_FILTER:
292 case OPT_ATTRIB_ADVERTISING:
293 case OPT_ATTRIB_ALTERNATIVE_HANDLING:
294 case OPT_ATTRIB_ASK_FOR_METAMAIL:
295 case OPT_ATTRIB_AUTO_CC_BCC:
296 case OPT_ATTRIB_AUTO_LIST_THREAD:
297 case OPT_ATTRIB_AUTO_SELECT:
298 case OPT_ATTRIB_BATCH_SAVE:
299 case OPT_ATTRIB_DATE_FORMAT:
300 case OPT_ATTRIB_DELETE_TMP_FILES:
301 case OPT_ATTRIB_EDITOR_FORMAT:
302 case OPT_ATTRIB_FCC:
303 case OPT_ATTRIB_FOLLOWUP_TO:
304 case OPT_ATTRIB_FROM:
305 case OPT_ATTRIB_GROUP_CATCHUP_ON_EXIT:
306 case OPT_ATTRIB_GROUP_FORMAT:
307 #ifdef HAVE_ISPELL
308 case OPT_ATTRIB_ISPELL:
309 #endif /* HAVE_ISPELL */
310 case OPT_ATTRIB_MAILDIR:
311 case OPT_ATTRIB_MAIL_8BIT_HEADER:
312 case OPT_ATTRIB_MAIL_MIME_ENCODING:
313 case OPT_ATTRIB_MAILING_LIST:
314 case OPT_ATTRIB_MARK_IGNORE_TAGS:
315 case OPT_ATTRIB_MARK_SAVED_READ:
316 case OPT_ATTRIB_MIME_FORWARD:
317 case OPT_ATTRIB_MIME_TYPES_TO_SAVE:
318 case OPT_ATTRIB_NEWS_HEADERS_TO_DISPLAY:
319 case OPT_ATTRIB_NEWS_HEADERS_TO_NOT_DISPLAY:
320 case OPT_ATTRIB_NEWS_QUOTE_FORMAT:
321 case OPT_ATTRIB_ORGANIZATION:
322 case OPT_ATTRIB_POST_8BIT_HEADER:
323 case OPT_ATTRIB_POST_MIME_ENCODING:
324 case OPT_ATTRIB_POST_PROCESS_VIEW:
325 case OPT_ATTRIB_POS_FIRST_UNREAD:
326 case OPT_ATTRIB_QUICK_KILL_HEADER:
327 case OPT_ATTRIB_QUICK_KILL_SCOPE:
328 case OPT_ATTRIB_QUICK_KILL_EXPIRE:
329 case OPT_ATTRIB_QUICK_KILL_CASE:
330 case OPT_ATTRIB_QUICK_SELECT_HEADER:
331 case OPT_ATTRIB_QUICK_SELECT_SCOPE:
332 case OPT_ATTRIB_QUICK_SELECT_EXPIRE:
333 case OPT_ATTRIB_QUICK_SELECT_CASE:
334 #ifndef DISABLE_PRINTING
335 case OPT_ATTRIB_PRINT_HEADER:
336 #endif /* !DISABLE_PRINTING */
337 case OPT_ATTRIB_PROCESS_ONLY_UNREAD:
338 case OPT_ATTRIB_PROMPT_FOLLOWUPTO:
339 case OPT_ATTRIB_QUOTE_CHARS:
340 case OPT_ATTRIB_SAVEDIR:
341 case OPT_ATTRIB_SAVEFILE:
342 case OPT_ATTRIB_SHOW_AUTHOR:
343 case OPT_ATTRIB_SHOW_ONLY_UNREAD_ARTS:
344 case OPT_ATTRIB_SHOW_SIGNATURES:
345 case OPT_ATTRIB_SIGDASHES:
346 case OPT_ATTRIB_SIGFILE:
347 case OPT_ATTRIB_SIGNATURE_REPOST:
348 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
349 case OPT_ATTRIB_SUPPRESS_SOFT_HYPHENS:
350 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
351 case OPT_ATTRIB_THREAD_ARTICLES:
352 case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
353 case OPT_ATTRIB_THREAD_FORMAT:
354 case OPT_ATTRIB_THREAD_PERC:
355 case OPT_ATTRIB_TRIM_ARTICLE_BODY:
356 case OPT_ATTRIB_TEX2ISO_CONV:
357 case OPT_ATTRIB_SORT_THREADS_TYPE:
358 #ifdef CHARSET_CONVERSION
359 case OPT_ATTRIB_MM_NETWORK_CHARSET:
360 case OPT_ATTRIB_UNDECLARED_CHARSET:
361 #endif /* CHARSET_CONVERSION */
362 case OPT_ATTRIB_VERBATIM_HANDLING:
363 case OPT_ATTRIB_WRAP_ON_NEXT_UNREAD:
364 case OPT_ATTRIB_SORT_ARTICLE_TYPE:
365 case OPT_ATTRIB_POST_PROCESS_TYPE:
366 case OPT_ATTRIB_X_BODY:
367 case OPT_ATTRIB_X_COMMENT_TO:
368 case OPT_ATTRIB_X_HEADERS:
369 return curr_scope ? TRUE : FALSE;
370
371 #ifdef HAVE_COLOR
372 case OPT_ATTRIB_EXTQUOTE_HANDLING:
373 return curr_scope ? tinrc.use_color : FALSE;
374 #endif /* HAVE_COLOR */
375
376 default:
377 return curr_scope ? FALSE : TRUE;
378 }
379 }
380
381
382 /*
383 * returns TRUE if option is OPT_TITLE else FALSE
384 */
385 static t_bool
386 option_is_title(
387 enum option_enum option)
388 {
389 return option_table[option].var_type == OPT_TITLE;
390 }
391
392
393 /*
394 * returns TRUE if option is on the current page else FALSE
395 */
396 static t_bool
397 option_on_page(
398 enum option_enum option)
399 {
400 return ((option >= first_option_on_screen) && (option <= last_option_on_screen));
401 }
402
403
404 char *
405 fmt_option_prompt(
406 char *dst,
407 size_t len,
408 t_bool editing,
409 enum option_enum option)
410 {
411 char *buf;
412 size_t option_width = (size_t) MAX(35, cCOLS / 2 - 9);
413 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
414 wchar_t *wbuf, *wbuf2;
415
416 /* convert the option text to wchar_t */
417 wbuf = char2wchar_t(_(option_table[option].txt->opt));
418 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
419
420 if (!option_is_title(option)) {
421 char flag;
422 int num = get_option_num(option);
423
424 flag = (curr_scope && check_state(option)) ? '+' : ' ';
425 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
426 if (wbuf != NULL) {
427 wbuf2 = wstrunc(wbuf, (int) option_width);
428 if ((buf = wchar_t2char(wbuf2)) == NULL) {
429 /* conversion failed, truncate original string */
430 buf = strunc(_(option_table[option].txt->opt), (int) option_width);
431 snprintf(dst, len, "%s %c%3d %-*.*s: ", editing ? "->" : " ", flag, num, (int) option_width, (int) option_width, buf);
432 } else
433 snprintf(dst, len, "%s %c%3d %-*.*s: ", editing ? "->" : " ", flag, num,
434 (int) (strlen(buf) + option_width - (size_t) wcswidth(wbuf2, option_width + 1)),
435 (int) (strlen(buf) + option_width - (size_t) wcswidth(wbuf2, option_width + 1)), buf);
436 free(wbuf2);
437 } else
438 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
439 {
440 /* truncate original string */
441 buf = strunc(_(option_table[option].txt->opt), (int) option_width);
442 snprintf(dst, len, "%s %c%3d %-*.*s: ", editing ? "->" : " ", flag, num, (int) option_width, (int) option_width, buf);
443 }
444 } else {
445 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
446 if (wbuf != NULL) {
447 wbuf2 = wstrunc(wbuf, cCOLS - 3);
448 if ((buf = wchar_t2char(wbuf2)) == NULL) /* conversion failed, truncate original string */
449 buf = strunc(_(option_table[option].txt->opt), cCOLS - 3);
450 free(wbuf2);
451 } else
452 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
453 buf = strunc(_(option_table[option].txt->opt), cCOLS - 3); /* truncate original string */
454 snprintf(dst, len, " %s", buf);
455 }
456
457 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
458 FreeIfNeeded(wbuf);
459 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
460 FreeIfNeeded(buf);
461 return dst;
462 }
463
464
465 static void
466 print_any_option(
467 enum option_enum option)
468 {
469 constext **list;
470 char temp[LEN], *ptr, *ptr2;
471 int row = option_row(option);
472 size_t len = sizeof(temp) - 1;
473 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE) && defined(USE_CURSES)
474 char *buf;
475 #endif /* MULTIBYTE_ABLE && !NO_LOCALE && USE_CURSES */
476
477 MoveCursor(row, 0);
478
479 ptr = fmt_option_prompt(temp, len, FALSE, option);
480 ptr += strlen(temp);
481 len -= strlen(temp);
482
483 switch (option_table[option].var_type) {
484 case OPT_ON_OFF:
485 /* %-3s to match the length of OFF */
486 snprintf(ptr, len, "%-3s", print_boolean(*OPT_ON_OFF_list[option_table[option].var_index]));
487 break;
488
489 case OPT_LIST:
490 list = option_table[option].opt_list;
491 ptr2 = my_strdup(list[*(option_table[option].variable) + ((strcasecmp(_(list[0]), _(txt_default)) == 0) ? 1 : 0)]);
492 strncpy(ptr, _(ptr2), len);
493 free(ptr2);
494 break;
495
496 case OPT_STRING:
497 strncpy(ptr, OPT_STRING_list[option_table[option].var_index], len);
498 break;
499
500 case OPT_NUM:
501 snprintf(ptr, len, "%d", *(option_table[option].variable));
502 break;
503
504 case OPT_CHAR:
505 snprintf(ptr, len, "%"T_CHAR_FMT, *OPT_CHAR_list[option_table[option].var_index]);
506 break;
507
508 default:
509 break;
510 }
511 #ifdef USE_CURSES
512 # if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
513 if ((buf = spart(temp, cCOLS - 1, FALSE)) != NULL) {
514 my_printf("%s", buf);
515 free(buf);
516 } else
517 # endif /* MULTIBYTE_ABLE && !NO_LOCALE */
518 my_printf("%.*s", cCOLS - 1, temp);
519 {
520 # if 1 /* portable enough? */
521 int x = getcurx(stdscr);
522 # else
523 int y, x;
524
525 getyx(stdscr, y, x);
526 # endif /* 1 */
527 if (x < cCOLS)
528 clrtoeol();
529 }
530 #else
531 my_printf("%.*s", cCOLS - 1, temp);
532 /* draw_arrow_mark() will read this back for repainting */
533 if (tinrc.strip_blanks)
534 strncpy(screen[row - INDEX_TOP].col, temp, (size_t) (cCOLS - 1));
535 else
536 snprintf(screen[row - INDEX_TOP].col, (size_t) cCOLS, "%-*s", cCOLS - 1, temp);
537 #endif /* USE_CURSES */
538 }
539
540
541 static void
542 repaint_option(
543 enum option_enum option)
544 {
545 if (option_on_page(option))
546 print_any_option(option);
547 }
548
549
550 #ifdef USE_CURSES
551 static void
552 do_scroll(
553 int jump)
554 {
555 scrollok(stdscr, TRUE);
556 MoveCursor(INDEX_TOP, 0);
557 SetScrollRegion(INDEX_TOP, INDEX_TOP + option_lines_per_page - 1);
558 ScrollScreen(jump);
559 SetScrollRegion(0, LINES - 1);
560 scrollok(stdscr, FALSE);
561 }
562 #endif /* USE_CURSES */
563
564
565 /*
566 * returns the option after moving 'move' positions up or down
567 * updates also first_option_on_screen and last_option_on screen accordingly
568 */
569 static enum option_enum
570 move_cursor(
571 enum option_enum cur_option,
572 t_bool down)
573 {
574 enum option_enum old_option = cur_option;
575
576 if (down) { /* move down */
577 do {
578 cur_option = next_option(cur_option, TRUE);
579 if (cur_option > last_option_on_screen) {
580 /* move the markers one option down */
581 last_option_on_screen = cur_option;
582 first_option_on_screen = next_option(first_option_on_screen, TRUE);
583 #ifdef USE_CURSES
584 do_scroll(1);
585 print_any_option(cur_option);
586 #else
587 show_config_page();
588 #endif /* USE_CURSES */
589 } else if (cur_option < first_option_on_screen) {
590 /* wrap around: set to begin of option list */
591 first_option_on_screen = cur_option;
592 set_last_option_on_screen(cur_option);
593 show_config_page();
594 }
595 } while (option_is_title(cur_option) && old_option != cur_option);
596 } else { /* move up */
597 do {
598 cur_option = prev_option(cur_option, TRUE);
599 if (cur_option < first_option_on_screen) {
600 /* move the markers one option up */
601 first_option_on_screen = cur_option;
602 set_last_option_on_screen(cur_option);
603 #ifdef USE_CURSES
604 do_scroll(-1);
605 print_any_option(cur_option);
606 #else
607 show_config_page();
608 #endif /* USE_CURSES */
609 } else if (cur_option > last_option_on_screen) {
610 /* wrap around: set to end of option list */
611 last_option_on_screen = cur_option;
612 set_first_option_on_screen(cur_option);
613 show_config_page();
614 }
615 } while (option_is_title(cur_option) && old_option != cur_option);
616 }
617 return cur_option;
618 }
619
620
621 /*
622 * scroll the screen one line down
623 * the selected option is only moved if it is scrolled off the screen
624 */
625 static enum option_enum
626 opt_scroll_down(
627 enum option_enum option)
628 {
629 if (last_option_on_screen < last_opt) {
630 first_option_on_screen = next_option(first_option_on_screen, TRUE);
631 set_last_option_on_screen(first_option_on_screen);
632 #ifdef USE_CURSES
633 do_scroll(1);
634 print_any_option(last_option_on_screen);
635 stow_cursor();
636 #else
637 show_config_page();
638 #endif /* USE_CURSES */
639 if (option < first_option_on_screen) {
640 option = first_option_on_screen;
641 if (option_is_title(option))
642 option = next_option(option, FALSE);
643 #ifdef USE_CURSES
644 highlight_option(option);
645 #endif /* USE_CURSES */
646 }
647 #ifndef USE_CURSES
648 /* in the !USE_CURSES case we must always highlight the option */
649 highlight_option(option);
650 #endif /* !USE_CURSES */
651 }
652 return option;
653 }
654
655
656 /*
657 * scroll the screen one line up
658 * the selected option is only moved if it is scrolled off the screen
659 */
660 static enum option_enum
661 opt_scroll_up(
662 enum option_enum option)
663 {
664 if (first_option_on_screen > 0) {
665 first_option_on_screen = prev_option(first_option_on_screen, TRUE);
666 set_last_option_on_screen(first_option_on_screen);
667 #ifdef USE_CURSES
668 do_scroll(-1);
669 print_any_option(first_option_on_screen);
670 stow_cursor();
671 #else
672 show_config_page();
673 #endif /* USE_CURSES */
674 if (option > last_option_on_screen) {
675 option = last_option_on_screen;
676 if (option_is_title(option))
677 option = prev_option(option, FALSE);
678 #ifdef USE_CURSES
679 highlight_option(option);
680 #endif /* USE_CURSES */
681 }
682 #ifndef USE_CURSES
683 /* in the !USE_CURSES case we must always highlight the option */
684 highlight_option(option);
685 #endif /* !USE_CURSES */
686 }
687 return option;
688 }
689
690
691 /*
692 * returns the next visible option
693 * if 'incl_titles' is TRUE titles are also returned else they are skipped
694 */
695 static enum option_enum
696 next_option(
697 enum option_enum option,
698 t_bool incl_titles)
699 {
700 do {
701 option++;
702 if (option > last_opt)
703 option = 0;
704 } while (!(option_is_visible(option) && (incl_titles || !option_is_title(option))));
705
706 return option;
707 }
708
709
710 /*
711 * returns the previous visible option
712 * if 'incl_titles' is TRUE titles are also returned else they are skipped
713 */
714 static enum option_enum
715 prev_option(
716 enum option_enum option,
717 t_bool incl_titles)
718 {
719 do {
720 if (option == 0)
721 option = last_opt;
722 else
723 option--;
724 } while (!(option_is_visible(option) && (incl_titles || !option_is_title(option))));
725
726 return option;
727 }
728
729
730 /*
731 * set first_option_on_screen in such way that 'last_option' will be
732 * the last option on the screen
733 */
734 static void
735 set_first_option_on_screen(
736 enum option_enum last_option)
737 {
738 int i;
739
740 first_option_on_screen = last_option;
741 for (i = 1; i < option_lines_per_page && first_option_on_screen > 0; i++)
742 first_option_on_screen = prev_option(first_option_on_screen, TRUE);
743
744 /*
745 * make sure that the first page is used completely
746 */
747 if (first_option_on_screen == 0)
748 set_last_option_on_screen(0);
749 }
750
751
752 /*
753 * set last_option_on_screen in such way that 'first_option' will be
754 * the first option on the screen
755 */
756 static void
757 set_last_option_on_screen(
758 enum option_enum first_option)
759 {
760 int i;
761
762 last_option_on_screen = first_option;
763 /*
764 * on last page, there need not be option_lines_per_page options
765 */
766 for (i = 1; i < option_lines_per_page && last_option_on_screen < last_opt; i++)
767 last_option_on_screen = next_option(last_option_on_screen, TRUE);
768 }
769
770
771 static void
772 highlight_option(
773 enum option_enum option)
774 {
775 refresh_config_page(option); /* to keep refresh_config_page():last_option up-to-date */
776 draw_arrow_mark(option_row(option));
777 info_message("%s", _(option_table[option].txt->opt));
778 }
779
780
781 static void
782 unhighlight_option(
783 enum option_enum option)
784 {
785 /* Astonishing hack */
786 t_menu *savemenu = currmenu;
787 t_menu cfgmenu = { 0, 1, 0, NULL, NULL, NULL };
788
789 currmenu = &cfgmenu;
790 currmenu->curr = option_row(option) - INDEX_TOP;
791 erase_arrow();
792 currmenu = savemenu;
793 clear_message();
794 }
795
796
797 /*
798 * Refresh the config page which holds the actual option. If act_option is
799 * smaller zero fall back on the last given option (first option if there was
800 * no last option) and refresh the screen.
801 */
802 void
803 refresh_config_page(
804 enum option_enum act_option)
805 {
806 static enum option_enum last_option = 0;
807 /* t_bool force_redraw = FALSE; */
808
809 if (act_option == SIGNAL_HANDLER) { /* called by signal handler */
810 /* force_redraw = TRUE; */
811 act_option = last_option;
812 set_last_option_on_screen(first_option_on_screen); /* terminal size may have changed */
813 if (!option_on_page(last_option)) {
814 last_option_on_screen = last_option;
815 set_first_option_on_screen(last_option);
816 }
817 redraw_screen(last_option);
818 }
819 last_option = act_option;
820 }
821
822
823 static void
824 redraw_screen(
825 enum option_enum option)
826 {
827 show_config_page();
828 highlight_option(option);
829 }
830
831
832 /*
833 * show_menu_help
834 */
835 void
836 show_menu_help(
837 const char *help_message)
838 {
839 MoveCursor(cLINES - 2, 0);
840 CleartoEOLN();
841 center_line(cLINES - 2, FALSE, _(help_message));
842 }
843
844
845 /*
846 * display current configuration page
847 */
848 static void
849 show_config_page(
850 void)
851 {
852 enum option_enum i;
853
854 signal_context = curr_scope ? cAttrib : cConfig;
855 mark_offset = 0;
856
857 ClearScreen();
858 center_line(0, TRUE, curr_scope ? curr_scope->scope : _(txt_options_menu));
859
860 for (i = first_option_on_screen; i <= last_option_on_screen; i++) {
861 while (!option_is_visible(i))
862 i++;
863 if (i > last_opt)
864 break;
865 print_any_option(i);
866 }
867
868 show_menu_help(txt_select_config_file_option);
869 my_flush();
870 stow_cursor();
871 }
872
873
874 /*
875 * Check if score_kill is <= score_limit_kill and if score_select >= score_limit_select
876 */
877 void
878 check_score_defaults(
879 void)
880 {
881 if (tinrc.score_kill > tinrc.score_limit_kill)
882 tinrc.score_kill = tinrc.score_limit_kill;
883
884 if (tinrc.score_select < tinrc.score_limit_select)
885 tinrc.score_select = tinrc.score_limit_select;
886 }
887
888
889 static t_function
890 option_left(
891 void)
892 {
893 return GLOBAL_QUIT;
894 }
895
896
897 static t_function
898 option_right(
899 void)
900 {
901 return CONFIG_SELECT;
902 }
903
904
905 /*
906 * set last_opt to the last visible option
907 */
908 static void
909 set_last_opt(
910 void)
911 {
912 enum option_enum i;
913
914 for (i = 0; i <= LAST_OPT; i++) {
915 if (option_is_visible(i))
916 last_opt = i;
917 }
918 }
919
920
921 /*
922 * returns the first visible option
923 */
924 static enum option_enum
925 get_first_opt(
926 void)
927 {
928 enum option_enum i;
929
930 for (i = 0; i <= last_opt; i++) {
931 if (option_is_visible(i) && !option_is_title(i))
932 break;
933 }
934 return i;
935 }
936
937
938 /*
939 * options menu so that the user can dynamically change parameters
940 */
941 void
942 config_page(
943 const char *grpname,
944 enum context level)
945 {
946 char key[MAXKEYLEN];
947 enum option_enum option, old_option;
948 enum {
949 NOT_CHANGED = 0,
950 MISC_OPTS = 1 << 0,
951 DISPLAY_OPTS = 1 << 1,
952 SCORE_OPTS = 1 << 2,
953 SHOW_AUTHOR = 1 << 3,
954 SHOW_ONLY_UNREAD = 1 << 4,
955 SORT_OPTS = 1 << 5,
956 THREAD_ARTS = 1 << 6,
957 THREAD_SCORE = 1 << 7,
958 TEX2ISO_CONV = 1 << 8
959 } changed = NOT_CHANGED;
960 int i, scope_idx = 0;
961 t_bool change_option = FALSE;
962 t_function func;
963 #ifdef CHARSET_CONVERSION
964 t_bool is_7bit;
965 #endif /* CHARSET_CONVERSION */
966 unsigned old_show_author = 0, old_show_unread = 0, old_thread_arts = 0;
967
968 if (curr_scope)
969 initialize_attributes();
970 if (grpname && curr_group) {
971 /*
972 * These things can be toggled by the user,
973 * keep a copy of the current value to restore
974 * the state if necessary
975 */
976 old_show_author = curr_group->attribute->show_author;
977 old_show_unread = curr_group->attribute->show_only_unread_arts;
978 old_thread_arts = curr_group->attribute->thread_articles;
979 }
980 set_last_opt();
981 option = get_first_opt();
982 first_option_on_screen = 0;
983 set_last_option_on_screen(0);
984
985 redraw_screen(option);
986 set_xclick_off();
987
988 forever {
989 switch ((func = handle_keypad(option_left, option_right, NULL, option_menu_keys))) {
990 case GLOBAL_QUIT:
991 if (grpname) {
992 if (curr_scope && scope_is_empty()) {
993 /*
994 * Called via TAB from Config 'M'enu and all attributes
995 * have default values -> delete scope
996 */
997 do_delete_scope(scope_idx);
998 curr_scope = NULL;
999 }
1000 if (changed) {
1001 /*
1002 * At least one option or attribute has changed,
1003 * write config files
1004 */
1005 write_config_file(local_config_file);
1006 write_attributes_file(local_attributes_file);
1007 }
1008 }
1009 /* FALLTHROUGH */
1010 case CONFIG_NO_SAVE:
1011 if (grpname && curr_scope) {
1012 /*
1013 * Called via TAB from Config 'M'enu,
1014 * delete scope if all attributes have default values
1015 */
1016 if (scope_is_empty())
1017 do_delete_scope(scope_idx);
1018 curr_scope = NULL;
1019 }
1020 assign_attributes_to_groups();
1021 if (grpname && curr_group) {
1022 /*
1023 * These things can be toggled by the user,
1024 * restore the cached state if no changes were made
1025 */
1026 if (!(changed & SHOW_AUTHOR))
1027 curr_group->attribute->show_author = CAST_BITS(old_show_author, show_author);
1028 if (!(changed & SHOW_ONLY_UNREAD))
1029 curr_group->attribute->show_only_unread_arts = CAST_BOOL(old_show_unread);
1030 if (!(changed & THREAD_ARTS))
1031 curr_group->attribute->thread_articles = CAST_BITS(old_thread_arts, thread_articles);
1032
1033 if (changed) {
1034 t_bool filtered = FALSE;
1035 t_bool old_keep_in_base = TRUE;
1036
1037 /*
1038 * adjust tex2iso_conf parameter
1039 */
1040 if (changed & TEX2ISO_CONV) {
1041 if (pgart.raw) {
1042 if (curr_group->attribute->tex2iso_conv)
1043 pgart.tex2iso = is_art_tex_encoded(pgart.raw);
1044 else
1045 pgart.tex2iso = FALSE;
1046 /* force recooking the current article */
1047 changed |= DISPLAY_OPTS;
1048 }
1049 }
1050 /*
1051 * recook if an article is open
1052 */
1053 if (changed & DISPLAY_OPTS) {
1054 if (pgart.raw)
1055 resize_article(TRUE, &pgart);
1056 }
1057 /*
1058 * Clear art->keep_in_base if switching to !show_only_unread_arts
1059 */
1060 if ((changed & SHOW_ONLY_UNREAD) && !curr_group->attribute->show_only_unread_arts) {
1061 for_each_art(i)
1062 arts[i].keep_in_base = FALSE;
1063 }
1064
1065 if (changed & SCORE_OPTS) {
1066 unfilter_articles(curr_group);
1067 read_filter_file(filter_file);
1068 filtered = filter_articles(curr_group);
1069 }
1070 /*
1071 * If the sorting/threading strategy of threads or filter options have
1072 * changed, fix things so that resorting will occur
1073 *
1074 * If show_only_unread_arts or the scoring of a thread has changed,
1075 * resort base[] (find_base() is called inside make_threads() too, so
1076 * do this only if make_threads() was not called before)
1077 *
1078 * If we were called from page level, keep the current article in
1079 * base[]. This prevents that find_base() removes the current article
1080 * after switching to show_only_unread.
1081 */
1082 if (level == cPage) {
1083 old_keep_in_base = arts[this_resp].keep_in_base;
1084 arts[this_resp].keep_in_base = TRUE;
1085 }
1086 if (changed & (THREAD_ARTS | SORT_OPTS))
1087 make_threads(curr_group, TRUE);
1088 else if (filtered)
1089 make_threads(curr_group, FALSE);
1090 else if (changed & (SHOW_ONLY_UNREAD | THREAD_SCORE))
1091 find_base(curr_group);
1092
1093 if (level == cPage)
1094 arts[this_resp].keep_in_base = CAST_BOOL(old_keep_in_base);
1095 }
1096 }
1097 clear_note_area();
1098 return;
1099
1100 case GLOBAL_BUGREPORT:
1101 bug_report();
1102 redraw_screen(option);
1103 break;
1104
1105 case GLOBAL_HELP:
1106 if (curr_scope)
1107 show_help_page(ATTRIB_LEVEL, _(txt_attrib_menu_com));
1108 else
1109 show_help_page(CONFIG_LEVEL, _(txt_options_menu_com));
1110 redraw_screen(option);
1111 break;
1112
1113 case GLOBAL_LINE_UP:
1114 unhighlight_option(option);
1115 option = move_cursor(option, FALSE);
1116 highlight_option(option);
1117 break;
1118
1119 case GLOBAL_LINE_DOWN:
1120 unhighlight_option(option);
1121 option = move_cursor(option, TRUE);
1122 highlight_option(option);
1123 break;
1124
1125 case GLOBAL_FIRST_PAGE:
1126 unhighlight_option(option);
1127 option = get_first_opt();
1128 first_option_on_screen = 0;
1129 set_last_option_on_screen(0);
1130 redraw_screen(option);
1131 /* highlight_option(option); is already done by redraw_screen() */
1132 break;
1133
1134 case GLOBAL_LAST_PAGE:
1135 unhighlight_option(option);
1136 option = last_opt;
1137 last_option_on_screen = last_opt;
1138 set_first_option_on_screen(last_opt);
1139 redraw_screen(option);
1140 /* highlight_option(option); is already done by redraw_screen() */
1141 break;
1142
1143 case GLOBAL_PAGE_UP:
1144 unhighlight_option(option);
1145 if (option != first_option_on_screen && !(option_is_title(first_option_on_screen) && option == next_option(first_option_on_screen, FALSE))) {
1146 option = first_option_on_screen;
1147 if (option_is_title(option))
1148 option = next_option(option, FALSE);
1149 highlight_option(option);
1150 break;
1151 } else if (tinrc.scroll_lines == -2 && first_option_on_screen != 0) {
1152 i = option_lines_per_page / 2;
1153
1154 for (; i > 0; i--) {
1155 last_option_on_screen = prev_option(last_option_on_screen, TRUE);
1156 if (last_option_on_screen == last_opt) /* end on wrap around */
1157 break;
1158 }
1159 } else
1160 last_option_on_screen = prev_option(first_option_on_screen, TRUE);
1161
1162 set_first_option_on_screen(last_option_on_screen);
1163 if (last_option_on_screen == last_opt)
1164 option = last_option_on_screen;
1165 else
1166 option = first_option_on_screen;
1167 if (option_is_title(option))
1168 option = next_option(option, FALSE);
1169 redraw_screen(option);
1170 /* highlight_option(option); is already done by redraw_screen() */
1171 break;
1172
1173 case GLOBAL_PAGE_DOWN:
1174 unhighlight_option(option);
1175 if (option == last_opt) {
1176 /* wrap around */
1177 first_option_on_screen = 0;
1178 option = 0;
1179 } else {
1180 enum option_enum old_first = first_option_on_screen;
1181
1182 if (tinrc.scroll_lines == -2) {
1183 i = option_lines_per_page / 2;
1184
1185 for (; i > 0; i--) {
1186 first_option_on_screen = next_option(first_option_on_screen, TRUE);
1187 if (first_option_on_screen == 0) /* end on wrap_around */
1188 break;
1189 }
1190 } else
1191 first_option_on_screen = next_option(last_option_on_screen, TRUE);
1192
1193 if (first_option_on_screen == 0) {
1194 first_option_on_screen = old_first;
1195 option = last_opt;
1196 highlight_option(option);
1197 break;
1198 } else
1199 option = first_option_on_screen;
1200 }
1201
1202 set_last_option_on_screen(first_option_on_screen);
1203 if (option_is_title(option))
1204 option = next_option(option, FALSE);
1205 redraw_screen(option);
1206 /* highlight_option(option); is already done by redraw_screen() */
1207 break;
1208
1209 case GLOBAL_SCROLL_UP:
1210 option = opt_scroll_up(option);
1211 break;
1212
1213 case GLOBAL_SCROLL_DOWN:
1214 option = opt_scroll_down(option);
1215 break;
1216
1217 case DIGIT_1:
1218 case DIGIT_2:
1219 case DIGIT_3:
1220 case DIGIT_4:
1221 case DIGIT_5:
1222 case DIGIT_6:
1223 case DIGIT_7:
1224 case DIGIT_8:
1225 case DIGIT_9:
1226 unhighlight_option(option);
1227 option = set_option_num(prompt_num(func_to_key(func, option_menu_keys), _(txt_enter_option_num)));
1228 if (!option_on_page(option)) {
1229 first_option_on_screen = option;
1230 set_last_option_on_screen(option);
1231 redraw_screen(option);
1232 } else
1233 highlight_option(option);
1234 break;
1235
1236 #ifndef NO_SHELL_ESCAPE
1237 case GLOBAL_SHELL_ESCAPE:
1238 shell_escape();
1239 redraw_screen(option);
1240 break;
1241 #endif /* !NO_SHELL_ESCAPE */
1242
1243 case GLOBAL_SEARCH_SUBJECT_FORWARD:
1244 case GLOBAL_SEARCH_SUBJECT_BACKWARD:
1245 case GLOBAL_SEARCH_REPEAT:
1246 if (func == GLOBAL_SEARCH_REPEAT && last_search != GLOBAL_SEARCH_SUBJECT_FORWARD && last_search != GLOBAL_SEARCH_SUBJECT_BACKWARD)
1247 info_message(_(txt_no_prev_search));
1248 else {
1249 old_option = option;
1250 option = search_config((func == GLOBAL_SEARCH_SUBJECT_FORWARD), (func == GLOBAL_SEARCH_REPEAT), option, last_opt);
1251 if (option != old_option) {
1252 unhighlight_option(old_option);
1253 if (!option_on_page(option)) {
1254 first_option_on_screen = option;
1255 set_last_option_on_screen(option);
1256 redraw_screen(option);
1257 } else
1258 highlight_option(option);
1259 }
1260 }
1261 break;
1262
1263 case CONFIG_SCOPE_MENU:
1264 if (!curr_scope) {
1265 scope_page(level);
1266 set_last_opt();
1267 option = get_first_opt();
1268 first_option_on_screen = 0;
1269 set_last_option_on_screen(0);
1270 redraw_screen(option);
1271 }
1272 break;
1273
1274 case CONFIG_RESET_ATTRIB:
1275 if (curr_scope) {
1276 if (curr_scope->global)
1277 info_message(_(txt_scope_operation_not_allowed));
1278 else if (check_state(option)) {
1279 reset_state(option);
1280 changed |= MISC_OPTS;
1281 redraw_screen(option);
1282 }
1283 }
1284 break;
1285
1286 case CONFIG_SELECT:
1287 if (curr_scope && curr_scope->global)
1288 info_message(_(txt_scope_operation_not_allowed));
1289 else
1290 change_option = TRUE;
1291 break;
1292
1293 case CONFIG_TOGGLE_ATTRIB:
1294 if (grpname) {
1295 if (curr_scope) {
1296 if (scope_is_empty()) {
1297 do_delete_scope(scope_idx);
1298 scope_idx = 0;
1299 }
1300 curr_scope = NULL;
1301 } else {
1302 if (!(scope_idx = find_scope(grpname)))
1303 scope_idx = add_scope(grpname);
1304 if (scope_idx) {
1305 curr_scope = &scopes[scope_idx];
1306 initialize_attributes();
1307 }
1308 }
1309 set_last_opt();
1310 option = get_first_opt();
1311 first_option_on_screen = 0;
1312 set_last_option_on_screen(0);
1313 redraw_screen(option);
1314 }
1315 break;
1316
1317 case GLOBAL_REDRAW_SCREEN:
1318 my_retouch();
1319 set_xclick_off();
1320 set_last_option_on_screen(first_option_on_screen);
1321 redraw_screen(option);
1322 break;
1323
1324 case GLOBAL_VERSION:
1325 info_message(cvers);
1326 break;
1327
1328 default:
1329 info_message(_(txt_bad_command), PrintFuncKey(key, GLOBAL_HELP, option_menu_keys));
1330 break;
1331 } /* switch (ch) */
1332
1333 if (change_option) {
1334 switch (option_table[option].var_type) {
1335 case OPT_ON_OFF:
1336 switch (option) {
1337 case OPT_ABBREVIATE_GROUPNAME:
1338 case OPT_AUTO_RECONNECT:
1339 case OPT_CACHE_OVERVIEW_FILES:
1340 case OPT_CATCHUP_READ_GROUPS:
1341 case OPT_FORCE_SCREEN_REDRAW:
1342 case OPT_KEEP_DEAD_ARTICLES:
1343 case OPT_SHOW_ONLY_UNREAD_GROUPS:
1344 case OPT_STRIP_NEWSRC:
1345 #if defined(HAVE_ICONV_OPEN_TRANSLIT) && defined(CHARSET_CONVERSION)
1346 case OPT_TRANSLIT:
1347 #endif /* HAVE_ICONV_OPEN_TRANSLIT && CHARSET_CONVERSION */
1348 case OPT_UNLINK_ARTICLE:
1349 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
1350 case OPT_UTF8_GRAPHICS:
1351 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
1352 case OPT_URL_HIGHLIGHT:
1353 #ifdef HAVE_KEYPAD
1354 case OPT_USE_KEYPAD:
1355 #endif /* HAVE_KEYPAD */
1356 case OPT_USE_MOUSE:
1357 if (prompt_option_on_off(option))
1358 changed |= MISC_OPTS;
1359 break;
1360
1361 case OPT_ADD_POSTED_TO_FILTER:
1362 if (prompt_option_on_off(option))
1363 UPDATE_BOOL_ATTRIBUTES(add_posted_to_filter);
1364 break;
1365
1366 case OPT_ADVERTISING:
1367 if (prompt_option_on_off(option))
1368 UPDATE_BOOL_ATTRIBUTES(advertising);
1369 break;
1370
1371 case OPT_ALTERNATIVE_HANDLING:
1372 if (prompt_option_on_off(option))
1373 UPDATE_BOOL_ATTRIBUTES(alternative_handling);
1374 break;
1375
1376 case OPT_ASK_FOR_METAMAIL:
1377 if (prompt_option_on_off(option))
1378 UPDATE_BOOL_ATTRIBUTES(ask_for_metamail);
1379 break;
1380
1381 case OPT_AUTO_LIST_THREAD:
1382 if (prompt_option_on_off(option))
1383 UPDATE_BOOL_ATTRIBUTES(auto_list_thread);
1384 break;
1385
1386 case OPT_BATCH_SAVE:
1387 if (prompt_option_on_off(option))
1388 UPDATE_BOOL_ATTRIBUTES(batch_save);
1389 break;
1390
1391 #ifdef HAVE_COLOR
1392 case OPT_EXTQUOTE_HANDLING:
1393 /*
1394 * option toggles visibility of other
1395 * options -> needs redraw_screen()
1396 */
1397 if (prompt_option_on_off(option)) {
1398 UPDATE_BOOL_ATTRIBUTES(extquote_handling);
1399 set_last_option_on_screen(first_option_on_screen);
1400 redraw_screen(option);
1401 changed |= DISPLAY_OPTS;
1402 }
1403 break;
1404 #endif /* HAVE_COLOR */
1405
1406 case OPT_GROUP_CATCHUP_ON_EXIT:
1407 if (prompt_option_on_off(option))
1408 UPDATE_BOOL_ATTRIBUTES(group_catchup_on_exit);
1409 break;
1410
1411 case OPT_MARK_IGNORE_TAGS:
1412 if (prompt_option_on_off(option))
1413 UPDATE_BOOL_ATTRIBUTES(mark_ignore_tags);
1414 break;
1415
1416 case OPT_MARK_SAVED_READ:
1417 if (prompt_option_on_off(option))
1418 UPDATE_BOOL_ATTRIBUTES(mark_saved_read);
1419 break;
1420
1421 case OPT_POST_PROCESS_VIEW:
1422 if (prompt_option_on_off(option))
1423 UPDATE_BOOL_ATTRIBUTES(post_process_view);
1424 break;
1425
1426 case OPT_POS_FIRST_UNREAD:
1427 if (prompt_option_on_off(option))
1428 UPDATE_BOOL_ATTRIBUTES(pos_first_unread);
1429 break;
1430
1431 #ifndef DISABLE_PRINTING
1432 case OPT_PRINT_HEADER:
1433 if (prompt_option_on_off(option))
1434 UPDATE_BOOL_ATTRIBUTES(print_header);
1435 break;
1436 #endif /* !DISABLE_PRINTING */
1437
1438 case OPT_PROCESS_ONLY_UNREAD:
1439 if (prompt_option_on_off(option))
1440 UPDATE_BOOL_ATTRIBUTES(process_only_unread);
1441 break;
1442
1443 case OPT_PROMPT_FOLLOWUPTO:
1444 if (prompt_option_on_off(option))
1445 UPDATE_BOOL_ATTRIBUTES(prompt_followupto);
1446 break;
1447
1448 case OPT_SHOW_SIGNATURES:
1449 if (prompt_option_on_off(option)) {
1450 UPDATE_BOOL_ATTRIBUTES(show_signatures);
1451 changed |= DISPLAY_OPTS;
1452 }
1453 break;
1454
1455 case OPT_SIGDASHES:
1456 if (prompt_option_on_off(option))
1457 UPDATE_BOOL_ATTRIBUTES(sigdashes);
1458 break;
1459
1460 case OPT_SIGNATURE_REPOST:
1461 if (prompt_option_on_off(option))
1462 UPDATE_BOOL_ATTRIBUTES(signature_repost);
1463 break;
1464
1465 #ifndef USE_CURSES
1466 case OPT_STRIP_BLANKS:
1467 if (prompt_option_on_off(option)) {
1468 redraw_screen(option);
1469 changed |= MISC_OPTS;
1470 }
1471 break;
1472 #endif /* !USE_CURSES */
1473
1474 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
1475 case OPT_SUPPRESS_SOFT_HYPHENS:
1476 if (prompt_option_on_off(option)) {
1477 UPDATE_BOOL_ATTRIBUTES(suppress_soft_hyphens);
1478 changed |= DISPLAY_OPTS;
1479 }
1480 break;
1481 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
1482
1483 case OPT_TEX2ISO_CONV:
1484 if (prompt_option_on_off(option)) {
1485 UPDATE_BOOL_ATTRIBUTES(tex2iso_conv);
1486 changed |= TEX2ISO_CONV;
1487 }
1488 break;
1489
1490 case OPT_THREAD_CATCHUP_ON_EXIT:
1491 if (prompt_option_on_off(option))
1492 UPDATE_BOOL_ATTRIBUTES(thread_catchup_on_exit);
1493 break;
1494
1495 case OPT_WRAP_ON_NEXT_UNREAD:
1496 if (prompt_option_on_off(option))
1497 UPDATE_BOOL_ATTRIBUTES(wrap_on_next_unread);
1498 break;
1499
1500 case OPT_VERBATIM_HANDLING:
1501 /*
1502 * option toggles visibility of other
1503 * options -> needs redraw_screen()
1504 */
1505 if (prompt_option_on_off(option)) {
1506 UPDATE_BOOL_ATTRIBUTES(verbatim_handling);
1507 set_last_option_on_screen(first_option_on_screen);
1508 redraw_screen(option);
1509 changed |= DISPLAY_OPTS;
1510 }
1511 break;
1512
1513 /* show mini help menu */
1514 case OPT_BEGINNER_LEVEL:
1515 if (prompt_option_on_off(option)) {
1516 set_noteslines(cLINES);
1517 changed |= MISC_OPTS;
1518 }
1519 break;
1520
1521 /* show all arts or just new/unread arts */
1522 case OPT_SHOW_ONLY_UNREAD_ARTS:
1523 if (prompt_option_on_off(option)) {
1524 UPDATE_BOOL_ATTRIBUTES(show_only_unread_arts);
1525 changed |= SHOW_ONLY_UNREAD;
1526 }
1527 break;
1528
1529 /* draw -> / highlighted bar */
1530 case OPT_DRAW_ARROW:
1531 if (prompt_option_on_off(option)) {
1532 unhighlight_option(option);
1533 if (!tinrc.draw_arrow && !tinrc.inverse_okay) {
1534 tinrc.inverse_okay = TRUE;
1535 repaint_option(OPT_INVERSE_OKAY);
1536 center_line(0, TRUE, _(txt_options_menu));
1537 }
1538 changed |= MISC_OPTS;
1539 }
1540 break;
1541
1542 /* draw inversed screen header lines */
1543 /* draw inversed group/article/option line if draw_arrow is OFF */
1544 case OPT_INVERSE_OKAY:
1545 if (prompt_option_on_off(option)) {
1546 unhighlight_option(option);
1547 if (!tinrc.draw_arrow && !tinrc.inverse_okay) {
1548 tinrc.draw_arrow = TRUE; /* we don't want to navigate blindly */
1549 repaint_option(OPT_DRAW_ARROW);
1550 }
1551 center_line(0, TRUE, _(txt_options_menu));
1552 changed |= MISC_OPTS;
1553 }
1554 break;
1555
1556 case OPT_MAIL_8BIT_HEADER:
1557 if (prompt_option_on_off(option)) {
1558 if (tinrc.mail_mime_encoding != MIME_ENCODING_8BIT) {
1559 tinrc.mail_8bit_header = FALSE;
1560 print_any_option(OPT_MAIL_8BIT_HEADER);
1561 }
1562 UPDATE_BOOL_ATTRIBUTES(mail_8bit_header);
1563 }
1564 break;
1565
1566 case OPT_POST_8BIT_HEADER:
1567 if (prompt_option_on_off(option)) {
1568 /* if post_mime_encoding != 8bit, post_8bit_header is disabled */
1569 if (tinrc.post_mime_encoding != MIME_ENCODING_8BIT) {
1570 tinrc.post_8bit_header = FALSE;
1571 print_any_option(OPT_POST_8BIT_HEADER);
1572 }
1573 UPDATE_BOOL_ATTRIBUTES(post_8bit_header);
1574 }
1575 break;
1576
1577 /* show newsgroup description text next to newsgroups */
1578 case OPT_SHOW_DESCRIPTION:
1579 if (prompt_option_on_off(option)) {
1580 show_description = tinrc.show_description;
1581 if (show_description) /* force reread of newgroups file */
1582 read_descriptions(FALSE);
1583 changed |= MISC_OPTS;
1584 }
1585 break;
1586
1587 #ifdef HAVE_COLOR
1588 /* use ANSI color */
1589 case OPT_USE_COLOR:
1590 if (prompt_option_on_off(option)) {
1591 # ifdef USE_CURSES
1592 if (!has_colors())
1593 use_color = FALSE;
1594 else
1595 # endif /* USE_CURSES */
1596 use_color = tinrc.use_color;
1597 set_last_option_on_screen(first_option_on_screen);
1598 redraw_screen(option);
1599 changed |= MISC_OPTS;
1600 }
1601 break;
1602 #endif /* HAVE_COLOR */
1603
1604 #ifdef XFACE_ABLE
1605 /* use slrnface */
1606 case OPT_USE_SLRNFACE:
1607 if (prompt_option_on_off(option)) {
1608 if (!tinrc.use_slrnface)
1609 slrnface_stop();
1610 else
1611 slrnface_start();
1612 changed |= MISC_OPTS;
1613 }
1614 break;
1615 #endif /* XFACE_ABLE */
1616
1617 /* word_highlight */
1618 case OPT_WORD_HIGHLIGHT:
1619 if (prompt_option_on_off(option)) {
1620 word_highlight = tinrc.word_highlight;
1621 set_last_option_on_screen(first_option_on_screen);
1622 redraw_screen(option);
1623 changed |= MISC_OPTS;
1624 }
1625 break;
1626
1627 #if defined(HAVE_LIBICUUC) && defined(MULTIBYTE_ABLE) && defined(HAVE_UNICODE_UBIDI_H) && !defined(NO_LOCALE)
1628 case OPT_RENDER_BIDI:
1629 if (prompt_option_on_off(option))
1630 changed |= MISC_OPTS;
1631 break;
1632 #endif /* HAVE_LIBICUUC && MULTIBYTE_ABLE && HAVE_UNICODE_UBIDI_H && !NO_LOCALE */
1633
1634 case OPT_ATTRIB_ADD_POSTED_TO_FILTER:
1635 if (prompt_option_on_off(option))
1636 SET_BOOL_ATTRIBUTE(add_posted_to_filter);
1637 break;
1638
1639 case OPT_ATTRIB_ADVERTISING:
1640 if (prompt_option_on_off(option))
1641 SET_BOOL_ATTRIBUTE(advertising);
1642 break;
1643
1644 case OPT_ATTRIB_ALTERNATIVE_HANDLING:
1645 if (prompt_option_on_off(option))
1646 SET_BOOL_ATTRIBUTE(alternative_handling);
1647 break;
1648
1649 case OPT_ATTRIB_ASK_FOR_METAMAIL:
1650 if (prompt_option_on_off(option))
1651 SET_BOOL_ATTRIBUTE(ask_for_metamail);
1652 break;
1653
1654 case OPT_ATTRIB_AUTO_LIST_THREAD:
1655 if (prompt_option_on_off(option))
1656 SET_BOOL_ATTRIBUTE(auto_list_thread);
1657 break;
1658
1659 case OPT_ATTRIB_AUTO_SELECT:
1660 if (prompt_option_on_off(option))
1661 SET_BOOL_ATTRIBUTE(auto_select);
1662 break;
1663
1664 case OPT_ATTRIB_BATCH_SAVE:
1665 if (prompt_option_on_off(option))
1666 SET_BOOL_ATTRIBUTE(batch_save);
1667 break;
1668
1669 case OPT_ATTRIB_DELETE_TMP_FILES:
1670 if (prompt_option_on_off(option))
1671 SET_BOOL_ATTRIBUTE(delete_tmp_files);
1672 break;
1673
1674 #ifdef HAVE_COLOR
1675 case OPT_ATTRIB_EXTQUOTE_HANDLING:
1676 if (prompt_option_on_off(option))
1677 SET_BOOL_ATTRIBUTE(extquote_handling);
1678 break;
1679 #endif /* HAVE_COLOR */
1680
1681 case OPT_ATTRIB_GROUP_CATCHUP_ON_EXIT:
1682 if (prompt_option_on_off(option))
1683 SET_BOOL_ATTRIBUTE(group_catchup_on_exit);
1684 break;
1685
1686 case OPT_ATTRIB_MAIL_8BIT_HEADER:
1687 if (prompt_option_on_off(option))
1688 SET_BOOL_ATTRIBUTE(mail_8bit_header);
1689 break;
1690
1691 case OPT_ATTRIB_MARK_IGNORE_TAGS:
1692 if (prompt_option_on_off(option))
1693 SET_BOOL_ATTRIBUTE(mark_ignore_tags);
1694 break;
1695
1696 case OPT_ATTRIB_MARK_SAVED_READ:
1697 if (prompt_option_on_off(option))
1698 SET_BOOL_ATTRIBUTE(mark_saved_read);
1699 break;
1700
1701 case OPT_ATTRIB_MIME_FORWARD:
1702 if (prompt_option_on_off(option))
1703 SET_BOOL_ATTRIBUTE(mime_forward);
1704 break;
1705
1706 case OPT_ATTRIB_POST_8BIT_HEADER:
1707 if (prompt_option_on_off(option))
1708 SET_BOOL_ATTRIBUTE(post_8bit_header);
1709 break;
1710
1711 case OPT_ATTRIB_POST_PROCESS_VIEW:
1712 if (prompt_option_on_off(option))
1713 SET_BOOL_ATTRIBUTE(post_process_view);
1714 break;
1715
1716 case OPT_ATTRIB_POS_FIRST_UNREAD:
1717 if (prompt_option_on_off(option))
1718 SET_BOOL_ATTRIBUTE(pos_first_unread);
1719 break;
1720
1721 #ifndef DISABLE_PRINTING
1722 case OPT_ATTRIB_PRINT_HEADER:
1723 if (prompt_option_on_off(option))
1724 SET_BOOL_ATTRIBUTE(print_header);
1725 break;
1726 #endif /* !DISABLE_PRINTING */
1727
1728 case OPT_ATTRIB_PROCESS_ONLY_UNREAD:
1729 if (prompt_option_on_off(option))
1730 SET_BOOL_ATTRIBUTE(process_only_unread);
1731 break;
1732
1733 case OPT_ATTRIB_PROMPT_FOLLOWUPTO:
1734 if (prompt_option_on_off(option))
1735 SET_BOOL_ATTRIBUTE(prompt_followupto);
1736 break;
1737
1738 case OPT_ATTRIB_QUICK_KILL_CASE:
1739 if (prompt_option_on_off(option))
1740 SET_BOOL_ATTRIBUTE(quick_kill_case);
1741 break;
1742
1743 case OPT_ATTRIB_QUICK_KILL_EXPIRE:
1744 if (prompt_option_on_off(option))
1745 SET_BOOL_ATTRIBUTE(quick_kill_expire);
1746 break;
1747
1748 case OPT_ATTRIB_QUICK_SELECT_CASE:
1749 if (prompt_option_on_off(option))
1750 SET_BOOL_ATTRIBUTE(quick_select_case);
1751 break;
1752
1753 case OPT_ATTRIB_QUICK_SELECT_EXPIRE:
1754 if (prompt_option_on_off(option))
1755 SET_BOOL_ATTRIBUTE(quick_select_expire);
1756 break;
1757
1758 case OPT_ATTRIB_SHOW_ONLY_UNREAD_ARTS:
1759 if (prompt_option_on_off(option)) {
1760 SET_BOOL_ATTRIBUTE(show_only_unread_arts);
1761 changed |= SHOW_ONLY_UNREAD;
1762 }
1763 break;
1764
1765 case OPT_ATTRIB_SHOW_SIGNATURES:
1766 if (prompt_option_on_off(option)) {
1767 SET_BOOL_ATTRIBUTE(show_signatures);
1768 changed |= DISPLAY_OPTS;
1769 }
1770 break;
1771
1772 case OPT_ATTRIB_SIGDASHES:
1773 if (prompt_option_on_off(option))
1774 SET_BOOL_ATTRIBUTE(sigdashes);
1775 break;
1776
1777 case OPT_ATTRIB_SIGNATURE_REPOST:
1778 if (prompt_option_on_off(option))
1779 SET_BOOL_ATTRIBUTE(signature_repost);
1780 break;
1781
1782 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
1783 case OPT_ATTRIB_SUPPRESS_SOFT_HYPHENS:
1784 if (prompt_option_on_off(option)) {
1785 SET_BOOL_ATTRIBUTE(suppress_soft_hyphens);
1786 changed |= DISPLAY_OPTS;
1787 }
1788 break;
1789 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
1790
1791 case OPT_ATTRIB_TEX2ISO_CONV:
1792 if (prompt_option_on_off(option)) {
1793 SET_BOOL_ATTRIBUTE(tex2iso_conv);
1794 changed |= TEX2ISO_CONV;
1795 }
1796 break;
1797
1798 case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
1799 if (prompt_option_on_off(option))
1800 SET_BOOL_ATTRIBUTE(thread_catchup_on_exit);
1801 break;
1802
1803 case OPT_ATTRIB_VERBATIM_HANDLING:
1804 if (prompt_option_on_off(option)) {
1805 SET_BOOL_ATTRIBUTE(verbatim_handling);
1806 changed |= DISPLAY_OPTS;
1807 }
1808 break;
1809
1810 case OPT_ATTRIB_WRAP_ON_NEXT_UNREAD:
1811 if (prompt_option_on_off(option))
1812 SET_BOOL_ATTRIBUTE(wrap_on_next_unread);
1813 break;
1814
1815 case OPT_ATTRIB_X_COMMENT_TO:
1816 if (prompt_option_on_off(option))
1817 SET_BOOL_ATTRIBUTE(x_comment_to);
1818 break;
1819
1820 default:
1821 break;
1822 } /* switch (option) */
1823 break;
1824
1825 case OPT_LIST:
1826 switch (option) {
1827 #ifdef USE_CANLOCK
1828 case OPT_CANCEL_LOCK_ALGO:
1829 #endif /* USE_CANLOCK */
1830 #ifdef HAVE_COLOR
1831 case OPT_COL_FROM:
1832 case OPT_COL_HEAD:
1833 case OPT_COL_HELP:
1834 case OPT_COL_INVERS_BG:
1835 case OPT_COL_INVERS_FG:
1836 case OPT_COL_MESSAGE:
1837 case OPT_COL_MINIHELP:
1838 case OPT_COL_NEWSHEADERS:
1839 case OPT_COL_QUOTE:
1840 case OPT_COL_QUOTE2:
1841 case OPT_COL_QUOTE3:
1842 case OPT_COL_EXTQUOTE:
1843 case OPT_COL_RESPONSE:
1844 case OPT_COL_SIGNATURE:
1845 case OPT_COL_SUBJECT:
1846 case OPT_COL_TEXT:
1847 case OPT_COL_TITLE:
1848 case OPT_COL_MARKSTAR:
1849 case OPT_COL_MARKDASH:
1850 case OPT_COL_MARKSLASH:
1851 case OPT_COL_MARKSTROKE:
1852 case OPT_COL_URLS:
1853 case OPT_COL_VERBATIM:
1854 #endif /* HAVE_COLOR */
1855 case OPT_CONFIRM_CHOICE:
1856 case OPT_GOTO_NEXT_UNREAD:
1857 case OPT_HIDE_UUE:
1858 case OPT_INTERACTIVE_MAILER:
1859 case OPT_KILL_LEVEL:
1860 case OPT_MAILBOX_FORMAT:
1861 case OPT_MONO_MARKDASH:
1862 case OPT_MONO_MARKSLASH:
1863 case OPT_MONO_MARKSTAR:
1864 case OPT_MONO_MARKSTROKE:
1865 #ifdef HAVE_UNICODE_NORMALIZATION
1866 case OPT_NORMALIZATION_FORM:
1867 #endif /* HAVE_UNICODE_NORMALIZATION */
1868 case OPT_QUOTE_STYLE:
1869 case OPT_SHOW_HELP_MAIL_SIGN:
1870 case OPT_STRIP_BOGUS:
1871 case OPT_WILDCARD:
1872 case OPT_WORD_H_DISPLAY_MARKS:
1873 #ifdef USE_HEAPSORT
1874 case OPT_SORT_FUNCTION:
1875 #endif /* USE_HEAPSORT */
1876 if (prompt_option_list(option))
1877 changed |= MISC_OPTS;
1878 break;
1879
1880 #ifdef HAVE_COLOR
1881 case OPT_COL_BACK:
1882 case OPT_COL_NORMAL:
1883 if (prompt_option_list(option)) {
1884 redraw_screen(option);
1885 changed |= MISC_OPTS;
1886 }
1887 break;
1888 #endif /* HAVE_COLOR */
1889
1890 case OPT_AUTO_CC_BCC:
1891 if (prompt_option_list(option))
1892 UPDATE_INT_ATTRIBUTES(auto_cc_bcc);
1893 break;
1894
1895 case OPT_THREAD_ARTICLES:
1896 if (prompt_option_list(option)) {
1897 UPDATE_INT_ATTRIBUTES(thread_articles);
1898 changed |= THREAD_ARTS;
1899 }
1900 break;
1901
1902 case OPT_SORT_ARTICLE_TYPE:
1903 if (prompt_option_list(option)) {
1904 UPDATE_INT_ATTRIBUTES(sort_article_type);
1905 changed |= SORT_OPTS;
1906 }
1907 break;
1908
1909 case OPT_SORT_THREADS_TYPE:
1910 if (prompt_option_list(option)) {
1911 UPDATE_INT_ATTRIBUTES(sort_threads_type);
1912 changed |= SORT_OPTS;
1913 }
1914 break;
1915
1916 case OPT_THREAD_SCORE:
1917 if (prompt_option_list(option))
1918 changed |= THREAD_SCORE;
1919 break;
1920
1921 case OPT_TRIM_ARTICLE_BODY:
1922 if (prompt_option_list(option)) {
1923 UPDATE_INT_ATTRIBUTES(trim_article_body);
1924 changed |= DISPLAY_OPTS;
1925 }
1926 break;
1927
1928 case OPT_POST_PROCESS_TYPE:
1929 if (prompt_option_list(option))
1930 UPDATE_INT_ATTRIBUTES(post_process_type);
1931 break;
1932
1933 case OPT_SHOW_AUTHOR:
1934 if (prompt_option_list(option)) {
1935 UPDATE_INT_ATTRIBUTES(show_author);
1936 changed |= SHOW_AUTHOR;
1937 }
1938 break;
1939
1940 case OPT_MAIL_MIME_ENCODING:
1941 if (prompt_option_list(option)) {
1942 #ifdef CHARSET_CONVERSION
1943 /*
1944 * check if we have selected a !7bit encoding but a 7bit network charset
1945 * or a !8bit encoding but a 8bit network charset, update encoding if needed
1946 */
1947 is_7bit = FALSE;
1948 for (i = 0; txt_mime_7bit_charsets[i] != NULL; i++) {
1949 if (!strcasecmp(txt_mime_charsets[tinrc.mm_network_charset], txt_mime_7bit_charsets[i])) {
1950 is_7bit = TRUE;
1951 break;
1952 }
1953 }
1954 if (is_7bit) {
1955 if (tinrc.mail_mime_encoding != MIME_ENCODING_7BIT) {
1956 tinrc.mail_mime_encoding = MIME_ENCODING_7BIT;
1957 repaint_option(OPT_MAIL_MIME_ENCODING);
1958 }
1959 } else {
1960 if (tinrc.mail_mime_encoding == MIME_ENCODING_7BIT) {
1961 tinrc.mail_mime_encoding = MIME_ENCODING_QP;
1962 repaint_option(OPT_MAIL_MIME_ENCODING);
1963 }
1964 }
1965 #endif /* CHARSET_CONVERSION */
1966 UPDATE_INT_ATTRIBUTES(mail_mime_encoding);
1967 /* do not use 8 bit headers if mime encoding is not 8bit */
1968 if (tinrc.mail_mime_encoding != MIME_ENCODING_8BIT) {
1969 tinrc.mail_8bit_header = FALSE;
1970 repaint_option(OPT_MAIL_8BIT_HEADER);
1971 UPDATE_BOOL_ATTRIBUTES(mail_8bit_header);
1972 }
1973 }
1974 break;
1975
1976 case OPT_POST_MIME_ENCODING:
1977 if (prompt_option_list(option)) {
1978 #ifdef CHARSET_CONVERSION
1979 /*
1980 * check if we have selected a !7bit encoding but a 7bit network charset
1981 * or a !8bit encoding but a 8bit network charset, update encoding if needed
1982 */
1983 is_7bit = FALSE;
1984 for (i = 0; txt_mime_7bit_charsets[i] != NULL; i++) {
1985 if (!strcasecmp(txt_mime_charsets[tinrc.mm_network_charset], txt_mime_7bit_charsets[i])) {
1986 is_7bit = TRUE;
1987 break;
1988 }
1989 }
1990 if (is_7bit) {
1991 if (tinrc.post_mime_encoding != MIME_ENCODING_7BIT) {
1992 tinrc.post_mime_encoding = MIME_ENCODING_7BIT;
1993 repaint_option(OPT_POST_MIME_ENCODING);
1994 }
1995 } else {
1996 if (tinrc.post_mime_encoding == MIME_ENCODING_7BIT) {
1997 tinrc.post_mime_encoding = MIME_ENCODING_8BIT;
1998 repaint_option(OPT_POST_MIME_ENCODING);
1999 }
2000 }
2001 #endif /* CHARSET_CONVERSION */
2002 UPDATE_INT_ATTRIBUTES(post_mime_encoding);
2003 /* do not use 8 bit headers if mime encoding is not 8bit */
2004 if (tinrc.post_mime_encoding != MIME_ENCODING_8BIT) {
2005 tinrc.post_8bit_header = FALSE;
2006 repaint_option(OPT_POST_8BIT_HEADER);
2007 UPDATE_BOOL_ATTRIBUTES(post_8bit_header);
2008 }
2009 }
2010 break;
2011
2012 #ifdef CHARSET_CONVERSION
2013 case OPT_MM_NETWORK_CHARSET:
2014 if (prompt_option_list(option)) {
2015 /*
2016 * check if we have selected a 7bit charset but a !7bit encoding
2017 * or a 8bit charset but a !8bit encoding, update encoding if needed
2018 *
2019 * if (mail|post)_mime_encoding != 8bit, disable (mail|post)_8bit_header
2020 */
2021 is_7bit = FALSE;
2022 UPDATE_INT_ATTRIBUTES(mm_network_charset);
2023 for (i = 0; txt_mime_7bit_charsets[i] != NULL; i++) {
2024 if (!strcasecmp(txt_mime_charsets[tinrc.mm_network_charset], txt_mime_7bit_charsets[i])) {
2025 is_7bit = TRUE;
2026 break;
2027 }
2028 }
2029 if (is_7bit) {
2030 if (tinrc.mail_mime_encoding != MIME_ENCODING_7BIT) {
2031 tinrc.mail_mime_encoding = MIME_ENCODING_7BIT;
2032 tinrc.mail_8bit_header = FALSE;
2033 repaint_option(OPT_MAIL_MIME_ENCODING);
2034 repaint_option(OPT_MAIL_8BIT_HEADER);
2035 UPDATE_INT_ATTRIBUTES(mail_mime_encoding);
2036 UPDATE_BOOL_ATTRIBUTES(mail_8bit_header);
2037 }
2038 if (tinrc.post_mime_encoding != MIME_ENCODING_7BIT) {
2039 tinrc.post_mime_encoding = MIME_ENCODING_7BIT;
2040 tinrc.post_8bit_header = FALSE;
2041 repaint_option(OPT_POST_MIME_ENCODING);
2042 repaint_option(OPT_POST_8BIT_HEADER);
2043 UPDATE_INT_ATTRIBUTES(post_mime_encoding);
2044 UPDATE_BOOL_ATTRIBUTES(post_8bit_header);
2045 }
2046 } else {
2047 if (tinrc.mail_mime_encoding == MIME_ENCODING_7BIT) {
2048 tinrc.mail_mime_encoding = MIME_ENCODING_QP;
2049 repaint_option(OPT_MAIL_MIME_ENCODING);
2050 UPDATE_INT_ATTRIBUTES(mail_mime_encoding);
2051 }
2052 if (tinrc.post_mime_encoding == MIME_ENCODING_7BIT) {
2053 tinrc.post_mime_encoding = MIME_ENCODING_8BIT;
2054 repaint_option(OPT_POST_MIME_ENCODING);
2055 UPDATE_INT_ATTRIBUTES(post_mime_encoding);
2056 }
2057 }
2058 }
2059 break;
2060 #endif /* CHARSET_CONVERSION */
2061
2062 case OPT_ATTRIB_AUTO_CC_BCC:
2063 if (prompt_option_list(option))
2064 SET_NUM_ATTRIBUTE(auto_cc_bcc);
2065 break;
2066
2067 case OPT_ATTRIB_MAIL_MIME_ENCODING:
2068 if (prompt_option_list(option))
2069 SET_NUM_ATTRIBUTE(mail_mime_encoding);
2070 break;
2071
2072 #ifdef CHARSET_CONVERSION
2073 case OPT_ATTRIB_MM_NETWORK_CHARSET:
2074 if (prompt_option_list(option))
2075 SET_NUM_ATTRIBUTE(mm_network_charset);
2076 break;
2077 #endif /* CHARSET_CONVERSION */
2078
2079 case OPT_ATTRIB_POST_MIME_ENCODING:
2080 if (prompt_option_list(option))
2081 SET_NUM_ATTRIBUTE(post_mime_encoding);
2082 break;
2083
2084 case OPT_ATTRIB_POST_PROCESS_TYPE:
2085 if (prompt_option_list(option))
2086 SET_NUM_ATTRIBUTE(post_process_type);
2087 break;
2088
2089 case OPT_ATTRIB_QUICK_KILL_HEADER:
2090 if (prompt_option_list(option))
2091 SET_NUM_ATTRIBUTE(quick_kill_header);
2092 break;
2093
2094 case OPT_ATTRIB_QUICK_SELECT_HEADER:
2095 if (prompt_option_list(option))
2096 SET_NUM_ATTRIBUTE(quick_select_header);
2097 break;
2098
2099 case OPT_ATTRIB_SHOW_AUTHOR:
2100 if (prompt_option_list(option)) {
2101 SET_NUM_ATTRIBUTE(show_author);
2102 changed |= SHOW_AUTHOR;
2103 }
2104 break;
2105
2106 case OPT_ATTRIB_SORT_ARTICLE_TYPE:
2107 if (prompt_option_list(option)) {
2108 SET_NUM_ATTRIBUTE(sort_article_type);
2109 changed |= SORT_OPTS;
2110 }
2111 break;
2112
2113 case OPT_ATTRIB_SORT_THREADS_TYPE:
2114 if (prompt_option_list(option)) {
2115 SET_NUM_ATTRIBUTE(sort_threads_type);
2116 changed |= SORT_OPTS;
2117 }
2118 break;
2119
2120 case OPT_ATTRIB_THREAD_ARTICLES:
2121 if (prompt_option_list(option)) {
2122 SET_NUM_ATTRIBUTE(thread_articles);
2123 changed |= THREAD_ARTS;
2124 }
2125 break;
2126
2127 case OPT_ATTRIB_TRIM_ARTICLE_BODY:
2128 if (prompt_option_list(option)) {
2129 SET_NUM_ATTRIBUTE(trim_article_body);
2130 changed |= DISPLAY_OPTS;
2131 }
2132 break;
2133
2134 default:
2135 break;
2136 } /* switch (option) */
2137 break;
2138
2139 case OPT_STRING:
2140 switch (option) {
2141 case OPT_MAILDIR:
2142 case OPT_MAILER_FORMAT:
2143 case OPT_MAIL_ADDRESS:
2144 case OPT_MAIL_QUOTE_FORMAT:
2145 case OPT_METAMAIL_PROG:
2146 case OPT_NEWS_QUOTE_FORMAT:
2147 case OPT_SAVEDIR:
2148 case OPT_SIGFILE:
2149 #ifndef DISABLE_PRINTING
2150 case OPT_PRINTER:
2151 #endif /* !DISABLE_PRINTING */
2152 case OPT_QUOTE_CHARS:
2153 case OPT_SPAMTRAP_WARNING_ADDRESSES:
2154 case OPT_URL_HANDLER:
2155 case OPT_XPOST_QUOTE_FORMAT:
2156 #ifdef NNTPS_ABLE
2157 case OPT_TLS_CA_CERT_FILE:
2158 #endif /* NNTPS_ABLE */
2159 if (prompt_option_string(option))
2160 changed |= MISC_OPTS;
2161 break;
2162
2163 case OPT_EDITOR_FORMAT:
2164 if (prompt_option_string(option)) {
2165 if (!strlen(tinrc.editor_format))
2166 STRCPY(tinrc.editor_format, TIN_EDITOR_FMT);
2167 changed |= MISC_OPTS;
2168 }
2169 break;
2170
2171 case OPT_GROUP_FORMAT:
2172 if (prompt_option_string(option)) {
2173 if (!strlen(tinrc.group_format))
2174 STRCPY(tinrc.group_format, DEFAULT_GROUP_FORMAT);
2175 changed |= MISC_OPTS;
2176 }
2177 break;
2178
2179 case OPT_INEWS_PROG:
2180 if (prompt_option_string(option)) {
2181 if (!strlen(tinrc.inews_prog))
2182 STRCPY(tinrc.inews_prog, INTERNAL_CMD);
2183 changed |= MISC_OPTS;
2184 }
2185 break;
2186
2187 case OPT_ATTRIB_GROUP_FORMAT:
2188 if (prompt_option_string(option))
2189 SET_STRING_ATTRIBUTE(group_format);
2190 break;
2191
2192 #ifndef CHARSET_CONVERSION
2193 case OPT_MM_CHARSET:
2194 if (prompt_option_string(option)) {
2195 if (!strlen(tinrc.mm_charset))
2196 STRCPY(tinrc.mm_charset, get_val("MM_CHARSET", MM_CHARSET));
2197 /*
2198 * No charset conversion available, assume local charset
2199 * to be network charset.
2200 */
2201 STRCPY(tinrc.mm_local_charset, tinrc.mm_charset);
2202 changed |= MISC_OPTS;
2203 }
2204 break;
2205 #else
2206 # ifdef NO_LOCALE
2207 case OPT_MM_LOCAL_CHARSET:
2208 if (prompt_option_string(option))
2209 /* no locales -> can't guess local charset */
2210 changed |= MISC_OPTS;
2211 break;
2212
2213 # endif /* NO_LOCALE */
2214 #endif /* !CHARSET_CONVERSION */
2215
2216 case OPT_NEWS_HEADERS_TO_DISPLAY:
2217 if (prompt_option_string(option)) {
2218 build_news_headers_array(scopes[0].attribute, TRUE);
2219 changed |= MISC_OPTS;
2220 }
2221 break;
2222
2223 case OPT_NEWS_HEADERS_TO_NOT_DISPLAY:
2224 if (prompt_option_string(option)) {
2225 build_news_headers_array(scopes[0].attribute, FALSE);
2226 changed |= MISC_OPTS;
2227 }
2228 break;
2229
2230 case OPT_POSTED_ARTICLES_FILE:
2231 if (prompt_option_string(option)) /* no expansion here, will be done in post_loop() */
2232 changed |= MISC_OPTS;
2233 break;
2234
2235 #ifdef HAVE_COLOR
2236 case OPT_QUOTE_REGEX:
2237 if (prompt_option_string(option)) {
2238 regex_cache_destroy("e_regex);
2239 if (!strlen(tinrc.quote_regex))
2240 STRCPY(tinrc.quote_regex, DEFAULT_QUOTE_REGEX);
2241 compile_regex(tinrc.quote_regex, "e_regex, REGEX_CASELESS);
2242 changed |= DISPLAY_OPTS;
2243 }
2244 break;
2245
2246 case OPT_QUOTE_REGEX2:
2247 if (prompt_option_string(option)) {
2248 regex_cache_destroy("e_regex2);
2249 if (!strlen(tinrc.quote_regex2))
2250 STRCPY(tinrc.quote_regex2, DEFAULT_QUOTE_REGEX2);
2251 compile_regex(tinrc.quote_regex2, "e_regex2, REGEX_CASELESS);
2252 changed |= DISPLAY_OPTS;
2253 }
2254 break;
2255
2256 case OPT_QUOTE_REGEX3:
2257 if (prompt_option_string(option)) {
2258 regex_cache_destroy("e_regex3);
2259 if (!strlen(tinrc.quote_regex3))
2260 STRCPY(tinrc.quote_regex3, DEFAULT_QUOTE_REGEX3);
2261 compile_regex(tinrc.quote_regex3, "e_regex3, REGEX_CASELESS);
2262 changed |= DISPLAY_OPTS;
2263 }
2264 break;
2265
2266 case OPT_EXTQUOTE_REGEX:
2267 if (prompt_option_string(option)) {
2268 regex_cache_destroy(&extquote_regex);
2269 if (!strlen(tinrc.extquote_regex))
2270 STRCPY(tinrc.extquote_regex, DEFAULT_EXTQUOTE_REGEX);
2271 compile_regex(tinrc.extquote_regex, &extquote_regex, REGEX_CASELESS);
2272 changed |= DISPLAY_OPTS;
2273 }
2274 break;
2275 #endif /* HAVE_COLOR */
2276
2277 case OPT_SELECT_FORMAT:
2278 if (prompt_option_string(option)) {
2279 if (!strlen(tinrc.select_format))
2280 STRCPY(tinrc.select_format, DEFAULT_SELECT_FORMAT);
2281 changed |= MISC_OPTS;
2282 }
2283 break;
2284
2285 case OPT_SLASHES_REGEX:
2286 if (prompt_option_string(option)) {
2287 regex_cache_destroy(&slashes_regex);
2288 if (!strlen(tinrc.slashes_regex))
2289 STRCPY(tinrc.slashes_regex, DEFAULT_SLASHES_REGEX);
2290 compile_regex(tinrc.slashes_regex, &slashes_regex, REGEX_CASELESS);
2291 changed |= DISPLAY_OPTS;
2292 }
2293 break;
2294
2295 case OPT_STARS_REGEX:
2296 if (prompt_option_string(option)) {
2297 regex_cache_destroy(&stars_regex);
2298 if (!strlen(tinrc.stars_regex))
2299 STRCPY(tinrc.stars_regex, DEFAULT_STARS_REGEX);
2300 compile_regex(tinrc.stars_regex, &stars_regex, REGEX_CASELESS);
2301 changed |= DISPLAY_OPTS;
2302 }
2303 break;
2304
2305 case OPT_STROKES_REGEX:
2306 if (prompt_option_string(option)) {
2307 regex_cache_destroy(&strokes_regex);
2308 if (!strlen(tinrc.strokes_regex))
2309 STRCPY(tinrc.strokes_regex, DEFAULT_STROKES_REGEX);
2310 compile_regex(tinrc.strokes_regex, &strokes_regex, REGEX_CASELESS);
2311 changed |= DISPLAY_OPTS;
2312 }
2313 break;
2314
2315 case OPT_UNDERSCORES_REGEX:
2316 if (prompt_option_string(option)) {
2317 regex_cache_destroy(&underscores_regex);
2318 if (!strlen(tinrc.underscores_regex))
2319 STRCPY(tinrc.underscores_regex, DEFAULT_UNDERSCORES_REGEX);
2320 compile_regex(tinrc.underscores_regex, &underscores_regex, REGEX_CASELESS);
2321 changed |= DISPLAY_OPTS;
2322 }
2323 break;
2324
2325 case OPT_STRIP_RE_REGEX:
2326 if (prompt_option_string(option)) {
2327 regex_cache_destroy(&strip_re_regex);
2328 if (!strlen(tinrc.strip_re_regex))
2329 STRCPY(tinrc.strip_re_regex, DEFAULT_STRIP_RE_REGEX);
2330 compile_regex(tinrc.strip_re_regex, &strip_re_regex, REGEX_ANCHORED);
2331 changed |= MISC_OPTS;
2332 }
2333 break;
2334
2335 case OPT_STRIP_WAS_REGEX:
2336 if (prompt_option_string(option)) {
2337 regex_cache_destroy(&strip_was_regex);
2338 if (!strlen(tinrc.strip_was_regex)) {
2339 if (regex_use_utf8())
2340 STRCPY(tinrc.strip_was_regex, DEFAULT_U8_STRIP_WAS_REGEX);
2341 else
2342 STRCPY(tinrc.strip_was_regex, DEFAULT_STRIP_WAS_REGEX);
2343 }
2344 compile_regex(tinrc.strip_was_regex, &strip_was_regex, 0);
2345 changed |= MISC_OPTS;
2346 }
2347 break;
2348
2349 case OPT_THREAD_FORMAT:
2350 if (prompt_option_string(option)) {
2351 if (!strlen(tinrc.thread_format))
2352 STRCPY(tinrc.thread_format, DEFAULT_THREAD_FORMAT);
2353 changed |= MISC_OPTS;
2354 }
2355 break;
2356
2357 case OPT_ATTRIB_THREAD_FORMAT:
2358 if (prompt_option_string(option))
2359 SET_STRING_ATTRIBUTE(thread_format);
2360 break;
2361
2362 case OPT_VERBATIM_BEGIN_REGEX:
2363 if (prompt_option_string(option)) {
2364 regex_cache_destroy(&verbatim_begin_regex);
2365 if (!strlen(tinrc.verbatim_begin_regex))
2366 STRCPY(tinrc.verbatim_begin_regex, DEFAULT_VERBATIM_BEGIN_REGEX);
2367 compile_regex(tinrc.verbatim_begin_regex, &verbatim_begin_regex, REGEX_ANCHORED);
2368 changed |= DISPLAY_OPTS;
2369 }
2370 break;
2371
2372 case OPT_VERBATIM_END_REGEX:
2373 if (prompt_option_string(option)) {
2374 regex_cache_destroy(&verbatim_end_regex);
2375 if (!strlen(tinrc.verbatim_end_regex))
2376 STRCPY(tinrc.verbatim_end_regex, DEFAULT_VERBATIM_END_REGEX);
2377 compile_regex(tinrc.verbatim_end_regex, &verbatim_end_regex, REGEX_ANCHORED);
2378 changed |= DISPLAY_OPTS;
2379 }
2380 break;
2381
2382 case OPT_DATE_FORMAT:
2383 if (prompt_option_string(option)) {
2384 if (!strlen(tinrc.date_format))
2385 STRCPY(tinrc.date_format, DEFAULT_DATE_FORMAT);
2386 changed |= MISC_OPTS;
2387 }
2388 break;
2389
2390 case OPT_ATTRIB_DATE_FORMAT:
2391 if (prompt_option_string(option))
2392 SET_STRING_ATTRIBUTE(date_format);
2393 break;
2394
2395 case OPT_ATTRIB_EDITOR_FORMAT:
2396 if (prompt_option_string(option))
2397 SET_STRING_ATTRIBUTE(editor_format);
2398 break;
2399
2400 case OPT_ATTRIB_FCC:
2401 if (prompt_option_string(option))
2402 SET_STRING_ATTRIBUTE(fcc);
2403 break;
2404
2405 case OPT_ATTRIB_FOLLOWUP_TO:
2406 if (prompt_option_string(option))
2407 SET_STRING_ATTRIBUTE(followup_to);
2408 break;
2409
2410 case OPT_ATTRIB_FROM:
2411 if (prompt_option_string(option))
2412 SET_STRING_ATTRIBUTE(from);
2413 break;
2414
2415 #ifdef HAVE_ISPELL
2416 case OPT_ATTRIB_ISPELL:
2417 if (prompt_option_string(option))
2418 SET_STRING_ATTRIBUTE(ispell);
2419 break;
2420 #endif /* HAVE_ISPELL */
2421
2422 case OPT_ATTRIB_MAILDIR:
2423 if (prompt_option_string(option))
2424 SET_STRING_ATTRIBUTE(maildir);
2425 break;
2426
2427 case OPT_ATTRIB_MAILING_LIST:
2428 if (prompt_option_string(option))
2429 SET_STRING_ATTRIBUTE(mailing_list);
2430 break;
2431
2432 case OPT_ATTRIB_MIME_TYPES_TO_SAVE:
2433 if (prompt_option_string(option))
2434 SET_STRING_ATTRIBUTE(mime_types_to_save);
2435 break;
2436
2437 case OPT_ATTRIB_NEWS_HEADERS_TO_DISPLAY:
2438 if (prompt_option_string(option)) {
2439 SET_STRING_ATTRIBUTE(news_headers_to_display);
2440 build_news_headers_array(curr_scope->attribute, TRUE);
2441 changed |= DISPLAY_OPTS;
2442 }
2443 break;
2444
2445 case OPT_ATTRIB_NEWS_HEADERS_TO_NOT_DISPLAY:
2446 if (prompt_option_string(option)) {
2447 SET_STRING_ATTRIBUTE(news_headers_to_not_display);
2448 build_news_headers_array(curr_scope->attribute, FALSE);
2449 changed |= DISPLAY_OPTS;
2450 }
2451 break;
2452
2453 case OPT_ATTRIB_NEWS_QUOTE_FORMAT:
2454 if (prompt_option_string(option))
2455 SET_STRING_ATTRIBUTE(news_quote_format);
2456 break;
2457
2458 case OPT_ATTRIB_ORGANIZATION:
2459 if (prompt_option_string(option))
2460 SET_STRING_ATTRIBUTE(organization);
2461 break;
2462
2463 case OPT_ATTRIB_QUICK_KILL_SCOPE:
2464 if (prompt_option_string(option))
2465 SET_STRING_ATTRIBUTE(quick_kill_scope);
2466 break;
2467
2468 case OPT_ATTRIB_QUICK_SELECT_SCOPE:
2469 if (prompt_option_string(option))
2470 SET_STRING_ATTRIBUTE(quick_select_scope);
2471 break;
2472
2473 case OPT_ATTRIB_QUOTE_CHARS:
2474 if (prompt_option_string(option))
2475 SET_STRING_ATTRIBUTE(quote_chars);
2476 break;
2477
2478 case OPT_ATTRIB_SAVEDIR:
2479 if (prompt_option_string(option))
2480 SET_STRING_ATTRIBUTE(savedir);
2481 break;
2482
2483 case OPT_ATTRIB_SAVEFILE:
2484 if (prompt_option_string(option))
2485 SET_STRING_ATTRIBUTE(savefile);
2486 break;
2487
2488 case OPT_ATTRIB_SIGFILE:
2489 if (prompt_option_string(option))
2490 SET_STRING_ATTRIBUTE(sigfile);
2491 break;
2492
2493 #ifdef CHARSET_CONVERSION
2494 case OPT_ATTRIB_UNDECLARED_CHARSET:
2495 if (prompt_option_string(option))
2496 SET_STRING_ATTRIBUTE(undeclared_charset);
2497 break;
2498
2499 #endif /* CHARSET_CONVERSION */
2500 case OPT_ATTRIB_X_BODY:
2501 if (prompt_option_string(option))
2502 SET_STRING_ATTRIBUTE(x_body);
2503 break;
2504
2505 case OPT_ATTRIB_X_HEADERS:
2506 if (prompt_option_string(option))
2507 SET_STRING_ATTRIBUTE(x_headers);
2508 break;
2509
2510 default:
2511 break;
2512 } /* switch (option) */
2513
2514 break;
2515
2516 case OPT_NUM:
2517 switch (option) {
2518 case OPT_GETART_LIMIT:
2519 case OPT_SCROLL_LINES:
2520 if (prompt_option_num(option))
2521 changed |= MISC_OPTS;
2522 break;
2523
2524 #if defined(HAVE_ALARM) && defined(SIGALRM)
2525 case OPT_NNTP_READ_TIMEOUT_SECS:
2526 if (prompt_option_num(option)) {
2527 if (tinrc.nntp_read_timeout_secs < 0)
2528 tinrc.nntp_read_timeout_secs = 0;
2529 changed |= MISC_OPTS;
2530 }
2531 break;
2532 #endif /* HAVE_ALARM && SIGALRM */
2533
2534 case OPT_REREAD_ACTIVE_FILE_SECS:
2535 if (prompt_option_num(option)) {
2536 if (tinrc.reread_active_file_secs < 0)
2537 tinrc.reread_active_file_secs = 0;
2538 changed |= MISC_OPTS;
2539 }
2540 break;
2541
2542 case OPT_RECENT_TIME:
2543 if (prompt_option_num(option)) {
2544 if (tinrc.recent_time < 0)
2545 tinrc.recent_time = 0;
2546 changed |= MISC_OPTS;
2547 }
2548 break;
2549
2550 case OPT_FILTER_DAYS:
2551 if (prompt_option_num(option)) {
2552 if (tinrc.filter_days <= 0)
2553 tinrc.filter_days = 1;
2554 changed |= MISC_OPTS;
2555 }
2556 break;
2557
2558 case OPT_SCORE_LIMIT_KILL:
2559 case OPT_SCORE_KILL:
2560 case OPT_SCORE_LIMIT_SELECT:
2561 case OPT_SCORE_SELECT:
2562 if (prompt_option_num(option)) {
2563 check_score_defaults();
2564 redraw_screen(option);
2565 changed |= SCORE_OPTS;
2566 }
2567 break;
2568
2569 case OPT_THREAD_PERC:
2570 if (prompt_option_num(option)) {
2571 if (tinrc.thread_perc < 0 || tinrc.thread_perc > 100)
2572 tinrc.thread_perc = THREAD_PERC_DEFAULT;
2573 UPDATE_INT_ATTRIBUTES(thread_perc);
2574 }
2575 break;
2576
2577 case OPT_WRAP_COLUMN:
2578 if (prompt_option_num(option))
2579 changed |= DISPLAY_OPTS;
2580 break;
2581
2582 case OPT_ATTRIB_THREAD_PERC:
2583 if (prompt_option_num(option))
2584 SET_NUM_ATTRIBUTE(thread_perc);
2585 break;
2586
2587 default:
2588 break;
2589 } /* switch (option) */
2590 break;
2591
2592 case OPT_CHAR:
2593 switch (option) {
2594 /*
2595 * TODO: do DASH_TO_SPACE/SPACE_TO_DASH conversion here?
2596 */
2597 case OPT_ART_MARKED_DELETED:
2598 case OPT_ART_MARKED_INRANGE:
2599 case OPT_ART_MARKED_RETURN:
2600 case OPT_ART_MARKED_SELECTED:
2601 case OPT_ART_MARKED_RECENT:
2602 case OPT_ART_MARKED_UNREAD:
2603 case OPT_ART_MARKED_READ:
2604 case OPT_ART_MARKED_KILLED:
2605 case OPT_ART_MARKED_READ_SELECTED:
2606 if (prompt_option_char(option)) {
2607 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
2608 set_art_mark_width();
2609 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
2610 changed |= MISC_OPTS;
2611 }
2612 break;
2613
2614 default:
2615 break;
2616 } /* switch (option) */
2617 break;
2618
2619 default:
2620 break;
2621 } /* switch (option_table[option].var_type) */
2622 change_option = FALSE;
2623 show_menu_help(txt_select_config_file_option);
2624 repaint_option(option);
2625 highlight_option(option);
2626 } /* if (change_option) */
2627 } /* forever */
2628 /* NOTREACHED */
2629 return;
2630 }
2631
2632
2633 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
2634 static void
2635 set_art_mark_width(
2636 void)
2637 {
2638 art_mark_width = 1;
2639
2640 if (wcwidth(tinrc.art_marked_deleted) > art_mark_width)
2641 art_mark_width = wcwidth(tinrc.art_marked_deleted);
2642 if (wcwidth(tinrc.art_marked_inrange) > art_mark_width)
2643 art_mark_width = wcwidth(tinrc.art_marked_inrange);
2644 if (wcwidth(tinrc.art_marked_return) > art_mark_width)
2645 art_mark_width = wcwidth(tinrc.art_marked_return);
2646 if (wcwidth(tinrc.art_marked_selected) > art_mark_width)
2647 art_mark_width = wcwidth(tinrc.art_marked_selected);
2648 if (wcwidth(tinrc.art_marked_recent) > art_mark_width)
2649 art_mark_width = wcwidth(tinrc.art_marked_recent);
2650 if (wcwidth(tinrc.art_marked_unread) > art_mark_width)
2651 art_mark_width = wcwidth(tinrc.art_marked_unread);
2652 if (wcwidth(tinrc.art_marked_read) > art_mark_width)
2653 art_mark_width = wcwidth(tinrc.art_marked_read);
2654 if (wcwidth(tinrc.art_marked_killed) > art_mark_width)
2655 art_mark_width = wcwidth(tinrc.art_marked_killed);
2656 if (wcwidth(tinrc.art_marked_read_selected) > art_mark_width)
2657 art_mark_width = wcwidth(tinrc.art_marked_read_selected);
2658 }
2659 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
2660
2661
2662 /*
2663 * scopes and attributes menu
2664 */
2665
2666 static t_function
2667 scope_left(
2668 void)
2669 {
2670 return GLOBAL_QUIT;
2671 }
2672
2673
2674 static t_function
2675 scope_right(
2676 void)
2677 {
2678 return SCOPE_SELECT;
2679 }
2680
2681
2682 static void
2683 show_scope_page(
2684 void)
2685 {
2686 int i;
2687
2688 signal_context = cScope;
2689 currmenu = &scopemenu;
2690 mark_offset = 0;
2691
2692 if (scopemenu.curr < 0)
2693 scopemenu.curr = 0;
2694
2695 scopemenu.max = num_scope - 1;
2696
2697 ClearScreen();
2698 set_first_screen_item();
2699 center_line(0, TRUE, _(txt_scopes_menu));
2700
2701 for (i = scopemenu.first; i < scopemenu.first + NOTESLINES && i < scopemenu.max; ++i)
2702 build_scope_line(i);
2703
2704 show_mini_help(SCOPE_LEVEL);
2705
2706 if (scopemenu.max <= 0) {
2707 info_message(_(txt_no_scopes));
2708 return;
2709 }
2710
2711 draw_scope_arrow();
2712 }
2713
2714
2715 static void
2716 scope_page(
2717 enum context level)
2718 {
2719 char key[MAXKEYLEN];
2720 int i;
2721 t_bool changed = FALSE;
2722 t_function func;
2723 t_menu *oldmenu = NULL;
2724
2725 if (currmenu)
2726 oldmenu = currmenu;
2727 scopemenu.curr = 0;
2728 clear_note_area();
2729 show_scope_page();
2730 set_xclick_off();
2731
2732 forever {
2733 switch ((func = handle_keypad(scope_left, scope_right, NULL, scope_keys))) {
2734 case GLOBAL_QUIT:
2735 if (changed)
2736 write_attributes_file(local_attributes_file);
2737 clear_note_area();
2738 if (oldmenu)
2739 currmenu = oldmenu;
2740 return;
2741
2742 case DIGIT_1:
2743 case DIGIT_2:
2744 case DIGIT_3:
2745 case DIGIT_4:
2746 case DIGIT_5:
2747 case DIGIT_6:
2748 case DIGIT_7:
2749 case DIGIT_8:
2750 case DIGIT_9:
2751 if (scopemenu.max)
2752 prompt_item_num(func_to_key(func, scope_keys), _(txt_scope_select));
2753 break;
2754
2755 #ifndef NO_SHELL_ESCAPE
2756 case GLOBAL_SHELL_ESCAPE:
2757 do_shell_escape();
2758 break;
2759 #endif /* !NO_SHELL_ESCAPE */
2760
2761 case GLOBAL_HELP:
2762 show_help_page(SCOPE_LEVEL, _(txt_scopes_menu_com));
2763 show_scope_page();
2764 break;
2765
2766 case GLOBAL_FIRST_PAGE:
2767 top_of_list();
2768 break;
2769
2770 case GLOBAL_LAST_PAGE:
2771 end_of_list();
2772 break;
2773
2774 case GLOBAL_REDRAW_SCREEN:
2775 my_retouch();
2776 set_xclick_off();
2777 show_scope_page();
2778 break;
2779
2780 case GLOBAL_LINE_DOWN:
2781 move_down();
2782 break;
2783
2784 case GLOBAL_LINE_UP:
2785 move_up();
2786 break;
2787
2788 case GLOBAL_PAGE_DOWN:
2789 page_down();
2790 break;
2791
2792 case GLOBAL_PAGE_UP:
2793 page_up();
2794 break;
2795
2796 case GLOBAL_SCROLL_DOWN:
2797 scroll_down();
2798 break;
2799
2800 case GLOBAL_SCROLL_UP:
2801 scroll_up();
2802 break;
2803
2804 case GLOBAL_TOGGLE_HELP_DISPLAY:
2805 toggle_mini_help(SCOPE_LEVEL);
2806 show_scope_page();
2807 break;
2808
2809 case SCOPE_ADD:
2810 if ((i = add_new_scope())) {
2811 changed = TRUE;
2812 scopemenu.curr = i;
2813 show_scope_page();
2814 }
2815 break;
2816
2817 case SCOPE_DELETE:
2818 if (scopemenu.max) {
2819 if (scopes[scopemenu.curr + 1].global)
2820 info_message(_(txt_scope_operation_not_allowed));
2821 else if (delete_scope(scopemenu.curr + 1)) {
2822 changed = TRUE;
2823 show_scope_page();
2824 }
2825 }
2826 break;
2827
2828 case SCOPE_EDIT_ATTRIBUTES_FILE:
2829 if (changed)
2830 write_attributes_file(local_attributes_file);
2831 if (!invoke_editor(local_attributes_file, attrib_file_offset, NULL))
2832 break;
2833 free_scopes_and_attributes();
2834 read_attributes_file(FALSE);
2835 assign_attributes_to_groups();
2836 changed = FALSE;
2837 scopemenu.curr = 0;
2838 show_scope_page();
2839 break;
2840
2841 case SCOPE_MOVE:
2842 if (scopemenu.max > 1) {
2843 if (scopes[scopemenu.curr + 1].global)
2844 info_message(_(txt_scope_operation_not_allowed));
2845 else if ((i = move_scope(scopemenu.curr + 1))) {
2846 changed = TRUE;
2847 scopemenu.curr = i - 1;
2848 show_scope_page();
2849 }
2850 }
2851 break;
2852
2853 case SCOPE_RENAME:
2854 if (scopemenu.max) {
2855 if (scopes[scopemenu.curr + 1].global)
2856 info_message(_(txt_scope_operation_not_allowed));
2857 else if (rename_scope(&scopes[scopemenu.curr + 1])) {
2858 changed = TRUE;
2859 show_scope_page();
2860 }
2861 }
2862 break;
2863
2864 case SCOPE_SELECT:
2865 if (scopemenu.max) {
2866 curr_scope = &scopes[scopemenu.curr + 1];
2867 config_page(NULL, level);
2868 if (!curr_scope->global && scope_is_empty())
2869 do_delete_scope(scopemenu.curr + 1);
2870 curr_scope = NULL;
2871 changed = TRUE;
2872 show_scope_page();
2873 }
2874 break;
2875
2876 default:
2877 info_message(_(txt_bad_command), PrintFuncKey(key, GLOBAL_HELP, scope_keys));
2878 break;
2879 }
2880 }
2881 }
2882
2883
2884 static void
2885 draw_scope_arrow(
2886 void)
2887 {
2888 draw_arrow_mark(INDEX_TOP + scopemenu.curr - scopemenu.first);
2889 if (scopemenu.curr == scopemenu.max - 1)
2890 info_message(_(txt_end_of_scopes));
2891 }
2892
2893
2894 static void
2895 build_scope_line(
2896 int i)
2897 {
2898 char *sptr;
2899 int len = cCOLS - 11;
2900
2901 #ifdef USE_CURSES
2902 /*
2903 * Allocate line buffer
2904 * make it the same size like in !USE_CURSES case to simplify some code
2905 */
2906 sptr = my_malloc(cCOLS + 2);
2907 #else
2908 sptr = screen[INDEX2SNUM(i)].col;
2909 #endif /* USE_CURSES */
2910
2911 snprintf(sptr, (size_t) cCOLS, " %c %s %-*.*s%s", (scopes[i + 1].global ? '!' : ' '), tin_ltoa(i + 1, 4), len, len, scopes[i + 1].scope, cCRLF);
2912
2913 #ifndef USE_CURSES
2914 if (tinrc.strip_blanks)
2915 strcat(strip_line(sptr), cCRLF);
2916 #endif /* !USE_CURSES */
2917
2918 WriteLine(INDEX2LNUM(i), sptr);
2919
2920 #ifdef USE_CURSES
2921 free(sptr);
2922 #endif /* USE_CURSES */
2923 }
2924
2925
2926 /*
2927 * add a new scope and return the index
2928 */
2929 static int
2930 add_new_scope(
2931 void)
2932 {
2933 char buf[LEN];
2934 int new_pos = 0;
2935
2936 if (prompt_default_string(_(txt_scope_enter), buf, sizeof(buf), (char *) NULL, HIST_OTHER))
2937 new_pos = add_scope(buf);
2938
2939 return new_pos;
2940 }
2941
2942
2943 /*
2944 * returns TRUE if the given scope was deleted
2945 */
2946 static t_bool
2947 delete_scope(
2948 int curr_pos)
2949 {
2950 if (prompt_yn(_(txt_scope_delete), FALSE) == 1) {
2951 do_delete_scope(curr_pos);
2952 return TRUE;
2953 }
2954
2955 return FALSE;
2956 }
2957
2958
2959 static void
2960 do_delete_scope(
2961 int curr_pos)
2962 {
2963 do_move_scope(curr_pos, num_scope - 1);
2964 free_scope(--num_scope);
2965 }
2966
2967
2968 /*
2969 * returns TRUE if scope was renamed
2970 */
2971 static t_bool
2972 rename_scope(
2973 struct t_scope *scope)
2974 {
2975 char buf[LEN];
2976
2977 if (prompt_default_string(_(txt_scope_rename), buf, sizeof(buf), scope->scope, HIST_OTHER)) {
2978 if (buf[0] == '\0')
2979 return FALSE;
2980 FreeIfNeeded(scope->scope);
2981 scope->scope = my_strdup(buf);
2982 return TRUE;
2983 }
2984
2985 return FALSE;
2986 }
2987
2988
2989 /*
2990 * look if an entry with the given scope exists and return the index
2991 */
2992 static int
2993 find_scope(
2994 const char *scope)
2995 {
2996 int i;
2997
2998 if (!scope || !*scope)
2999 return 0;
3000
3001 for (i = 1; i < num_scope; i++) {
3002 if (!scopes[i].global && strcasecmp(scope, scopes[i].scope) == 0)
3003 return i;
3004 }
3005
3006 return 0;
3007 }
3008
3009
3010 /*
3011 * returns the new position of the moved scope or 0 if repositioning
3012 * is not possible
3013 */
3014 static int
3015 move_scope(
3016 int curr_pos)
3017 {
3018 char *p;
3019 int new_pos;
3020
3021 clear_message();
3022 if ((p = tin_getline(_(txt_scope_new_position), 1, NULL, 0, FALSE, HIST_OTHER)) != NULL)
3023 new_pos = atoi(p);
3024 else
3025 new_pos = curr_pos;
3026 clear_message();
3027
3028 if (new_pos == curr_pos || new_pos == 0)
3029 return 0;
3030
3031 if (new_pos >= num_scope)
3032 new_pos = num_scope - 1;
3033
3034 if (scopes[new_pos].global) {
3035 info_message(_(txt_scope_new_position_is_global));
3036 return 0;
3037 }
3038
3039 do_move_scope(curr_pos, new_pos);
3040
3041 return new_pos;
3042 }
3043
3044
3045 /*
3046 * repositions a scope into scopes[]
3047 */
3048 static void
3049 do_move_scope(
3050 int from,
3051 int to)
3052 {
3053 struct t_scope tmp;
3054
3055 if (from == to)
3056 return;
3057
3058 tmp = scopes[from];
3059
3060 if (from > to) {
3061 while (from-- > to)
3062 scopes[from + 1] = scopes[from];
3063 } else {
3064 while (from++ < to)
3065 scopes[from - 1] = scopes[from];
3066 }
3067 scopes[to] = tmp;
3068 }
3069
3070
3071 /*
3072 * free all group->attribute arrays and all scopes which are
3073 * not marked as global
3074 */
3075 static void
3076 free_scopes_and_attributes(
3077 void)
3078 {
3079 int i;
3080
3081 for_each_group(i) {
3082 if (active[i].attribute && !active[i].attribute->global) {
3083 free(active[i].attribute);
3084 active[i].attribute = (struct t_attribute *) 0;
3085 }
3086 }
3087
3088 while (num_scope > 1 && !scopes[num_scope - 1].global)
3089 free_scope(--num_scope);
3090 }
3091
3092
3093 /*
3094 * returns TRUE if no attribute in curr_scope has state == TRUE
3095 */
3096 static t_bool
3097 scope_is_empty(
3098 void)
3099 {
3100 enum option_enum i;
3101
3102 for (i = 0; i <= last_opt; i++) {
3103 if (option_is_visible(i) && !option_is_title(i) && check_state(i))
3104 return FALSE;
3105 }
3106
3107 return TRUE;
3108 }
3109
3110
3111 /*
3112 * returns the state of the given attribute
3113 */
3114 static t_bool
3115 check_state(
3116 enum option_enum option)
3117 {
3118 switch (option) {
3119 case OPT_ATTRIB_ADD_POSTED_TO_FILTER:
3120 return curr_scope->state->add_posted_to_filter;
3121 case OPT_ATTRIB_ADVERTISING:
3122 return curr_scope->state->advertising;
3123 case OPT_ATTRIB_ALTERNATIVE_HANDLING:
3124 return curr_scope->state->alternative_handling;
3125 case OPT_ATTRIB_ASK_FOR_METAMAIL:
3126 return curr_scope->state->ask_for_metamail;
3127 case OPT_ATTRIB_AUTO_CC_BCC:
3128 return curr_scope->state->auto_cc_bcc;
3129 case OPT_ATTRIB_AUTO_LIST_THREAD:
3130 return curr_scope->state->auto_list_thread;
3131 case OPT_ATTRIB_AUTO_SELECT:
3132 return curr_scope->state->auto_select;
3133 case OPT_ATTRIB_BATCH_SAVE:
3134 return curr_scope->state->batch_save;
3135 case OPT_ATTRIB_DATE_FORMAT:
3136 return curr_scope->state->date_format;
3137 case OPT_ATTRIB_DELETE_TMP_FILES:
3138 return curr_scope->state->delete_tmp_files;
3139 case OPT_ATTRIB_EDITOR_FORMAT:
3140 return curr_scope->state->editor_format;
3141 #ifdef HAVE_COLOR
3142 case OPT_ATTRIB_EXTQUOTE_HANDLING:
3143 return curr_scope->state->extquote_handling;
3144 #endif /* HAVE_COLOR */
3145 case OPT_ATTRIB_FCC:
3146 return curr_scope->state->fcc;
3147 case OPT_ATTRIB_FOLLOWUP_TO:
3148 return curr_scope->state->followup_to;
3149 case OPT_ATTRIB_FROM:
3150 return curr_scope->state->from;
3151 case OPT_ATTRIB_GROUP_CATCHUP_ON_EXIT:
3152 return curr_scope->state->group_catchup_on_exit;
3153 case OPT_ATTRIB_GROUP_FORMAT:
3154 return curr_scope->state->group_format;
3155 #ifdef HAVE_ISPELL
3156 case OPT_ATTRIB_ISPELL:
3157 return curr_scope->state->ispell;
3158 #endif /* HAVE_ISPELL */
3159 case OPT_ATTRIB_MAILDIR:
3160 return curr_scope->state->maildir;
3161 case OPT_ATTRIB_MAIL_8BIT_HEADER:
3162 return curr_scope->state->mail_8bit_header;
3163 case OPT_ATTRIB_MAIL_MIME_ENCODING:
3164 return curr_scope->state->mail_mime_encoding;
3165 case OPT_ATTRIB_MAILING_LIST:
3166 return curr_scope->state->mailing_list;
3167 case OPT_ATTRIB_MARK_IGNORE_TAGS:
3168 return curr_scope->state->mark_ignore_tags;
3169 case OPT_ATTRIB_MARK_SAVED_READ:
3170 return curr_scope->state->mark_saved_read;
3171 case OPT_ATTRIB_MIME_FORWARD:
3172 return curr_scope->state->mime_forward;
3173 case OPT_ATTRIB_MIME_TYPES_TO_SAVE:
3174 return curr_scope->state->mime_types_to_save;
3175 case OPT_ATTRIB_NEWS_HEADERS_TO_DISPLAY:
3176 return curr_scope->state->news_headers_to_display;
3177 case OPT_ATTRIB_NEWS_HEADERS_TO_NOT_DISPLAY:
3178 return curr_scope->state->news_headers_to_not_display;
3179 case OPT_ATTRIB_NEWS_QUOTE_FORMAT:
3180 return curr_scope->state->news_quote_format;
3181 case OPT_ATTRIB_ORGANIZATION:
3182 return curr_scope->state->organization;
3183 case OPT_ATTRIB_POST_8BIT_HEADER:
3184 return curr_scope->state->post_8bit_header;
3185 case OPT_ATTRIB_POST_MIME_ENCODING:
3186 return curr_scope->state->post_mime_encoding;
3187 case OPT_ATTRIB_POST_PROCESS_VIEW:
3188 return curr_scope->state->post_process_view;
3189 case OPT_ATTRIB_POS_FIRST_UNREAD:
3190 return curr_scope->state->pos_first_unread;
3191 #ifndef DISABLE_PRINTING
3192 case OPT_ATTRIB_PRINT_HEADER:
3193 return curr_scope->state->print_header;
3194 #endif /* !DISABLE_PRINTING */
3195 case OPT_ATTRIB_PROCESS_ONLY_UNREAD:
3196 return curr_scope->state->process_only_unread;
3197 case OPT_ATTRIB_PROMPT_FOLLOWUPTO:
3198 return curr_scope->state->prompt_followupto;
3199 case OPT_ATTRIB_QUICK_KILL_SCOPE:
3200 return curr_scope->state->quick_kill_scope;
3201 case OPT_ATTRIB_QUICK_KILL_HEADER:
3202 return curr_scope->state->quick_kill_header;
3203 case OPT_ATTRIB_QUICK_KILL_CASE:
3204 return curr_scope->state->quick_kill_case;
3205 case OPT_ATTRIB_QUICK_KILL_EXPIRE:
3206 return curr_scope->state->quick_kill_expire;
3207 case OPT_ATTRIB_QUICK_SELECT_SCOPE:
3208 return curr_scope->state->quick_select_scope;
3209 case OPT_ATTRIB_QUICK_SELECT_HEADER:
3210 return curr_scope->state->quick_select_header;
3211 case OPT_ATTRIB_QUICK_SELECT_CASE:
3212 return curr_scope->state->quick_select_case;
3213 case OPT_ATTRIB_QUICK_SELECT_EXPIRE:
3214 return curr_scope->state->quick_select_expire;
3215 case OPT_ATTRIB_QUOTE_CHARS:
3216 return curr_scope->state->quote_chars;
3217 case OPT_ATTRIB_SAVEDIR:
3218 return curr_scope->state->savedir;
3219 case OPT_ATTRIB_SAVEFILE:
3220 return curr_scope->state->savefile;
3221 case OPT_ATTRIB_SHOW_AUTHOR:
3222 return curr_scope->state->show_author;
3223 case OPT_ATTRIB_SHOW_ONLY_UNREAD_ARTS:
3224 return curr_scope->state->show_only_unread_arts;
3225 case OPT_ATTRIB_SHOW_SIGNATURES:
3226 return curr_scope->state->show_signatures;
3227 case OPT_ATTRIB_SIGDASHES:
3228 return curr_scope->state->sigdashes;
3229 case OPT_ATTRIB_SIGFILE:
3230 return curr_scope->state->sigfile;
3231 case OPT_ATTRIB_SIGNATURE_REPOST:
3232 return curr_scope->state->signature_repost;
3233 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
3234 case OPT_ATTRIB_SUPPRESS_SOFT_HYPHENS:
3235 return curr_scope->state->suppress_soft_hyphens;
3236 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
3237 case OPT_ATTRIB_THREAD_ARTICLES:
3238 return curr_scope->state->thread_articles;
3239 case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
3240 return curr_scope->state->thread_catchup_on_exit;
3241 case OPT_ATTRIB_THREAD_FORMAT:
3242 return curr_scope->state->thread_format;
3243 case OPT_ATTRIB_THREAD_PERC:
3244 return curr_scope->state->thread_perc;
3245 case OPT_ATTRIB_TRIM_ARTICLE_BODY:
3246 return curr_scope->state->trim_article_body;
3247 case OPT_ATTRIB_TEX2ISO_CONV:
3248 return curr_scope->state->tex2iso_conv;
3249 case OPT_ATTRIB_SORT_THREADS_TYPE:
3250 return curr_scope->state->sort_threads_type;
3251 #ifdef CHARSET_CONVERSION
3252 case OPT_ATTRIB_MM_NETWORK_CHARSET:
3253 return curr_scope->state->mm_network_charset;
3254 case OPT_ATTRIB_UNDECLARED_CHARSET:
3255 return curr_scope->state->undeclared_charset;
3256 #endif /* CHARSET_CONVERSION */
3257 case OPT_ATTRIB_VERBATIM_HANDLING:
3258 return curr_scope->state->verbatim_handling;
3259 case OPT_ATTRIB_WRAP_ON_NEXT_UNREAD:
3260 return curr_scope->state->wrap_on_next_unread;
3261 case OPT_ATTRIB_SORT_ARTICLE_TYPE:
3262 return curr_scope->state->sort_article_type;
3263 case OPT_ATTRIB_POST_PROCESS_TYPE:
3264 return curr_scope->state->post_process_type;
3265 case OPT_ATTRIB_X_BODY:
3266 return curr_scope->state->x_body;
3267 case OPT_ATTRIB_X_COMMENT_TO:
3268 return curr_scope->state->x_comment_to;
3269 case OPT_ATTRIB_X_HEADERS:
3270 return curr_scope->state->x_headers;
3271
3272 default:
3273 return FALSE;
3274 }
3275 }
3276
3277
3278 /*
3279 * set the state of the given attribute to FALSE and the corresponding
3280 * tinrc.attrib_* to a default value
3281 */
3282 static void
3283 reset_state(
3284 enum option_enum option)
3285 {
3286 struct t_scope *default_scope = &scopes[0];
3287
3288 switch (option) {
3289 case OPT_ATTRIB_ADD_POSTED_TO_FILTER:
3290 curr_scope->state->add_posted_to_filter = FALSE;
3291 tinrc.attrib_add_posted_to_filter = default_scope->attribute->add_posted_to_filter;
3292 break;
3293 case OPT_ATTRIB_ADVERTISING:
3294 curr_scope->state->advertising = FALSE;
3295 tinrc.attrib_advertising = default_scope->attribute->advertising;
3296 break;
3297 case OPT_ATTRIB_ALTERNATIVE_HANDLING:
3298 curr_scope->state->alternative_handling = FALSE;
3299 tinrc.attrib_alternative_handling = default_scope->attribute->alternative_handling;
3300 break;
3301 case OPT_ATTRIB_ASK_FOR_METAMAIL:
3302 curr_scope->state->ask_for_metamail = FALSE;
3303 tinrc.attrib_ask_for_metamail = default_scope->attribute->ask_for_metamail;
3304 break;
3305 case OPT_ATTRIB_AUTO_CC_BCC:
3306 curr_scope->state->auto_cc_bcc = FALSE;
3307 tinrc.attrib_auto_cc_bcc = default_scope->attribute->auto_cc_bcc;
3308 break;
3309 case OPT_ATTRIB_AUTO_LIST_THREAD:
3310 curr_scope->state->auto_list_thread = FALSE;
3311 tinrc.attrib_auto_list_thread = default_scope->attribute->auto_list_thread;
3312 break;
3313 case OPT_ATTRIB_AUTO_SELECT:
3314 curr_scope->state->auto_select = FALSE;
3315 tinrc.attrib_auto_select = default_scope->attribute->auto_select;
3316 break;
3317 case OPT_ATTRIB_BATCH_SAVE:
3318 curr_scope->state->batch_save = FALSE;
3319 tinrc.attrib_batch_save = default_scope->attribute->batch_save;
3320 break;
3321 case OPT_ATTRIB_DATE_FORMAT:
3322 FreeAndNull(curr_scope->attribute->date_format);
3323 curr_scope->state->date_format = FALSE;
3324 snprintf(tinrc.attrib_date_format, sizeof(tinrc.attrib_date_format), "%s", BlankIfNull(default_scope->attribute->date_format));
3325 break;
3326 case OPT_ATTRIB_DELETE_TMP_FILES:
3327 curr_scope->state->delete_tmp_files = FALSE;
3328 tinrc.attrib_delete_tmp_files = default_scope->attribute->delete_tmp_files;
3329 break;
3330 case OPT_ATTRIB_EDITOR_FORMAT:
3331 FreeAndNull(curr_scope->attribute->editor_format);
3332 curr_scope->state->editor_format = FALSE;
3333 snprintf(tinrc.attrib_editor_format, sizeof(tinrc.attrib_editor_format), "%s", BlankIfNull(default_scope->attribute->editor_format));
3334 break;
3335 #ifdef HAVE_COLOR
3336 case OPT_ATTRIB_EXTQUOTE_HANDLING:
3337 curr_scope->state->extquote_handling = FALSE;
3338 tinrc.attrib_extquote_handling = default_scope->attribute->extquote_handling;
3339 break;
3340 #endif /* HAVE_COLOR */
3341 case OPT_ATTRIB_FCC:
3342 FreeAndNull(curr_scope->attribute->fcc);
3343 curr_scope->state->fcc = FALSE;
3344 snprintf(tinrc.attrib_fcc, sizeof(tinrc.attrib_fcc), "%s", BlankIfNull(default_scope->attribute->fcc));
3345 break;
3346 case OPT_ATTRIB_FOLLOWUP_TO:
3347 FreeAndNull(curr_scope->attribute->followup_to);
3348 curr_scope->state->followup_to = FALSE;
3349 snprintf(tinrc.attrib_followup_to, sizeof(tinrc.attrib_followup_to), "%s", BlankIfNull(default_scope->attribute->followup_to));
3350 break;
3351 case OPT_ATTRIB_FROM:
3352 FreeAndNull(curr_scope->attribute->from);
3353 curr_scope->state->from = FALSE;
3354 snprintf(tinrc.attrib_from, sizeof(tinrc.attrib_from), "%s", BlankIfNull(default_scope->attribute->from));
3355 break;
3356 case OPT_ATTRIB_GROUP_CATCHUP_ON_EXIT:
3357 curr_scope->state->group_catchup_on_exit = FALSE;
3358 tinrc.attrib_group_catchup_on_exit = default_scope->attribute->group_catchup_on_exit;
3359 break;
3360 case OPT_ATTRIB_GROUP_FORMAT:
3361 FreeAndNull(curr_scope->attribute->group_format);
3362 curr_scope->state->group_format = FALSE;
3363 snprintf(tinrc.attrib_group_format, sizeof(tinrc.attrib_group_format), "%s", BlankIfNull(default_scope->attribute->group_format));
3364 break;
3365 #ifdef HAVE_ISPELL
3366 case OPT_ATTRIB_ISPELL:
3367 FreeAndNull(curr_scope->attribute->ispell);
3368 curr_scope->state->ispell = FALSE;
3369 snprintf(tinrc.attrib_ispell, sizeof(tinrc.attrib_ispell), "%s", BlankIfNull(default_scope->attribute->ispell));
3370 break;
3371 #endif /* HAVE_ISPELL */
3372 case OPT_ATTRIB_MAILDIR:
3373 FreeAndNull(curr_scope->attribute->maildir);
3374 curr_scope->state->maildir = FALSE;
3375 snprintf(tinrc.attrib_maildir, sizeof(tinrc.attrib_maildir), "%s", BlankIfNull(default_scope->attribute->maildir));
3376 break;
3377 case OPT_ATTRIB_MAIL_8BIT_HEADER:
3378 curr_scope->state->mail_8bit_header = FALSE;
3379 tinrc.attrib_mail_8bit_header = default_scope->attribute->mail_8bit_header;
3380 break;
3381 case OPT_ATTRIB_MAIL_MIME_ENCODING:
3382 curr_scope->state->mail_mime_encoding = FALSE;
3383 tinrc.attrib_mail_mime_encoding = default_scope->attribute->mail_mime_encoding;
3384 break;
3385 case OPT_ATTRIB_MAILING_LIST:
3386 FreeAndNull(curr_scope->attribute->mailing_list);
3387 curr_scope->state->mailing_list = FALSE;
3388 snprintf(tinrc.attrib_mailing_list, sizeof(tinrc.attrib_mailing_list), "%s", BlankIfNull(default_scope->attribute->mailing_list));
3389 break;
3390 case OPT_ATTRIB_MARK_IGNORE_TAGS:
3391 curr_scope->state->mark_ignore_tags = FALSE;
3392 tinrc.attrib_mark_ignore_tags = default_scope->attribute->mark_ignore_tags;
3393 break;
3394 case OPT_ATTRIB_MARK_SAVED_READ:
3395 curr_scope->state->mark_saved_read = FALSE;
3396 tinrc.attrib_mark_saved_read = default_scope->attribute->mark_saved_read;
3397 break;
3398 case OPT_ATTRIB_MIME_FORWARD:
3399 curr_scope->state->mime_forward = FALSE;
3400 tinrc.attrib_mime_forward = default_scope->attribute->mime_forward;
3401 break;
3402 case OPT_ATTRIB_MIME_TYPES_TO_SAVE:
3403 FreeAndNull(curr_scope->attribute->mime_types_to_save);
3404 curr_scope->state->mime_types_to_save = FALSE;
3405 snprintf(tinrc.attrib_mime_types_to_save, sizeof(tinrc.attrib_mime_types_to_save), "%s", BlankIfNull(default_scope->attribute->mime_types_to_save));
3406 break;
3407 case OPT_ATTRIB_NEWS_HEADERS_TO_DISPLAY:
3408 FreeAndNull(curr_scope->attribute->news_headers_to_display);
3409 build_news_headers_array(curr_scope->attribute, TRUE);
3410 curr_scope->state->news_headers_to_display = FALSE;
3411 snprintf(tinrc.attrib_news_headers_to_display, sizeof(tinrc.attrib_news_headers_to_display), "%s", BlankIfNull(default_scope->attribute->news_headers_to_display));
3412 break;
3413 case OPT_ATTRIB_NEWS_HEADERS_TO_NOT_DISPLAY:
3414 FreeAndNull(curr_scope->attribute->news_headers_to_not_display);
3415 build_news_headers_array(curr_scope->attribute, FALSE);
3416 curr_scope->state->news_headers_to_not_display = FALSE;
3417 snprintf(tinrc.attrib_news_headers_to_not_display, sizeof(tinrc.attrib_news_headers_to_not_display), "%s", BlankIfNull(default_scope->attribute->news_headers_to_not_display));
3418 break;
3419 case OPT_ATTRIB_QUICK_KILL_SCOPE:
3420 FreeAndNull(curr_scope->attribute->quick_kill_scope);
3421 curr_scope->state->quick_kill_scope = FALSE;
3422 snprintf(tinrc.attrib_quick_kill_scope, sizeof(tinrc.attrib_quick_kill_scope), "%s", BlankIfNull(default_scope->attribute->quick_kill_scope));
3423 break;
3424 case OPT_ATTRIB_QUICK_KILL_HEADER:
3425 curr_scope->state->quick_kill_header = FALSE;
3426 tinrc.attrib_quick_kill_header = default_scope->attribute->quick_kill_header;
3427 break;
3428 case OPT_ATTRIB_QUICK_KILL_CASE:
3429 curr_scope->state->quick_kill_case = FALSE;
3430 tinrc.attrib_quick_kill_case = default_scope->attribute->quick_kill_case;
3431 break;
3432 case OPT_ATTRIB_QUICK_KILL_EXPIRE:
3433 curr_scope->state->quick_kill_expire = FALSE;
3434 tinrc.attrib_quick_kill_expire = default_scope->attribute->quick_kill_expire;
3435 break;
3436 case OPT_ATTRIB_QUICK_SELECT_SCOPE:
3437 FreeAndNull(curr_scope->attribute->quick_select_scope);
3438 curr_scope->state->quick_select_scope = FALSE;
3439 snprintf(tinrc.attrib_quick_select_scope, sizeof(tinrc.attrib_quick_select_scope), "%s", BlankIfNull(default_scope->attribute->quick_select_scope));
3440 break;
3441 case OPT_ATTRIB_QUICK_SELECT_HEADER:
3442 curr_scope->state->quick_select_header = FALSE;
3443 tinrc.attrib_quick_select_header = default_scope->attribute->quick_select_header;
3444 break;
3445 case OPT_ATTRIB_QUICK_SELECT_CASE:
3446 curr_scope->state->quick_select_case = FALSE;
3447 tinrc.attrib_quick_select_case = default_scope->attribute->quick_select_case;
3448 break;
3449 case OPT_ATTRIB_QUICK_SELECT_EXPIRE:
3450 curr_scope->state->quick_select_expire = FALSE;
3451 tinrc.attrib_quick_select_expire = default_scope->attribute->quick_select_expire;
3452 break;
3453 case OPT_ATTRIB_NEWS_QUOTE_FORMAT:
3454 FreeAndNull(curr_scope->attribute->news_quote_format);
3455 curr_scope->state->news_quote_format = FALSE;
3456 snprintf(tinrc.attrib_news_quote_format, sizeof(tinrc.attrib_news_quote_format), "%s", BlankIfNull(default_scope->attribute->news_quote_format));
3457 break;
3458 case OPT_ATTRIB_ORGANIZATION:
3459 FreeAndNull(curr_scope->attribute->organization);
3460 curr_scope->state->organization = FALSE;
3461 snprintf(tinrc.attrib_organization, sizeof(tinrc.attrib_organization), "%s", BlankIfNull(default_scope->attribute->organization));
3462 break;
3463 case OPT_ATTRIB_POST_8BIT_HEADER:
3464 curr_scope->state->post_8bit_header = FALSE;
3465 tinrc.attrib_post_8bit_header = default_scope->attribute->post_8bit_header;
3466 break;
3467 case OPT_ATTRIB_POST_MIME_ENCODING:
3468 curr_scope->state->post_mime_encoding = FALSE;
3469 tinrc.attrib_post_mime_encoding = default_scope->attribute->post_mime_encoding;
3470 break;
3471 case OPT_ATTRIB_POST_PROCESS_VIEW:
3472 curr_scope->state->post_process_view = FALSE;
3473 tinrc.attrib_post_process_view = default_scope->attribute->post_process_view;
3474 break;
3475 case OPT_ATTRIB_POS_FIRST_UNREAD:
3476 curr_scope->state->pos_first_unread = FALSE;
3477 tinrc.attrib_pos_first_unread = default_scope->attribute->pos_first_unread;
3478 break;
3479 #ifndef DISABLE_PRINTING
3480 case OPT_ATTRIB_PRINT_HEADER:
3481 curr_scope->state->print_header = FALSE;
3482 tinrc.attrib_print_header = default_scope->attribute->print_header;
3483 break;
3484 #endif /* !DISABLE_PRINTING */
3485 case OPT_ATTRIB_PROCESS_ONLY_UNREAD:
3486 curr_scope->state->process_only_unread = FALSE;
3487 tinrc.attrib_process_only_unread = default_scope->attribute->process_only_unread;
3488 break;
3489 case OPT_ATTRIB_PROMPT_FOLLOWUPTO:
3490 curr_scope->state->prompt_followupto = FALSE;
3491 tinrc.attrib_prompt_followupto = default_scope->attribute->prompt_followupto;
3492 break;
3493 case OPT_ATTRIB_QUOTE_CHARS:
3494 FreeAndNull(curr_scope->attribute->quote_chars);
3495 curr_scope->state->quote_chars = FALSE;
3496 snprintf(tinrc.attrib_quote_chars, sizeof(tinrc.attrib_quote_chars), "%s", BlankIfNull(default_scope->attribute->quote_chars));
3497 break;
3498 case OPT_ATTRIB_SAVEDIR:
3499 FreeAndNull(curr_scope->attribute->savedir);
3500 curr_scope->state->savedir = FALSE;
3501 snprintf(tinrc.attrib_savedir, sizeof(tinrc.attrib_savedir), "%s", BlankIfNull(default_scope->attribute->savedir));
3502 break;
3503 case OPT_ATTRIB_SAVEFILE:
3504 FreeAndNull(curr_scope->attribute->savefile);
3505 curr_scope->state->savefile = FALSE;
3506 snprintf(tinrc.attrib_savefile, sizeof(tinrc.attrib_savefile), "%s", BlankIfNull(default_scope->attribute->savefile));
3507 break;
3508 case OPT_ATTRIB_SHOW_AUTHOR:
3509 curr_scope->state->show_author = FALSE;
3510 tinrc.attrib_show_author = default_scope->attribute->show_author;
3511 break;
3512 case OPT_ATTRIB_SHOW_ONLY_UNREAD_ARTS:
3513 curr_scope->state->show_only_unread_arts = FALSE;
3514 tinrc.attrib_show_only_unread_arts = default_scope->attribute->show_only_unread_arts;
3515 break;
3516 case OPT_ATTRIB_SHOW_SIGNATURES:
3517 curr_scope->state->show_signatures = FALSE;
3518 tinrc.attrib_show_signatures = default_scope->attribute->show_signatures;
3519 break;
3520 case OPT_ATTRIB_SIGDASHES:
3521 curr_scope->state->sigdashes = FALSE;
3522 tinrc.attrib_sigdashes = default_scope->attribute->sigdashes;
3523 break;
3524 case OPT_ATTRIB_SIGFILE:
3525 FreeAndNull(curr_scope->attribute->sigfile);
3526 curr_scope->state->sigfile = FALSE;
3527 snprintf(tinrc.attrib_sigfile, sizeof(tinrc.attrib_sigfile), "%s", BlankIfNull(default_scope->attribute->sigfile));
3528 break;
3529 case OPT_ATTRIB_SIGNATURE_REPOST:
3530 curr_scope->state->signature_repost = FALSE;
3531 tinrc.attrib_signature_repost = default_scope->attribute->signature_repost;
3532 break;
3533 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
3534 case OPT_ATTRIB_SUPPRESS_SOFT_HYPHENS:
3535 curr_scope->state->suppress_soft_hyphens = FALSE;
3536 tinrc.attrib_suppress_soft_hyphens = default_scope->attribute->suppress_soft_hyphens;
3537 break;
3538 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
3539 case OPT_ATTRIB_THREAD_ARTICLES:
3540 curr_scope->state->thread_articles = FALSE;
3541 tinrc.attrib_thread_articles = default_scope->attribute->thread_articles;
3542 break;
3543 case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
3544 curr_scope->state->thread_catchup_on_exit = FALSE;
3545 tinrc.attrib_thread_catchup_on_exit = default_scope->attribute->thread_catchup_on_exit;
3546 break;
3547 case OPT_ATTRIB_THREAD_FORMAT:
3548 FreeAndNull(curr_scope->attribute->thread_format);
3549 curr_scope->state->thread_format = FALSE;
3550 snprintf(tinrc.attrib_thread_format, sizeof(tinrc.attrib_thread_format), "%s", BlankIfNull(default_scope->attribute->thread_format));
3551 break;
3552 case OPT_ATTRIB_THREAD_PERC:
3553 curr_scope->state->thread_perc = FALSE;
3554 tinrc.attrib_thread_perc = default_scope->attribute->thread_perc;
3555 break;
3556 case OPT_ATTRIB_TRIM_ARTICLE_BODY:
3557 curr_scope->state->trim_article_body = FALSE;
3558 tinrc.attrib_trim_article_body = default_scope->attribute->trim_article_body;
3559 break;
3560 case OPT_ATTRIB_TEX2ISO_CONV:
3561 curr_scope->state->tex2iso_conv = FALSE;
3562 tinrc.attrib_tex2iso_conv = default_scope->attribute->tex2iso_conv;
3563 break;
3564 case OPT_ATTRIB_SORT_THREADS_TYPE:
3565 curr_scope->state->sort_threads_type = FALSE;
3566 tinrc.attrib_sort_threads_type = default_scope->attribute->sort_threads_type;
3567 break;
3568 #ifdef CHARSET_CONVERSION
3569 case OPT_ATTRIB_MM_NETWORK_CHARSET:
3570 curr_scope->state->mm_network_charset = FALSE;
3571 tinrc.attrib_mm_network_charset = default_scope->attribute->mm_network_charset;
3572 break;
3573 case OPT_ATTRIB_UNDECLARED_CHARSET:
3574 FreeAndNull(curr_scope->attribute->undeclared_charset);
3575 curr_scope->state->undeclared_charset = FALSE;
3576 snprintf(tinrc.attrib_undeclared_charset, sizeof(tinrc.attrib_undeclared_charset), "%s", BlankIfNull(default_scope->attribute->undeclared_charset));
3577 break;
3578 #endif /* CHARSET_CONVERSION */
3579 case OPT_ATTRIB_VERBATIM_HANDLING:
3580 curr_scope->state->verbatim_handling = FALSE;
3581 tinrc.attrib_verbatim_handling = default_scope->attribute->verbatim_handling;
3582 break;
3583 case OPT_ATTRIB_WRAP_ON_NEXT_UNREAD:
3584 curr_scope->state->wrap_on_next_unread = FALSE;
3585 tinrc.attrib_wrap_on_next_unread = default_scope->attribute->wrap_on_next_unread;
3586 break;
3587 case OPT_ATTRIB_SORT_ARTICLE_TYPE:
3588 curr_scope->state->sort_article_type = FALSE;
3589 tinrc.attrib_sort_article_type = default_scope->attribute->sort_article_type;
3590 break;
3591 case OPT_ATTRIB_POST_PROCESS_TYPE:
3592 curr_scope->state->post_process_type = FALSE;
3593 tinrc.attrib_post_process_type = default_scope->attribute->post_process_type;
3594 break;
3595 case OPT_ATTRIB_X_BODY:
3596 FreeAndNull(curr_scope->attribute->x_body);
3597 curr_scope->state->x_body = FALSE;
3598 snprintf(tinrc.attrib_x_body, sizeof(tinrc.attrib_x_body), "%s", BlankIfNull(default_scope->attribute->x_body));
3599 break;
3600 case OPT_ATTRIB_X_COMMENT_TO:
3601 curr_scope->state->x_comment_to = FALSE;
3602 tinrc.attrib_x_comment_to = default_scope->attribute->x_comment_to;
3603 break;
3604 case OPT_ATTRIB_X_HEADERS:
3605 FreeAndNull(curr_scope->attribute->x_headers);
3606 curr_scope->state->x_headers = FALSE;
3607 snprintf(tinrc.attrib_x_headers, sizeof(tinrc.attrib_x_headers), "%s", BlankIfNull(default_scope->attribute->x_headers));
3608 break;
3609
3610 default:
3611 break;
3612 }
3613 }
3614
3615
3616 #define INITIALIZE_STRING_ATTRIBUTE(option) do { \
3617 if (curr_scope->state->option) \
3618 snprintf(CAO(tinrc.attrib_, option), sizeof(CAO(tinrc.attrib_, option)), "%s", curr_scope->attribute->option); \
3619 else \
3620 snprintf(CAO(tinrc.attrib_, option), sizeof(CAO(tinrc.attrib_, option)), "%s", BlankIfNull(default_scope->attribute->option)); \
3621 } while (0)
3622 #define INITIALIZE_NUM_ATTRIBUTE(option) do { \
3623 if (curr_scope->state->option) \
3624 CAO(tinrc.attrib_, option) = curr_scope->attribute->option; \
3625 else \
3626 CAO(tinrc.attrib_, option) = default_scope->attribute->option; \
3627 } while (0)
3628
3629 static void
3630 initialize_attributes(
3631 void)
3632 {
3633 struct t_scope *default_scope = &scopes[0];
3634
3635 INITIALIZE_NUM_ATTRIBUTE(add_posted_to_filter);
3636 INITIALIZE_NUM_ATTRIBUTE(advertising);
3637 INITIALIZE_NUM_ATTRIBUTE(alternative_handling);
3638 INITIALIZE_NUM_ATTRIBUTE(ask_for_metamail);
3639 INITIALIZE_NUM_ATTRIBUTE(auto_cc_bcc);
3640 INITIALIZE_NUM_ATTRIBUTE(auto_list_thread);
3641 INITIALIZE_NUM_ATTRIBUTE(auto_select);
3642 INITIALIZE_NUM_ATTRIBUTE(batch_save);
3643 INITIALIZE_NUM_ATTRIBUTE(delete_tmp_files);
3644 #ifdef HAVE_COLOR
3645 INITIALIZE_NUM_ATTRIBUTE(extquote_handling);
3646 #endif /* HAVE_COLOR */
3647 INITIALIZE_NUM_ATTRIBUTE(group_catchup_on_exit);
3648 INITIALIZE_NUM_ATTRIBUTE(mail_8bit_header);
3649 INITIALIZE_NUM_ATTRIBUTE(mail_mime_encoding);
3650 INITIALIZE_NUM_ATTRIBUTE(mark_ignore_tags);
3651 INITIALIZE_NUM_ATTRIBUTE(mark_saved_read);
3652 INITIALIZE_NUM_ATTRIBUTE(mime_forward);
3653 INITIALIZE_NUM_ATTRIBUTE(pos_first_unread);
3654 INITIALIZE_NUM_ATTRIBUTE(post_8bit_header);
3655 INITIALIZE_NUM_ATTRIBUTE(post_mime_encoding);
3656 INITIALIZE_NUM_ATTRIBUTE(post_process_view);
3657 #ifndef DISABLE_PRINTING
3658 INITIALIZE_NUM_ATTRIBUTE(print_header);
3659 #endif /* !DISABLE_PRINTING */
3660 INITIALIZE_NUM_ATTRIBUTE(process_only_unread);
3661 INITIALIZE_NUM_ATTRIBUTE(prompt_followupto);
3662 INITIALIZE_NUM_ATTRIBUTE(quick_kill_header);
3663 INITIALIZE_NUM_ATTRIBUTE(quick_kill_case);
3664 INITIALIZE_NUM_ATTRIBUTE(quick_kill_expire);
3665 INITIALIZE_NUM_ATTRIBUTE(quick_select_header);
3666 INITIALIZE_NUM_ATTRIBUTE(quick_select_case);
3667 INITIALIZE_NUM_ATTRIBUTE(quick_select_expire);
3668 INITIALIZE_NUM_ATTRIBUTE(show_author);
3669 INITIALIZE_NUM_ATTRIBUTE(show_only_unread_arts);
3670 INITIALIZE_NUM_ATTRIBUTE(show_signatures);
3671 INITIALIZE_NUM_ATTRIBUTE(sigdashes);
3672 INITIALIZE_NUM_ATTRIBUTE(signature_repost);
3673 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
3674 INITIALIZE_NUM_ATTRIBUTE(suppress_soft_hyphens);
3675 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
3676 INITIALIZE_NUM_ATTRIBUTE(thread_articles);
3677 INITIALIZE_NUM_ATTRIBUTE(thread_catchup_on_exit);
3678 INITIALIZE_NUM_ATTRIBUTE(thread_perc);
3679 INITIALIZE_NUM_ATTRIBUTE(trim_article_body);
3680 INITIALIZE_NUM_ATTRIBUTE(tex2iso_conv);
3681 INITIALIZE_NUM_ATTRIBUTE(verbatim_handling);
3682 INITIALIZE_NUM_ATTRIBUTE(wrap_on_next_unread);
3683 INITIALIZE_NUM_ATTRIBUTE(sort_article_type);
3684 INITIALIZE_NUM_ATTRIBUTE(sort_threads_type);
3685 INITIALIZE_NUM_ATTRIBUTE(post_process_type);
3686 INITIALIZE_NUM_ATTRIBUTE(x_comment_to);
3687 INITIALIZE_STRING_ATTRIBUTE(date_format);
3688 INITIALIZE_STRING_ATTRIBUTE(editor_format);
3689 INITIALIZE_STRING_ATTRIBUTE(fcc);
3690 INITIALIZE_STRING_ATTRIBUTE(followup_to);
3691 INITIALIZE_STRING_ATTRIBUTE(from);
3692 INITIALIZE_STRING_ATTRIBUTE(group_format);
3693 #ifdef HAVE_ISPELL
3694 INITIALIZE_STRING_ATTRIBUTE(ispell);
3695 #endif /* HAVE_ISPELL */
3696 INITIALIZE_STRING_ATTRIBUTE(maildir);
3697 INITIALIZE_STRING_ATTRIBUTE(mailing_list);
3698 INITIALIZE_STRING_ATTRIBUTE(mime_types_to_save);
3699 INITIALIZE_STRING_ATTRIBUTE(news_headers_to_display);
3700 INITIALIZE_STRING_ATTRIBUTE(news_headers_to_not_display);
3701 INITIALIZE_STRING_ATTRIBUTE(news_quote_format);
3702 INITIALIZE_STRING_ATTRIBUTE(organization);
3703 INITIALIZE_STRING_ATTRIBUTE(quick_kill_scope);
3704 INITIALIZE_STRING_ATTRIBUTE(quick_select_scope);
3705 INITIALIZE_STRING_ATTRIBUTE(quote_chars);
3706 INITIALIZE_STRING_ATTRIBUTE(savedir);
3707 INITIALIZE_STRING_ATTRIBUTE(savefile);
3708 INITIALIZE_STRING_ATTRIBUTE(sigfile);
3709 INITIALIZE_STRING_ATTRIBUTE(thread_format);
3710 #ifdef CHARSET_CONVERSION
3711 INITIALIZE_NUM_ATTRIBUTE(mm_network_charset);
3712 INITIALIZE_STRING_ATTRIBUTE(undeclared_charset);
3713 #endif /* CHARSET_CONVERSION */
3714 INITIALIZE_STRING_ATTRIBUTE(x_body);
3715 INITIALIZE_STRING_ATTRIBUTE(x_headers);
3716 }