mail: use mailvar_is_true to test boolean values
Showing
16 changed files
with
57 additions
and
76 deletions
... | @@ -148,7 +148,7 @@ alias_expand (const char *name) | ... | @@ -148,7 +148,7 @@ alias_expand (const char *name) |
148 | mu_list_t al; | 148 | mu_list_t al; |
149 | mu_list_t list; | 149 | mu_list_t list; |
150 | 150 | ||
151 | if (mailvar_get (NULL, "recursivealiases", mailvar_type_boolean, 0) == 0) | 151 | if (mailvar_is_true ("recursivealiases")) |
152 | { | 152 | { |
153 | char *s; | 153 | char *s; |
154 | mu_list_t origlist; | 154 | mu_list_t origlist; | ... | ... |
... | @@ -281,14 +281,13 @@ display_submessage (struct mime_descend_closure *closure, void *data) | ... | @@ -281,14 +281,13 @@ display_submessage (struct mime_descend_closure *closure, void *data) |
281 | 281 | ||
282 | /* If `metamail' is set to true, enable internal mailcap | 282 | /* If `metamail' is set to true, enable internal mailcap |
283 | support */ | 283 | support */ |
284 | if (mailvar_get (NULL, "metamail", mailvar_type_boolean, 0) == 0) | 284 | if (mailvar_is_true ("metamail")) |
285 | { | 285 | { |
286 | char *no_ask = NULL; | 286 | char *no_ask = NULL; |
287 | int debug = 0; | 287 | int debug = 0; |
288 | 288 | ||
289 | mailvar_get (&no_ask, "mimenoask", mailvar_type_string, 0); | 289 | mailvar_get (&no_ask, "mimenoask", mailvar_type_string, 0); |
290 | if (mailvar_get (&debug, "verbose", mailvar_type_boolean, 0) == 0 | 290 | if (mailvar_is_true ("verbose")) |
291 | && debug) | ||
292 | debug = 9; | 291 | debug = 9; |
293 | 292 | ||
294 | builtin_display = display_stream_mailcap (NULL, stream, hdr, no_ask, | 293 | builtin_display = display_stream_mailcap (NULL, stream, hdr, no_ask, | ... | ... |
... | @@ -38,7 +38,7 @@ mail_delete (int argc, char **argv) | ... | @@ -38,7 +38,7 @@ mail_delete (int argc, char **argv) |
38 | int rc = util_foreach_msg (argc, argv, MSG_NODELETED|MSG_SILENT, | 38 | int rc = util_foreach_msg (argc, argv, MSG_NODELETED|MSG_SILENT, |
39 | mail_delete_msg, NULL); | 39 | mail_delete_msg, NULL); |
40 | 40 | ||
41 | if (mailvar_get (NULL, "autoprint", mailvar_type_boolean, 0) == 0) | 41 | if (mailvar_is_true ("autoprint")) |
42 | util_do_command("print"); | 42 | util_do_command("print"); |
43 | 43 | ||
44 | return rc; | 44 | return rc; | ... | ... |
... | @@ -273,7 +273,7 @@ escape_run_editor (char *ed, int argc, char **argv, compose_env_t *env) | ... | @@ -273,7 +273,7 @@ escape_run_editor (char *ed, int argc, char **argv, compose_env_t *env) |
273 | } | 273 | } |
274 | 274 | ||
275 | mu_stream_seek (env->compstr, 0, MU_SEEK_SET, NULL); | 275 | mu_stream_seek (env->compstr, 0, MU_SEEK_SET, NULL); |
276 | if (!mailvar_get (NULL, "editheaders", mailvar_type_boolean, 0)) | 276 | if (mailvar_is_true ("editheaders")) |
277 | { | 277 | { |
278 | dump_headers (tempstream, env); | 278 | dump_headers (tempstream, env); |
279 | 279 | ... | ... |
... | @@ -116,7 +116,7 @@ mail_file (int argc, char **argv) | ... | @@ -116,7 +116,7 @@ mail_file (int argc, char **argv) |
116 | mbox = newbox; | 116 | mbox = newbox; |
117 | mu_mailbox_messages_count (mbox, &total); | 117 | mu_mailbox_messages_count (mbox, &total); |
118 | set_cursor (1); | 118 | set_cursor (1); |
119 | if (mailvar_get (NULL, "header", mailvar_type_boolean, 0) == 0) | 119 | if (mailvar_is_true ("header")) |
120 | { | 120 | { |
121 | util_do_command ("summary"); | 121 | util_do_command ("summary"); |
122 | util_do_command ("headers"); | 122 | util_do_command ("headers"); | ... | ... |
... | @@ -193,7 +193,7 @@ hdr_date (struct header_call_args *args, void *data) | ... | @@ -193,7 +193,7 @@ hdr_date (struct header_call_args *args, void *data) |
193 | mu_message_get_header (args->msg, &hdr); | 193 | mu_message_get_header (args->msg, &hdr); |
194 | 194 | ||
195 | date[0] = 0; | 195 | date[0] = 0; |
196 | if (mailvar_get (NULL, "datefield", mailvar_type_boolean, 0) == 0 | 196 | if (mailvar_is_true ("datefield") |
197 | && mu_header_get_value (hdr, MU_HEADER_DATE, | 197 | && mu_header_get_value (hdr, MU_HEADER_DATE, |
198 | date, sizeof (date), NULL) == 0) | 198 | date, sizeof (date), NULL) == 0) |
199 | { | 199 | { |
... | @@ -225,7 +225,7 @@ hdr_from (struct header_call_args *args, void *data) | ... | @@ -225,7 +225,7 @@ hdr_from (struct header_call_args *args, void *data) |
225 | { | 225 | { |
226 | char *from = NULL; | 226 | char *from = NULL; |
227 | 227 | ||
228 | if (mailvar_get (NULL, "fromfield", mailvar_type_boolean, 0) == 0) | 228 | if (mailvar_is_true ("fromfield")) |
229 | { | 229 | { |
230 | mu_header_t hdr; | 230 | mu_header_t hdr; |
231 | 231 | ||
... | @@ -240,9 +240,7 @@ hdr_from (struct header_call_args *args, void *data) | ... | @@ -240,9 +240,7 @@ hdr_from (struct header_call_args *args, void *data) |
240 | 240 | ||
241 | if (mu_address_sget_email (address, 1, &email) == 0) | 241 | if (mu_address_sget_email (address, 1, &email) == 0) |
242 | { | 242 | { |
243 | if (mailvar_get (NULL, "showto", | 243 | if (mailvar_is_true ("showto") && mail_is_my_name (email)) |
244 | mailvar_type_boolean, 0) == 0 | ||
245 | && mail_is_my_name (email)) | ||
246 | { | 244 | { |
247 | char *tmp; | 245 | char *tmp; |
248 | 246 | ... | ... |
... | @@ -318,8 +318,7 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED) | ... | @@ -318,8 +318,7 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED) |
318 | 318 | ||
319 | while (1) | 319 | while (1) |
320 | { | 320 | { |
321 | if (mailvar_get (NULL, "autoinc", mailvar_type_boolean, 0) == 0 | 321 | if (mailvar_is_true ("autoinc") && !mu_mailbox_is_updated (mbox)) |
322 | && !mu_mailbox_is_updated (mbox)) | ||
323 | { | 322 | { |
324 | mu_mailbox_messages_count (mbox, &total); | 323 | mu_mailbox_messages_count (mbox, &total); |
325 | page_invalidate (0); | 324 | page_invalidate (0); |
... | @@ -334,7 +333,7 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED) | ... | @@ -334,7 +333,7 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED) |
334 | continue; | 333 | continue; |
335 | } | 334 | } |
336 | 335 | ||
337 | if (!rc && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0) | 336 | if (!rc && mailvar_is_true ("ignoreeof")) |
338 | { | 337 | { |
339 | mu_error (_("Use \"quit\" to quit.")); | 338 | mu_error (_("Use \"quit\" to quit.")); |
340 | continue; | 339 | continue; |
... | @@ -536,7 +535,7 @@ main (int argc, char **argv) | ... | @@ -536,7 +535,7 @@ main (int argc, char **argv) |
536 | 535 | ||
537 | 536 | ||
538 | /* read system-wide mail.rc and user's .mailrc */ | 537 | /* read system-wide mail.rc and user's .mailrc */ |
539 | if (mailvar_get (NULL, "rc", mailvar_type_boolean, 0) == 0) | 538 | if (mailvar_is_true ("rc")) |
540 | util_do_command ("source %s", SITE_MAIL_RC); | 539 | util_do_command ("source %s", SITE_MAIL_RC); |
541 | if ((p = getenv ("MAILRC")) && *p) | 540 | if ((p = getenv ("MAILRC")) && *p) |
542 | util_do_command ("source %s", getenv ("MAILRC")); | 541 | util_do_command ("source %s", getenv ("MAILRC")); |
... | @@ -581,7 +580,7 @@ main (int argc, char **argv) | ... | @@ -581,7 +580,7 @@ main (int argc, char **argv) |
581 | 580 | ||
582 | mu_argcv_string (argc, argv, &buf); | 581 | mu_argcv_string (argc, argv, &buf); |
583 | rc = util_do_command ("mail %s", buf); | 582 | rc = util_do_command ("mail %s", buf); |
584 | return mailvar_get (NULL, "mailx", mailvar_type_boolean, 0) ? rc : 0; | 583 | return mailvar_is_true ("mailx") ? 0 : rc; |
585 | } | 584 | } |
586 | /* Or acting as a normal reader */ | 585 | /* Or acting as a normal reader */ |
587 | else | 586 | else |
... | @@ -637,8 +636,7 @@ main (int argc, char **argv) | ... | @@ -637,8 +636,7 @@ main (int argc, char **argv) |
637 | } | 636 | } |
638 | 637 | ||
639 | if (total == 0 | 638 | if (total == 0 |
640 | && (strcmp (mode, "read") | 639 | && (strcmp (mode, "read") || !mailvar_is_true ("emptystart"))) |
641 | || mailvar_get (NULL, "emptystart", mailvar_type_boolean, 0))) | ||
642 | { | 640 | { |
643 | if (file) | 641 | if (file) |
644 | mu_printf (_("%s: 0 messages\n"), file); | 642 | mu_printf (_("%s: 0 messages\n"), file); |
... | @@ -648,7 +646,7 @@ main (int argc, char **argv) | ... | @@ -648,7 +646,7 @@ main (int argc, char **argv) |
648 | } | 646 | } |
649 | 647 | ||
650 | /* initial commands */ | 648 | /* initial commands */ |
651 | if (mailvar_get (NULL, "header", mailvar_type_boolean, 0) == 0) | 649 | if (mailvar_is_true ("header")) |
652 | { | 650 | { |
653 | util_do_command ("summary"); | 651 | util_do_command ("summary"); |
654 | util_do_command ("headers"); | 652 | util_do_command ("headers"); | ... | ... |
... | @@ -33,7 +33,7 @@ sig_handler (int signo) | ... | @@ -33,7 +33,7 @@ sig_handler (int signo) |
33 | switch (signo) | 33 | switch (signo) |
34 | { | 34 | { |
35 | case SIGINT: | 35 | case SIGINT: |
36 | if (mailvar_get (NULL, "quit", mailvar_type_boolean, 0) == 0) | 36 | if (mailvar_is_true ("quit")) |
37 | exit (0); | 37 | exit (0); |
38 | _interrupted++; | 38 | _interrupted++; |
39 | break; | 39 | break; | ... | ... |
... | @@ -501,8 +501,7 @@ mailvar_set (const char *variable, void *value, enum mailvar_type type, | ... | @@ -501,8 +501,7 @@ mailvar_set (const char *variable, void *value, enum mailvar_type type, |
501 | enum mailvar_cmd cmd = | 501 | enum mailvar_cmd cmd = |
502 | (flags & MOPTF_UNSET) ? mailvar_cmd_unset : mailvar_cmd_set; | 502 | (flags & MOPTF_UNSET) ? mailvar_cmd_unset : mailvar_cmd_set; |
503 | 503 | ||
504 | if (!(flags & MOPTF_QUIET) | 504 | if (!(flags & MOPTF_QUIET) && mailvar_is_true ("variable-strict")) |
505 | && mailvar_get (NULL, "variable-strict", mailvar_type_boolean, 0) == 0) | ||
506 | { | 505 | { |
507 | if (!sym) | 506 | if (!sym) |
508 | mu_diag_output (MU_DIAG_WARNING, _("setting unknown variable %s"), | 507 | mu_diag_output (MU_DIAG_WARNING, _("setting unknown variable %s"), |
... | @@ -843,8 +842,7 @@ mailvar_print (int set) | ... | @@ -843,8 +842,7 @@ mailvar_print (int set) |
843 | varlist = mailvar_list_copy (set); | 842 | varlist = mailvar_list_copy (set); |
844 | mu_list_count (varlist, &count); | 843 | mu_list_count (varlist, &count); |
845 | clos.out = open_pager (count); | 844 | clos.out = open_pager (count); |
846 | clos.prettyprint = mailvar_get (NULL, "variable-pretty-print", | 845 | clos.prettyprint = mailvar_is_true ("variable-pretty-print"); |
847 | mailvar_type_boolean, 0) == 0; | ||
848 | clos.width = util_screen_columns (); | 846 | clos.width = util_screen_columns (); |
849 | 847 | ||
850 | mu_list_foreach (varlist, mailvar_printer, &clos); | 848 | mu_list_foreach (varlist, mailvar_printer, &clos); | ... | ... |
... | @@ -55,7 +55,7 @@ mail_pipe (int argc, char **argv) | ... | @@ -55,7 +55,7 @@ mail_pipe (int argc, char **argv) |
55 | mu_message_get_streamref (msg, &stream); | 55 | mu_message_get_streamref (msg, &stream); |
56 | mu_stream_copy (outstr, stream, 0, NULL); | 56 | mu_stream_copy (outstr, stream, 0, NULL); |
57 | mu_stream_destroy (&stream); | 57 | mu_stream_destroy (&stream); |
58 | if (mailvar_get (NULL, "page", mailvar_type_boolean, 0) == 0) | 58 | if (mailvar_is_true ("page")) |
59 | mu_stream_write (outstr, "\f\n", 2, NULL); | 59 | mu_stream_write (outstr, "\f\n", 2, NULL); |
60 | } | 60 | } |
61 | util_mark_read (msg); | 61 | util_mark_read (msg); | ... | ... |
... | @@ -36,7 +36,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) | ... | @@ -36,7 +36,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) |
36 | int status; | 36 | int status; |
37 | 37 | ||
38 | mu_message_lines (mesg, &lines); | 38 | mu_message_lines (mesg, &lines); |
39 | if (mailvar_get (NULL, "showenvelope", mailvar_type_boolean, 0) == 0) | 39 | if (mailvar_is_true ("showenvelope")) |
40 | lines++; | 40 | lines++; |
41 | 41 | ||
42 | /* If it is POP or IMAP the lines number is not known, so try | 42 | /* If it is POP or IMAP the lines number is not known, so try |
... | @@ -57,7 +57,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) | ... | @@ -57,7 +57,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) |
57 | 57 | ||
58 | out = open_pager (lines); | 58 | out = open_pager (lines); |
59 | 59 | ||
60 | if (mailvar_get (NULL, "showenvelope", mailvar_type_boolean, 0) == 0) | 60 | if (mailvar_is_true ("showenvelope")) |
61 | print_envelope (mspec, mesg, "From"); | 61 | print_envelope (mspec, mesg, "From"); |
62 | 62 | ||
63 | if (*(int *) data) /* print was called with a lowercase 'p' */ | 63 | if (*(int *) data) /* print was called with a lowercase 'p' */ | ... | ... |
... | @@ -39,7 +39,7 @@ mail_mbox_close () | ... | @@ -39,7 +39,7 @@ mail_mbox_close () |
39 | if (!mbox) | 39 | if (!mbox) |
40 | return 0; | 40 | return 0; |
41 | 41 | ||
42 | if (mailvar_get (NULL, "readonly", mailvar_type_boolean, 0)) | 42 | if (!mailvar_is_true ("readonly")) |
43 | { | 43 | { |
44 | if (mail_mbox_commit ()) | 44 | if (mail_mbox_commit ()) |
45 | return 1; | 45 | return 1; |
... | @@ -67,8 +67,8 @@ mail_mbox_commit () | ... | @@ -67,8 +67,8 @@ mail_mbox_commit () |
67 | int saved_count = 0; | 67 | int saved_count = 0; |
68 | mu_message_t msg; | 68 | mu_message_t msg; |
69 | mu_attribute_t attr; | 69 | mu_attribute_t attr; |
70 | int keepsave = mailvar_get (NULL, "keepsave", mailvar_type_boolean, 0) == 0; | 70 | int keepsave = mailvar_is_true ("keepsave"); |
71 | int hold = mailvar_get (NULL, "hold", mailvar_type_boolean, 0) == 0; | 71 | int hold = mailvar_is_true ("hold"); |
72 | mu_url_t url; | 72 | mu_url_t url; |
73 | int is_user_mbox; | 73 | int is_user_mbox; |
74 | 74 | ... | ... |
... | @@ -83,8 +83,7 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) | ... | @@ -83,8 +83,7 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) |
83 | const char *email; | 83 | const char *email; |
84 | if (mu_address_sget_email (addr, i, &email) || email == NULL) | 84 | if (mu_address_sget_email (addr, i, &email) || email == NULL) |
85 | continue; | 85 | continue; |
86 | if ((mailvar_get (NULL, "metoo", mailvar_type_boolean, 0) == 0) | 86 | if (mailvar_is_true ("metoo") || !mail_is_my_name (email)) |
87 | || !mail_is_my_name (email)) | ||
88 | compose_header_set (&env, MU_HEADER_TO, | 87 | compose_header_set (&env, MU_HEADER_TO, |
89 | email, | 88 | email, |
90 | COMPOSE_SINGLE_LINE); | 89 | COMPOSE_SINGLE_LINE); |
... | @@ -121,9 +120,7 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) | ... | @@ -121,9 +120,7 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) |
121 | 120 | ||
122 | make_in_reply_to (&env, msg); | 121 | make_in_reply_to (&env, msg); |
123 | make_references (&env, msg); | 122 | make_references (&env, msg); |
124 | status = mail_send0 (&env, | 123 | status = mail_send0 (&env, mailvar_is_true ("byname")); |
125 | mailvar_get (NULL, "byname", mailvar_type_boolean, 0) | ||
126 | == 0); | ||
127 | compose_destroy (&env); | 124 | compose_destroy (&env); |
128 | 125 | ||
129 | return status; | 126 | return status; |
... | @@ -133,7 +130,7 @@ int | ... | @@ -133,7 +130,7 @@ int |
133 | mail_reply (int argc, char **argv) | 130 | mail_reply (int argc, char **argv) |
134 | { | 131 | { |
135 | int lower = mu_islower (argv[0][0]); | 132 | int lower = mu_islower (argv[0][0]); |
136 | if (mailvar_get (NULL, "flipr", mailvar_type_boolean, 0) == 0) | 133 | if (mailvar_is_true ("flipr")) |
137 | lower = !lower; | 134 | lower = !lower; |
138 | return util_foreach_msg (argc, argv, MSG_NODELETED, reply0, &lower); | 135 | return util_foreach_msg (argc, argv, MSG_NODELETED, reply0, &lower); |
139 | } | 136 | } | ... | ... |
... | @@ -619,10 +619,10 @@ add_attachments (compose_env_t *env, mu_message_t *pmsg) | ... | @@ -619,10 +619,10 @@ add_attachments (compose_env_t *env, mu_message_t *pmsg) |
619 | static void | 619 | static void |
620 | read_cc_bcc (compose_env_t *env) | 620 | read_cc_bcc (compose_env_t *env) |
621 | { | 621 | { |
622 | if (mailvar_get (NULL, "askcc", mailvar_type_boolean, 0) == 0) | 622 | if (mailvar_is_true ("askcc")) |
623 | compose_header_set (env, MU_HEADER_CC, | 623 | compose_header_set (env, MU_HEADER_CC, |
624 | ml_readline_with_intr ("Cc: "), COMPOSE_REPLACE); | 624 | ml_readline_with_intr ("Cc: "), COMPOSE_REPLACE); |
625 | if (mailvar_get (NULL, "askbcc", mailvar_type_boolean, 0) == 0) | 625 | if (mailvar_is_true ("askbcc")) |
626 | compose_header_set (env, MU_HEADER_BCC, | 626 | compose_header_set (env, MU_HEADER_BCC, |
627 | ml_readline_with_intr ("Bcc: "), COMPOSE_REPLACE); | 627 | ml_readline_with_intr ("Bcc: "), COMPOSE_REPLACE); |
628 | } | 628 | } |
... | @@ -655,7 +655,7 @@ mail_send (int argc, char **argv) | ... | @@ -655,7 +655,7 @@ mail_send (int argc, char **argv) |
655 | if (interactive) | 655 | if (interactive) |
656 | compose_header_set (&env, MU_HEADER_TO, ml_readline_with_intr ("To: "), | 656 | compose_header_set (&env, MU_HEADER_TO, ml_readline_with_intr ("To: "), |
657 | COMPOSE_REPLACE); | 657 | COMPOSE_REPLACE); |
658 | else if (!mailvar_get (NULL, "editheaders", mailvar_type_boolean, 0)) | 658 | else if (mailvar_is_true ("editheaders")) |
659 | { | 659 | { |
660 | if (parse_headers (mu_strin, &env) != parse_headers_ok) | 660 | if (parse_headers (mu_strin, &env) != parse_headers_ok) |
661 | { | 661 | { |
... | @@ -710,10 +710,10 @@ mail_send (int argc, char **argv) | ... | @@ -710,10 +710,10 @@ mail_send (int argc, char **argv) |
710 | 710 | ||
711 | if (interactive) | 711 | if (interactive) |
712 | { | 712 | { |
713 | if (mailvar_get (NULL, "mailx", mailvar_type_boolean, 0)) | 713 | if (!mailvar_is_true ("mailx")) |
714 | read_cc_bcc (&env); | 714 | read_cc_bcc (&env); |
715 | 715 | ||
716 | if (mailvar_get (NULL, "asksub", mailvar_type_boolean, 0) == 0) | 716 | if (mailvar_is_true ("asksub")) |
717 | compose_header_set (&env, MU_HEADER_SUBJECT, | 717 | compose_header_set (&env, MU_HEADER_SUBJECT, |
718 | ml_readline_with_intr ("Subject: "), | 718 | ml_readline_with_intr ("Subject: "), |
719 | COMPOSE_REPLACE); | 719 | COMPOSE_REPLACE); |
... | @@ -859,8 +859,7 @@ compose_header_set (compose_env_t *env, const char *name, | ... | @@ -859,8 +859,7 @@ compose_header_set (compose_env_t *env, const char *name, |
859 | switch (mode) | 859 | switch (mode) |
860 | { | 860 | { |
861 | case COMPOSE_REPLACE: | 861 | case COMPOSE_REPLACE: |
862 | if (is_address_field (name) | 862 | if (is_address_field (name) && mailvar_is_true ("inplacealiases")) |
863 | && mailvar_get (NULL, "inplacealiases", mailvar_type_boolean, 0) == 0) | ||
864 | { | 863 | { |
865 | char *exp = alias_expand (value); | 864 | char *exp = alias_expand (value); |
866 | status = mu_header_set_value (env->header, name, exp ? exp : value, 1); | 865 | status = mu_header_set_value (env->header, name, exp ? exp : value, 1); |
... | @@ -871,8 +870,7 @@ compose_header_set (compose_env_t *env, const char *name, | ... | @@ -871,8 +870,7 @@ compose_header_set (compose_env_t *env, const char *name, |
871 | break; | 870 | break; |
872 | 871 | ||
873 | case COMPOSE_APPEND: | 872 | case COMPOSE_APPEND: |
874 | if (is_address_field (name) | 873 | if (is_address_field (name) && mailvar_is_true ("inplacealiases")) |
875 | && mailvar_get (NULL, "inplacealiases", mailvar_type_boolean, 0) == 0) | ||
876 | { | 874 | { |
877 | char *exp = alias_expand (value); | 875 | char *exp = alias_expand (value); |
878 | status = mu_header_append (env->header, name, exp ? exp : value); | 876 | status = mu_header_append (env->header, name, exp ? exp : value); |
... | @@ -886,8 +884,7 @@ compose_header_set (compose_env_t *env, const char *name, | ... | @@ -886,8 +884,7 @@ compose_header_set (compose_env_t *env, const char *name, |
886 | if (mu_header_aget_value (env->header, name, &old_value) == 0 | 884 | if (mu_header_aget_value (env->header, name, &old_value) == 0 |
887 | && old_value[0]) | 885 | && old_value[0]) |
888 | { | 886 | { |
889 | if (is_address_field (name) | 887 | if (is_address_field (name) && mailvar_is_true ("inplacealiases")) |
890 | && mailvar_get (NULL, "inplacealiases", mailvar_type_boolean, 0) == 0) | ||
891 | { | 888 | { |
892 | char *exp = alias_expand (value); | 889 | char *exp = alias_expand (value); |
893 | status = util_merge_addresses (&old_value, exp ? exp : value); | 890 | status = util_merge_addresses (&old_value, exp ? exp : value); |
... | @@ -971,7 +968,7 @@ fill_body (mu_message_t msg, mu_stream_t instr) | ... | @@ -971,7 +968,7 @@ fill_body (mu_message_t msg, mu_stream_t instr) |
971 | 968 | ||
972 | if (n == 0) | 969 | if (n == 0) |
973 | { | 970 | { |
974 | if (mailvar_get (NULL, "nullbody", mailvar_type_boolean, 0) == 0) | 971 | if (mailvar_is_true ("nullbody")) |
975 | { | 972 | { |
976 | char *str; | 973 | char *str; |
977 | if (mailvar_get (&str, "nullbodymsg", mailvar_type_string, 0) == 0) | 974 | if (mailvar_get (&str, "nullbodymsg", mailvar_type_string, 0) == 0) |
... | @@ -987,7 +984,7 @@ fill_body (mu_message_t msg, mu_stream_t instr) | ... | @@ -987,7 +984,7 @@ fill_body (mu_message_t msg, mu_stream_t instr) |
987 | static int | 984 | static int |
988 | save_dead_message_env (compose_env_t *env) | 985 | save_dead_message_env (compose_env_t *env) |
989 | { | 986 | { |
990 | if (mailvar_get (NULL, "save", mailvar_type_boolean, 0) == 0) | 987 | if (mailvar_is_true ("save")) |
991 | { | 988 | { |
992 | mu_stream_t dead_letter, str; | 989 | mu_stream_t dead_letter, str; |
993 | int rc; | 990 | int rc; |
... | @@ -1005,8 +1002,7 @@ save_dead_message_env (compose_env_t *env) | ... | @@ -1005,8 +1002,7 @@ save_dead_message_env (compose_env_t *env) |
1005 | mu_error (_("Cannot open file %s: %s"), name, strerror (rc)); | 1002 | mu_error (_("Cannot open file %s: %s"), name, strerror (rc)); |
1006 | return 1; | 1003 | return 1; |
1007 | } | 1004 | } |
1008 | if (mailvar_get (NULL, "appenddeadletter", | 1005 | if (mailvar_is_true ("appenddeadletter")) |
1009 | mailvar_type_boolean, 0) == 0) | ||
1010 | mu_stream_seek (dead_letter, 0, MU_SEEK_END, NULL); | 1006 | mu_stream_seek (dead_letter, 0, MU_SEEK_END, NULL); |
1011 | else | 1007 | else |
1012 | mu_stream_truncate (dead_letter, 0); | 1008 | mu_stream_truncate (dead_letter, 0); |
... | @@ -1039,7 +1035,7 @@ save_dead_message_env (compose_env_t *env) | ... | @@ -1039,7 +1035,7 @@ save_dead_message_env (compose_env_t *env) |
1039 | static int | 1035 | static int |
1040 | save_dead_message (mu_message_t msg) | 1036 | save_dead_message (mu_message_t msg) |
1041 | { | 1037 | { |
1042 | if (mailvar_get (NULL, "save", mailvar_type_boolean, 0) == 0) | 1038 | if (mailvar_is_true ("save")) |
1043 | { | 1039 | { |
1044 | mu_stream_t dead_letter, str; | 1040 | mu_stream_t dead_letter, str; |
1045 | int rc; | 1041 | int rc; |
... | @@ -1057,8 +1053,7 @@ save_dead_message (mu_message_t msg) | ... | @@ -1057,8 +1053,7 @@ save_dead_message (mu_message_t msg) |
1057 | mu_error (_("Cannot open file %s: %s"), name, strerror (rc)); | 1053 | mu_error (_("Cannot open file %s: %s"), name, strerror (rc)); |
1058 | return 1; | 1054 | return 1; |
1059 | } | 1055 | } |
1060 | if (mailvar_get (NULL, "appenddeadletter", | 1056 | if (mailvar_is_true ("appenddeadletter")) |
1061 | mailvar_type_boolean, 0) == 0) | ||
1062 | mu_stream_seek (dead_letter, 0, MU_SEEK_END, NULL); | 1057 | mu_stream_seek (dead_letter, 0, MU_SEEK_END, NULL); |
1063 | else | 1058 | else |
1064 | mu_stream_truncate (dead_letter, 0); | 1059 | mu_stream_truncate (dead_letter, 0); |
... | @@ -1117,7 +1112,7 @@ send_message (mu_message_t msg) | ... | @@ -1117,7 +1112,7 @@ send_message (mu_message_t msg) |
1117 | } | 1112 | } |
1118 | } | 1113 | } |
1119 | 1114 | ||
1120 | if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0) == 0) | 1115 | if (mailvar_is_true ("verbose")) |
1121 | { | 1116 | { |
1122 | mu_debug_set_category_level (MU_DEBCAT_MAILER, | 1117 | mu_debug_set_category_level (MU_DEBCAT_MAILER, |
1123 | MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); | 1118 | MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); |
... | @@ -1188,7 +1183,7 @@ mail_send0 (compose_env_t *env, int save_to) | ... | @@ -1188,7 +1183,7 @@ mail_send0 (compose_env_t *env, int save_to) |
1188 | 1183 | ||
1189 | if (ml_got_interrupt ()) | 1184 | if (ml_got_interrupt ()) |
1190 | { | 1185 | { |
1191 | if (mailvar_get (NULL, "ignore", mailvar_type_boolean, 0) == 0) | 1186 | if (mailvar_is_true ("ignore")) |
1192 | { | 1187 | { |
1193 | mu_printf ("@\n"); | 1188 | mu_printf ("@\n"); |
1194 | } | 1189 | } |
... | @@ -1205,12 +1200,11 @@ mail_send0 (compose_env_t *env, int save_to) | ... | @@ -1205,12 +1200,11 @@ mail_send0 (compose_env_t *env, int save_to) |
1205 | 1200 | ||
1206 | if (!buf) | 1201 | if (!buf) |
1207 | { | 1202 | { |
1208 | if (interactive | 1203 | if (interactive && mailvar_is_true ("ignoreeof")) |
1209 | && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0) | ||
1210 | { | 1204 | { |
1211 | mu_error (mailvar_get (NULL, "dot", mailvar_type_boolean, 0) == 0 ? | 1205 | mu_error (mailvar_is_true ("dot") |
1212 | _("Use \".\" to terminate letter.") : | 1206 | ? _("Use \".\" to terminate letter.") |
1213 | _("Use \"~.\" to terminate letter.")); | 1207 | : _("Use \"~.\" to terminate letter.")); |
1214 | continue; | 1208 | continue; |
1215 | } | 1209 | } |
1216 | else | 1210 | else |
... | @@ -1219,8 +1213,7 @@ mail_send0 (compose_env_t *env, int save_to) | ... | @@ -1219,8 +1213,7 @@ mail_send0 (compose_env_t *env, int save_to) |
1219 | 1213 | ||
1220 | int_cnt = 0; | 1214 | int_cnt = 0; |
1221 | 1215 | ||
1222 | if (strcmp (buf, ".") == 0 | 1216 | if (strcmp (buf, ".") == 0 && mailvar_is_true ("dot")) |
1223 | && mailvar_get (NULL, "dot", mailvar_type_boolean, 0) == 0) | ||
1224 | done = 1; | 1217 | done = 1; |
1225 | else if (mailvar_get (&escape, "escape", mailvar_type_string, 0) == 0 | 1218 | else if (mailvar_get (&escape, "escape", mailvar_type_string, 0) == 0 |
1226 | && buf[0] == escape[0]) | 1219 | && buf[0] == escape[0]) |
... | @@ -1276,13 +1269,12 @@ mail_send0 (compose_env_t *env, int save_to) | ... | @@ -1276,13 +1269,12 @@ mail_send0 (compose_env_t *env, int save_to) |
1276 | 1269 | ||
1277 | /* In mailx compatibility mode, ask for Cc and Bcc after editing | 1270 | /* In mailx compatibility mode, ask for Cc and Bcc after editing |
1278 | the body of the message */ | 1271 | the body of the message */ |
1279 | if (mailvar_get (NULL, "mailx", mailvar_type_boolean, 0) == 0) | 1272 | if (mailvar_is_true ("mailx")) |
1280 | read_cc_bcc (env); | 1273 | read_cc_bcc (env); |
1281 | 1274 | ||
1282 | /* Prepare the header */ | 1275 | /* Prepare the header */ |
1283 | if (mailvar_get (NULL, "xmailer", mailvar_type_boolean, 0) == 0) | 1276 | if (mailvar_is_true ("xmailer")) |
1284 | mu_header_set_value (env->header, MU_HEADER_X_MAILER, | 1277 | mu_header_set_value (env->header, MU_HEADER_X_MAILER, program_version, 1); |
1285 | program_version, 1); | ||
1286 | 1278 | ||
1287 | if (util_header_expand (&env->header) == 0) | 1279 | if (util_header_expand (&env->header) == 0) |
1288 | { | 1280 | { | ... | ... |
... | @@ -78,7 +78,7 @@ mail_execute (int shell, char *progname, int argc, char **argv) | ... | @@ -78,7 +78,7 @@ mail_execute (int shell, char *progname, int argc, char **argv) |
78 | xargv = mu_calloc (xargc + 1, sizeof (xargv[0])); | 78 | xargv = mu_calloc (xargc + 1, sizeof (xargv[0])); |
79 | 79 | ||
80 | /* Expand arguments if required */ | 80 | /* Expand arguments if required */ |
81 | if (mailvar_get (NULL, "bang", mailvar_type_boolean, 0) == 0) | 81 | if (mailvar_is_true ("bang")) |
82 | { | 82 | { |
83 | int i; | 83 | int i; |
84 | char *last = NULL; | 84 | char *last = NULL; | ... | ... |
... | @@ -403,7 +403,7 @@ util_get_crt () | ... | @@ -403,7 +403,7 @@ util_get_crt () |
403 | 403 | ||
404 | if (mailvar_get (&lines, "crt", mailvar_type_number, 0) == 0) | 404 | if (mailvar_get (&lines, "crt", mailvar_type_number, 0) == 0) |
405 | return lines; | 405 | return lines; |
406 | else if (mailvar_get (NULL, "crt", mailvar_type_boolean, 0) == 0) | 406 | else if (mailvar_is_true ("crt")) |
407 | return util_getlines (); | 407 | return util_getlines (); |
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
... | @@ -931,12 +931,11 @@ util_header_expand (mu_header_t *phdr) | ... | @@ -931,12 +931,11 @@ util_header_expand (mu_header_t *phdr) |
931 | mu_address_t new_addr; | 931 | mu_address_t new_addr; |
932 | char *p = ws.ws_wordv[j]; | 932 | char *p = ws.ws_wordv[j]; |
933 | 933 | ||
934 | /* If inplacealiases was set, the value was already expanded */ | 934 | if (mailvar_is_true ("inplacealiases")) |
935 | if (mailvar_get (NULL, "inplacealiases", | 935 | /* If inplacealiases was set, the value was already expanded */ |
936 | mailvar_type_boolean, 0)) | ||
937 | exp = alias_expand (p); | ||
938 | else | ||
939 | exp = p; | 936 | exp = p; |
937 | else | ||
938 | exp = alias_expand (p); | ||
940 | rc = mu_address_create (&new_addr, p); | 939 | rc = mu_address_create (&new_addr, p); |
941 | if (rc) | 940 | if (rc) |
942 | { | 941 | { |
... | @@ -1072,7 +1071,7 @@ util_rfc2047_decode (char **value) | ... | @@ -1072,7 +1071,7 @@ util_rfc2047_decode (char **value) |
1072 | rc = mu_rfc2047_decode (charset, *value, &tmp); | 1071 | rc = mu_rfc2047_decode (charset, *value, &tmp); |
1073 | if (rc) | 1072 | if (rc) |
1074 | { | 1073 | { |
1075 | if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0) == 0) | 1074 | if (mailvar_is_true ("verbose")) |
1076 | mu_error (_("Cannot decode line `%s': %s"), *value, mu_strerror (rc)); | 1075 | mu_error (_("Cannot decode line `%s': %s"), *value, mu_strerror (rc)); |
1077 | } | 1076 | } |
1078 | else | 1077 | else | ... | ... |
-
Please register or sign in to post a comment