NeoMutt  2024-03-23-142-g2b2e76
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
132#define GNULIB_defined_setlocale
133
134#include "config.h"
135#include <errno.h>
136#include <limits.h>
137#include <locale.h>
138#include <pwd.h>
139#include <stdbool.h>
140#include <stdint.h>
141#include <stdio.h>
142#include <stdlib.h>
143#include <string.h>
144#include <sys/stat.h>
145#include <unistd.h>
146#include "mutt/lib.h"
147#include "address/lib.h"
148#include "config/lib.h"
149#include "email/lib.h"
150#include "core/lib.h"
151#include "alias/lib.h"
152#include "conn/lib.h"
153#include "gui/lib.h"
154#include "attach/lib.h"
155#include "browser/lib.h"
156#include "color/lib.h"
157#include "history/lib.h"
158#include "imap/lib.h"
159#include "index/lib.h"
160#include "key/lib.h"
161#include "menu/lib.h"
162#include "ncrypt/lib.h"
163#include "nntp/lib.h"
164#include "pop/lib.h"
165#include "postpone/lib.h"
166#include "question/lib.h"
167#include "send/lib.h"
168#include "alternates.h"
169#include "external.h"
170#include "globals.h"
171#include "hook.h"
172#include "init.h"
173#include "mutt_logging.h"
174#include "mutt_mailbox.h"
175#include "muttlib.h"
176#include "mx.h"
177#include "nntp/adata.h" // IWYU pragma: keep
178#include "protos.h"
179#include "subjectrx.h"
180#include "version.h"
181#ifdef ENABLE_NLS
182#include <libintl.h>
183#endif
184#ifdef USE_AUTOCRYPT
185#include "autocrypt/lib.h"
186#endif
187#if defined(USE_DEBUG_NOTIFY) || defined(USE_DEBUG_BACKTRACE)
188#include "debug/lib.h"
189#endif
190
191bool StartupComplete = false;
192
193// clang-format off
194typedef uint8_t CliFlags;
195#define MUTT_CLI_NO_FLAGS 0
196#define MUTT_CLI_IGNORE (1 << 0)
197#define MUTT_CLI_MAILBOX (1 << 1)
198#define MUTT_CLI_NOSYSRC (1 << 2)
199#define MUTT_CLI_RO (1 << 3)
200#define MUTT_CLI_SELECT (1 << 4)
201#define MUTT_CLI_NEWS (1 << 5)
202// clang-format on
203
208static void reset_tilde(struct ConfigSet *cs)
209{
210 static const char *names[] = { "folder", "mbox", "postponed", "record" };
211
212 struct Buffer *value = buf_pool_get();
213 for (size_t i = 0; i < mutt_array_size(names); i++)
214 {
215 struct HashElem *he = cs_get_elem(cs, names[i]);
216 if (!he)
217 continue;
218 buf_reset(value);
219 cs_he_initial_get(cs, he, value);
220 buf_expand_path_regex(value, false);
221 cs_he_initial_set(cs, he, value->data, NULL);
222 cs_he_reset(cs, he, NULL);
223 }
224 buf_pool_release(&value);
225}
226
227#ifdef ENABLE_NLS
232static void localise_config(struct ConfigSet *cs)
233{
234 static const char *names[] = {
235 "attribution_intro",
236 "compose_format",
237 "forward_attribution_intro",
238 "forward_attribution_trailer",
239 "reply_regex",
240 "status_format",
241 "ts_icon_format",
242 "ts_status_format",
243 };
244
245 struct Buffer *value = buf_pool_get();
246 for (size_t i = 0; i < mutt_array_size(names); i++)
247 {
248 struct HashElem *he = cs_get_elem(cs, names[i]);
249 if (!he)
250 continue;
251 buf_reset(value);
252 cs_he_initial_get(cs, he, value);
253
254 // Lookup the translation
255 const char *l10n = gettext(buf_string(value));
256
257 cs_he_initial_set(cs, he, l10n, NULL);
258 cs_he_reset(cs, he, NULL);
259 }
260 buf_pool_release(&value);
261}
262#endif
263
268void mutt_exit(int code)
269{
270 mutt_endwin();
271#ifdef USE_DEBUG_BACKTRACE
272 if (code != 0)
274#endif
275 exit(code);
276}
277
282static bool usage(void)
283{
284 puts(mutt_make_version());
285
286 // clang-format off
287 /* L10N: Try to limit to 80 columns */
288 puts(_("usage:"));
289 puts(_(" neomutt [-CEnx] [-e <command>] [-F <config>] [-H <draft>] [-i <include>]\n"
290 " [-b <address>] [-c <address>] [-s <subject>] [-a <file> [...] --]\n"
291 " <address> [...]"));
292 puts(_(" neomutt [-Cnx] [-e <command>] [-F <config>] [-b <address>] [-c <address>]\n"
293 " [-s <subject>] [-a <file> [...] --] <address> [...] < message"));
294 puts(_(" neomutt [-nRy] [-e <command>] [-F <config>] [-f <mailbox>] [-m <type>]"));
295 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -A <alias>"));
296 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -B"));
297 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -D [-S] [-O]"));
298 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -d <level> -l <file>"));
299 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -G"));
300 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -g <server>"));
301 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -p"));
302 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -Q <variable> [-O]"));
303 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -Z"));
304 puts(_(" neomutt [-n] [-e <command>] [-F <config>] -z [-f <mailbox>]"));
305 puts(_(" neomutt -v[v]\n"));
306
307 /* L10N: Try to limit to 80 columns. If more space is needed add an indented line */
308 puts(_("options:"));
309 puts(_(" -- Special argument forces NeoMutt to stop option parsing and treat\n"
310 " remaining arguments as addresses even if they start with a dash"));
311 puts(_(" -A <alias> Print an expanded version of the given alias to stdout and exit"));
312 puts(_(" -a <file> Attach one or more files to a message (must be the last option)\n"
313 " Add any addresses after the '--' argument"));
314 puts(_(" -B Run in batch mode (do not start the ncurses UI)"));
315 puts(_(" -b <address> Specify a blind carbon copy (Bcc) recipient"));
316 puts(_(" -c <address> Specify a carbon copy (Cc) recipient"));
317 puts(_(" -C Enable Command-line Crypto (signing/encryption)"));
318 puts(_(" -D Dump all config variables as 'name=value' pairs to stdout"));
319 puts(_(" -D -O Like -D, but show one-liner documentation"));
320 puts(_(" -D -S Like -D, but hide the value of sensitive variables"));
321 puts(_(" -d <level> Log debugging output to a file (default is \"~/.neomuttdebug0\")\n"
322 " The level can range from 1-5 and affects verbosity"));
323 puts(_(" -E Edit draft (-H) or include (-i) file during message composition"));
324 puts(_(" -e <command> Specify a command to be run after reading the config files"));
325 puts(_(" -F <config> Specify an alternative initialization file to read"));
326 puts(_(" -f <mailbox> Specify a mailbox (as defined with 'mailboxes' command) to load"));
327 puts(_(" -G Start NeoMutt with a listing of subscribed newsgroups"));
328 puts(_(" -g <server> Like -G, but start at specified news server"));
329 puts(_(" -H <draft> Specify a draft file with header and body for message composing"));
330 puts(_(" -h Print this help message and exit"));
331 puts(_(" -i <include> Specify an include file to be embedded in the body of a message"));
332 puts(_(" -l <file> Specify a file for debugging output (default \"~/.neomuttdebug0\")"));
333 puts(_(" -m <type> Specify a default mailbox format type for newly created folders\n"
334 " The type is either MH, MMDF, Maildir or mbox (case-insensitive)"));
335 puts(_(" -n Do not read the system-wide configuration file"));
336 puts(_(" -p Resume a prior postponed message, if any"));
337 puts(_(" -Q <variable> Query a configuration variable and print its value to stdout\n"
338 " (after the config has been read and any commands executed)\n"
339 " Add -O for one-liner documentation"));
340 puts(_(" -R Open mailbox in read-only mode"));
341 puts(_(" -s <subject> Specify a subject (must be enclosed in quotes if it has spaces)"));
342 puts(_(" -v Print the NeoMutt version and compile-time definitions and exit"));
343 puts(_(" -vv Print the NeoMutt license and copyright information and exit"));
344 puts(_(" -y Start NeoMutt with a listing of all defined mailboxes"));
345 puts(_(" -Z Open the first mailbox with new message or exit immediately with\n"
346 " exit code 1 if none is found in all defined mailboxes"));
347 puts(_(" -z Open the first or specified (-f) mailbox if it holds any message\n"
348 " or exit immediately with exit code 1 otherwise"));
349 // clang-format on
350
351 fflush(stdout);
352 return !ferror(stdout);
353}
354
360static int start_curses(void)
361{
362 km_init(); /* must come before mutt_init */
363
364 /* should come before initscr() so that ncurses 4.2 doesn't try to install
365 * its own SIGWINCH handler */
367
368 if (!initscr())
369 {
370 mutt_error(_("Error initializing terminal"));
371 return 1;
372 }
373
375 keypad(stdscr, true);
376 cbreak();
377 noecho();
378 nonl();
379 typeahead(-1); /* simulate smooth scrolling */
380 meta(stdscr, true);
382 /* Now that curses is set up, we drop back to normal screen mode.
383 * This simplifies displaying error messages to the user.
384 * The first call to refresh() will swap us back to curses screen mode. */
385 endwin();
386 return 0;
387}
388
392static void init_locale(void)
393{
394 setlocale(LC_ALL, "");
395
396#ifdef ENABLE_NLS
397 const char *domdir = mutt_str_getenv("TEXTDOMAINDIR");
398 if (domdir)
399 bindtextdomain(PACKAGE, domdir);
400 else
401 bindtextdomain(PACKAGE, MUTTLOCALEDIR);
402 textdomain(PACKAGE);
403#endif
404#ifndef LOCALES_HACK
405 /* Do we have a locale definition? */
406 if (mutt_str_getenv("LC_ALL") || mutt_str_getenv("LANG") || mutt_str_getenv("LC_CTYPE"))
407 {
408 OptLocales = true;
409 }
410#endif
411}
412
420static bool get_user_info(struct ConfigSet *cs)
421{
422 const char *shell = mutt_str_getenv("SHELL");
423 if (shell)
424 cs_str_initial_set(cs, "shell", shell, NULL);
425
426 /* Get some information about the user */
427 struct passwd *pw = getpwuid(getuid());
428 if (pw)
429 {
430 if (!Username)
431 Username = mutt_str_dup(pw->pw_name);
432 if (!HomeDir)
433 HomeDir = mutt_str_dup(pw->pw_dir);
434 if (!shell)
435 cs_str_initial_set(cs, "shell", pw->pw_shell, NULL);
436 }
437
438 if (!Username)
439 {
440 mutt_error(_("unable to determine username"));
441 return false; // TEST05: neomutt (unset $USER, delete user from /etc/passwd)
442 }
443
444 if (!HomeDir)
445 {
446 mutt_error(_("unable to determine home directory"));
447 return false; // TEST06: neomutt (unset $HOME, delete user from /etc/passwd)
448 }
449
450 cs_str_reset(cs, "shell", NULL);
451 return true;
452}
453
461static void log_translation(void)
462{
463 const char *header = ""; // Do not merge these two lines
464 header = _(header); // otherwise the .po files will end up badly ordered
465 const char *label = "Language:"; // the start of the lookup/needle
466 const char *lang = mutt_istr_find(header, label);
467 int len = 64;
468 if (lang)
469 {
470 lang += strlen(label); // skip label
471 SKIPWS(lang);
472 char *nl = strchr(lang, '\n');
473 if (nl)
474 len = (nl - lang);
475 }
476 else
477 {
478 lang = "NONE";
479 }
480
481 mutt_debug(LL_DEBUG1, "Translation: %.*s\n", len, lang);
482}
483
487static void log_gui(void)
488{
489 const char *term = mutt_str_getenv("TERM");
490 const char *color_term = mutt_str_getenv("COLORTERM");
491 bool true_color = false;
492#ifdef NEOMUTT_DIRECT_COLORS
493 true_color = true;
494#endif
495
496 mutt_debug(LL_DEBUG1, "GUI:\n");
497 mutt_debug(LL_DEBUG1, " Curses: %s\n", curses_version());
498 mutt_debug(LL_DEBUG1, " COLORS=%d\n", COLORS);
499 mutt_debug(LL_DEBUG1, " COLOR_PAIRS=%d\n", COLOR_PAIRS);
500 mutt_debug(LL_DEBUG1, " TERM=%s\n", NONULL(term));
501 mutt_debug(LL_DEBUG1, " COLORTERM=%s\n", NONULL(color_term));
502 mutt_debug(LL_DEBUG1, " True color support: %s\n", true_color ? "YES" : "NO");
503 mutt_debug(LL_DEBUG1, " Screen: %dx%d\n", RootWindow->state.cols,
505}
506
511{
512 static time_t last_run = 0;
513
514 if (nc->event_type != NT_TIMEOUT)
515 return 0;
516
517 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
518 if (c_timeout <= 0)
519 goto done;
520
521 time_t now = mutt_date_now();
522 if (now < (last_run + c_timeout))
523 goto done;
524
525 // Limit hook to running under the Index or Pager
527 struct MuttWindow *dlg = dialog_find(focus);
528 if (!dlg || (dlg->type != WT_DLG_INDEX))
529 goto done;
530
531 last_run = now;
533
534done:
535 mutt_debug(LL_DEBUG5, "timeout done\n");
536 return 0;
537}
538
547int
548#ifdef ENABLE_FUZZ_TESTS
549disabled_main
550#else
552#endif
553(int argc, char *argv[], char *envp[])
554{
555 char *subject = NULL;
556 char *include_file = NULL;
557 char *draft_file = NULL;
558 char *new_type = NULL;
559 char *dlevel = NULL;
560 char *dfile = NULL;
561 const char *cli_nntp = NULL;
562 struct Email *e = NULL;
563 struct ListHead attach = STAILQ_HEAD_INITIALIZER(attach);
564 struct ListHead commands = STAILQ_HEAD_INITIALIZER(commands);
565 struct ListHead queries = STAILQ_HEAD_INITIALIZER(queries);
566 struct ListHead alias_queries = STAILQ_HEAD_INITIALIZER(alias_queries);
567 struct ListHead cc_list = STAILQ_HEAD_INITIALIZER(cc_list);
568 struct ListHead bcc_list = STAILQ_HEAD_INITIALIZER(bcc_list);
569 SendFlags sendflags = SEND_NO_FLAGS;
571 int version = 0;
572 int i;
573 bool explicit_folder = false;
574 bool dump_variables = false;
575 bool one_liner = false;
576 bool hide_sensitive = false;
577 bool batch_mode = false;
578 bool edit_infile = false;
579 int double_dash = argc, nargc = 1;
580 int rc = 1;
581 bool repeat_error = false;
582 struct Buffer *folder = buf_pool_get();
583 struct Buffer *expanded_infile = buf_pool_get();
584 struct Buffer *tempfile = buf_pool_get();
585 struct ConfigSet *cs = NULL;
586
588
589 /* sanity check against stupid administrators */
590 if (getegid() != getgid())
591 {
592 mutt_error("%s: I don't want to run with privileges!", (argc != 0) ? argv[0] : "neomutt");
593 goto main_exit; // TEST01: neomutt (as root, chgrp mail neomutt; chmod +s neomutt)
594 }
595
596 init_locale();
597
598 umask(077);
599
600 EnvList = envlist_init(envp);
601 for (optind = 1; optind < double_dash;)
602 {
603 /* We're getopt'ing POSIXLY, so we'll be here every time getopt()
604 * encounters a non-option. That could be a file to attach
605 * (all non-options between -a and --) or it could be an address
606 * (which gets collapsed to the front of argv). */
607 for (; optind < argc; optind++)
608 {
609 if ((argv[optind][0] == '-') && (argv[optind][1] != '\0'))
610 {
611 if ((argv[optind][1] == '-') && (argv[optind][2] == '\0'))
612 double_dash = optind; /* quit outer loop after getopt */
613 break; /* drop through to getopt */
614 }
615
616 /* non-option, either an attachment or address */
617 if (!STAILQ_EMPTY(&attach))
618 mutt_list_insert_tail(&attach, mutt_str_dup(argv[optind]));
619 else
620 argv[nargc++] = argv[optind];
621 }
622
623 i = getopt(argc, argv, "+A:a:Bb:F:f:Cc:Dd:l:Ee:g:GH:i:hm:nOpQ:RSs:TvxyzZ");
624 if (i != EOF)
625 {
626 switch (i)
627 {
628 case 'A':
629 mutt_list_insert_tail(&alias_queries, mutt_str_dup(optarg));
630 break;
631 case 'a':
632 mutt_list_insert_tail(&attach, mutt_str_dup(optarg));
633 break;
634 case 'B':
635 batch_mode = true;
636 break;
637 case 'b':
638 mutt_list_insert_tail(&bcc_list, mutt_str_dup(optarg));
639 break;
640 case 'C':
641 sendflags |= SEND_CLI_CRYPTO;
642 break;
643 case 'c':
644 mutt_list_insert_tail(&cc_list, mutt_str_dup(optarg));
645 break;
646 case 'D':
647 dump_variables = true;
648 break;
649 case 'd':
650 dlevel = optarg;
651 break;
652 case 'E':
653 edit_infile = true;
654 break;
655 case 'e':
656 mutt_list_insert_tail(&commands, mutt_str_dup(optarg));
657 break;
658 case 'F':
660 break;
661 case 'f':
662 buf_strcpy(folder, optarg);
663 explicit_folder = true;
664 break;
665 case 'g': /* Specify a news server */
666 cli_nntp = optarg;
668
669 case 'G': /* List of newsgroups */
671 break;
672 case 'H':
673 draft_file = optarg;
674 break;
675 case 'i':
676 include_file = optarg;
677 break;
678 case 'l':
679 dfile = optarg;
680 break;
681 case 'm':
682 new_type = optarg;
683 break;
684 case 'n':
685 flags |= MUTT_CLI_NOSYSRC;
686 break;
687 case 'O':
688 one_liner = true;
689 break;
690 case 'p':
691 sendflags |= SEND_POSTPONED;
692 break;
693 case 'Q':
694 mutt_list_insert_tail(&queries, mutt_str_dup(optarg));
695 break;
696 case 'R':
697 flags |= MUTT_CLI_RO; /* read-only mode */
698 break;
699 case 'S':
700 hide_sensitive = true;
701 break;
702 case 's':
703 subject = optarg;
704 break;
705 case 'v':
706 version++;
707 break;
708 case 'y': /* My special hack mode */
709 flags |= MUTT_CLI_SELECT;
710 break;
711 case 'Z':
713 break;
714 case 'z':
715 flags |= MUTT_CLI_IGNORE;
716 break;
717 default:
718 OptNoCurses = true;
719 if (usage())
720 goto main_ok; // TEST03: neomutt -9
721 else
722 goto main_curses;
723 }
724 }
725 }
726
727 /* collapse remaining argv */
728 while (optind < argc)
729 argv[nargc++] = argv[optind++];
730 optind = 1;
731 argc = nargc;
732
733 if (version > 0)
734 {
736 bool done;
737 if (version == 1)
738 done = print_version(stdout);
739 else
740 done = print_copyright();
741 OptNoCurses = true;
742 if (done)
743 goto main_ok; // TEST04: neomutt -v
744 else
745 goto main_curses;
746 }
747
750
751 cs = cs_new(500);
752 if (!cs)
753 goto main_curses;
754
755 NeoMutt = neomutt_new(cs);
756 init_config(cs);
757 subjrx_init();
758 attach_init();
760
761#ifdef USE_DEBUG_NOTIFY
763#endif
764
765 if (!get_user_info(cs))
766 goto main_exit;
767
768 reset_tilde(cs);
769#ifdef ENABLE_NLS
770 localise_config(cs);
771#endif
772
773 if (dfile)
774 {
775 cs_str_initial_set(cs, "debug_file", dfile, NULL);
776 cs_str_reset(cs, "debug_file", NULL);
777 }
778
779 if (dlevel)
780 {
781 short num = 0;
782 if (!mutt_str_atos_full(dlevel, &num) || (num < LL_MESSAGE) || (num >= LL_MAX))
783 {
784 mutt_error(_("Error: value '%s' is invalid for -d"), dlevel);
785 goto main_exit; // TEST07: neomutt -d xyz
786 }
787 cs_str_initial_set(cs, "debug_level", dlevel, NULL);
788 cs_str_reset(cs, "debug_level", NULL);
789 }
790
794
795 if (!STAILQ_EMPTY(&cc_list) || !STAILQ_EMPTY(&bcc_list))
796 {
797 e = email_new();
798 e->env = mutt_env_new();
799
800 struct ListNode *np = NULL;
801 STAILQ_FOREACH(np, &bcc_list, entries)
802 {
803 mutt_addrlist_parse(&e->env->bcc, np->data);
804 }
805
806 STAILQ_FOREACH(np, &cc_list, entries)
807 {
808 mutt_addrlist_parse(&e->env->cc, np->data);
809 }
810
811 mutt_list_free(&bcc_list);
812 mutt_list_free(&cc_list);
813 }
814
815 /* Check for a batch send. */
816 if (!isatty(0) || !STAILQ_EMPTY(&queries) || !STAILQ_EMPTY(&alias_queries) ||
817 dump_variables || batch_mode)
818 {
819 OptNoCurses = true;
820 sendflags |= SEND_BATCH;
823 }
824
825 /* Check to make sure stdout is available in curses mode. */
826 if (!OptNoCurses && !isatty(1))
827 goto main_curses;
828
829 /* This must come before mutt_init() because curses needs to be started
830 * before calling the init_pair() function to set the color scheme. */
831 if (!OptNoCurses)
832 {
833 int crc = start_curses();
834 if (crc != 0)
835 goto main_curses; // TEST08: can't test -- fake term?
836 }
837
838 /* Always create the mutt_windows because batch mode has some shared code
839 * paths that end up referencing them. */
840 rootwin_new();
841
842 if (!OptNoCurses)
843 {
844 /* check whether terminal status is supported (must follow curses init) */
847 log_gui();
848 }
849
850 /* set defaults and read init files */
851 int rc2 = mutt_init(cs, dlevel, dfile, flags & MUTT_CLI_NOSYSRC, &commands);
852 if (rc2 != 0)
853 goto main_curses;
854
856
857 /* "$news_server" precedence: command line, config file, environment, system file */
858 if (!cli_nntp)
859 cli_nntp = cs_subset_string(NeoMutt->sub, "news_server");
860
861 if (!cli_nntp)
862 cli_nntp = mutt_str_getenv("NNTPSERVER");
863
864 if (!cli_nntp)
865 {
866 char buf[1024] = { 0 };
867 cli_nntp = mutt_file_read_keyword(SYSCONFDIR "/nntpserver", buf, sizeof(buf));
868 }
869
870 if (cli_nntp)
871 {
872 cs_str_initial_set(cs, "news_server", cli_nntp, NULL);
873 cs_str_reset(cs, "news_server", NULL);
874 }
875
876 /* Initialize crypto backends. */
877 crypt_init();
878
879 if (new_type)
880 {
881 struct Buffer *err = buf_pool_get();
882 int r = cs_str_initial_set(cs, "mbox_type", new_type, err);
883 if (CSR_RESULT(r) != CSR_SUCCESS)
884 {
885 mutt_error("%s", buf_string(err));
886 buf_pool_release(&err);
887 goto main_curses;
888 }
889 cs_str_reset(cs, "mbox_type", NULL);
890 }
891
892 if (!STAILQ_EMPTY(&queries))
893 {
894 rc = mutt_query_variables(&queries, one_liner);
895 goto main_curses;
896 }
897
898 if (dump_variables)
899 {
901 if (hide_sensitive)
902 cdflags |= CS_DUMP_HIDE_SENSITIVE;
903 if (one_liner)
904 cdflags |= CS_DUMP_SHOW_DOCS;
905 dump_config(cs, cdflags, stdout);
906 goto main_ok; // TEST18: neomutt -D
907 }
908
909 if (!STAILQ_EMPTY(&alias_queries))
910 {
911 rc = 0;
912 for (; optind < argc; optind++)
913 mutt_list_insert_tail(&alias_queries, mutt_str_dup(argv[optind]));
914 struct ListNode *np = NULL;
915 STAILQ_FOREACH(np, &alias_queries, entries)
916 {
917 struct AddressList *al = alias_lookup(np->data);
918 if (al)
919 {
920 /* output in machine-readable form */
921 mutt_addrlist_to_intl(al, NULL);
922 struct Buffer *buf = buf_pool_get();
923 mutt_addrlist_write(al, buf, false);
924 printf("%s\n", buf_string(buf));
925 buf_pool_release(&buf);
926 }
927 else
928 {
929 rc = 1;
930 printf("%s\n", np->data); // TEST19: neomutt -A unknown
931 }
932 }
933 mutt_list_free(&alias_queries);
934 goto main_curses; // TEST20: neomutt -A alias
935 }
936
937 if (!OptNoCurses)
938 {
940 clear();
944 }
945
946#ifdef USE_AUTOCRYPT
947 /* Initialize autocrypt after curses messages are working,
948 * because of the initial account setup screens. */
949 const bool c_autocrypt = cs_subset_bool(NeoMutt->sub, "autocrypt");
950 if (c_autocrypt)
951 mutt_autocrypt_init(!(sendflags & SEND_BATCH));
952#endif
953
954 /* Create the `$folder` directory if it doesn't exist. */
955 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
956 if (!OptNoCurses && c_folder)
957 {
958 struct stat st = { 0 };
959 struct Buffer *fpath = buf_pool_get();
960
961 buf_strcpy(fpath, c_folder);
962 buf_expand_path(fpath);
963 bool skip = false;
964 /* we're not connected yet - skip mail folder creation */
965 skip |= (imap_path_probe(buf_string(fpath), NULL) == MUTT_IMAP);
966 skip |= (pop_path_probe(buf_string(fpath), NULL) == MUTT_POP);
967 skip |= (nntp_path_probe(buf_string(fpath), NULL) == MUTT_NNTP);
968 if (!skip && (stat(buf_string(fpath), &st) == -1) && (errno == ENOENT))
969 {
970 char msg2[256] = { 0 };
971 snprintf(msg2, sizeof(msg2), _("%s does not exist. Create it?"), c_folder);
972 if (query_yesorno(msg2, MUTT_YES) == MUTT_YES)
973 {
974 if ((mkdir(buf_string(fpath), 0700) == -1) && (errno != EEXIST))
975 mutt_error(_("Can't create %s: %s"), c_folder, strerror(errno)); // TEST21: neomutt -n -F /dev/null (and ~/Mail doesn't exist)
976 }
977 }
978 buf_pool_release(&fpath);
979 }
980
981 if (batch_mode)
982 {
983 goto main_ok; // TEST22: neomutt -B
984 }
985 StartupComplete = true;
986
991
992 if (sendflags & SEND_POSTPONED)
993 {
994 if (!OptNoCurses)
996 if (mutt_send_message(SEND_POSTPONED, NULL, NULL, NULL, NULL, NeoMutt->sub) == 0)
997 rc = 0;
998 // TEST23: neomutt -p (postponed message, cancel)
999 // TEST24: neomutt -p (no postponed message)
1001 repeat_error = true;
1002 goto main_curses;
1003 }
1004 else if (subject || e || draft_file || include_file ||
1005 !STAILQ_EMPTY(&attach) || (optind < argc))
1006 {
1007 FILE *fp_in = NULL;
1008 FILE *fp_out = NULL;
1009 char *infile = NULL;
1010 char *bodytext = NULL;
1011 const char *bodyfile = NULL;
1012 int rv = 0;
1013
1014 if (!OptNoCurses)
1015 mutt_flushinp();
1016
1017 if (!e)
1018 e = email_new();
1019 if (!e->env)
1020 e->env = mutt_env_new();
1021
1022 for (i = optind; i < argc; i++)
1023 {
1024 if (url_check_scheme(argv[i]) == U_MAILTO)
1025 {
1026 if (!mutt_parse_mailto(e->env, &bodytext, argv[i]))
1027 {
1028 mutt_error(_("Failed to parse mailto: link"));
1029 email_free(&e);
1030 goto main_curses; // TEST25: neomutt mailto:?
1031 }
1032 }
1033 else
1034 {
1035 mutt_addrlist_parse(&e->env->to, argv[i]);
1036 }
1037 }
1038
1039 const bool c_auto_edit = cs_subset_bool(NeoMutt->sub, "auto_edit");
1040 if (!draft_file && c_auto_edit && TAILQ_EMPTY(&e->env->to) &&
1041 TAILQ_EMPTY(&e->env->cc))
1042 {
1043 mutt_error(_("No recipients specified"));
1044 email_free(&e);
1045 goto main_curses; // TEST26: neomutt -s test (with auto_edit=yes)
1046 }
1047
1048 if (subject)
1049 {
1050 /* prevent header injection */
1052 mutt_env_set_subject(e->env, subject);
1053 }
1054
1055 if (draft_file)
1056 {
1057 infile = draft_file;
1058 include_file = NULL;
1059 }
1060 else if (include_file)
1061 {
1062 infile = include_file;
1063 }
1064 else
1065 {
1066 edit_infile = false;
1067 }
1068
1069 if (infile || bodytext)
1070 {
1071 /* Prepare fp_in and expanded_infile. */
1072 if (infile)
1073 {
1074 if (mutt_str_equal("-", infile))
1075 {
1076 if (edit_infile)
1077 {
1078 mutt_error(_("Can't use -E flag with stdin"));
1079 email_free(&e);
1080 goto main_curses; // TEST27: neomutt -E -H -
1081 }
1082 fp_in = stdin;
1083 }
1084 else
1085 {
1086 buf_strcpy(expanded_infile, infile);
1087 buf_expand_path(expanded_infile);
1088 fp_in = mutt_file_fopen(buf_string(expanded_infile), "r");
1089 if (!fp_in)
1090 {
1091 mutt_perror("%s", buf_string(expanded_infile));
1092 email_free(&e);
1093 goto main_curses; // TEST28: neomutt -E -H missing
1094 }
1095 }
1096 }
1097
1098 if (edit_infile)
1099 {
1100 /* If editing the infile, keep it around afterwards so
1101 * it doesn't get unlinked, and we can rebuild the draft_file */
1102 sendflags |= SEND_NO_FREE_HEADER;
1103 }
1104 else
1105 {
1106 /* Copy input to a tempfile, and re-point fp_in to the tempfile.
1107 * Note: stdin is always copied to a tempfile, ensuring draft_file
1108 * can stat and get the correct st_size below. */
1109 buf_mktemp(tempfile);
1110
1111 fp_out = mutt_file_fopen(buf_string(tempfile), "w");
1112 if (!fp_out)
1113 {
1114 mutt_file_fclose(&fp_in);
1115 mutt_perror("%s", buf_string(tempfile));
1116 email_free(&e);
1117 goto main_curses; // TEST29: neomutt -H existing-file (where tmpdir=/path/to/FILE blocking tmpdir)
1118 }
1119 if (fp_in)
1120 {
1121 mutt_file_copy_stream(fp_in, fp_out);
1122 if (fp_in == stdin)
1123 sendflags |= SEND_CONSUMED_STDIN;
1124 else
1125 mutt_file_fclose(&fp_in);
1126 }
1127 else if (bodytext)
1128 {
1129 fputs(bodytext, fp_out);
1130 }
1131 mutt_file_fclose(&fp_out);
1132
1133 fp_in = mutt_file_fopen(buf_string(tempfile), "r");
1134 if (!fp_in)
1135 {
1136 mutt_perror("%s", buf_string(tempfile));
1137 email_free(&e);
1138 goto main_curses; // TEST30: can't test
1139 }
1140 }
1141
1142 /* Parse the draft_file into the full Email/Body structure.
1143 * Set SEND_DRAFT_FILE so mutt_send_message doesn't overwrite
1144 * our e->body. */
1145 if (draft_file)
1146 {
1147 struct Envelope *opts_env = e->env;
1148 struct stat st = { 0 };
1149
1150 sendflags |= SEND_DRAFT_FILE;
1151
1152 /* Set up a tmp Email with just enough information so that
1153 * mutt_prepare_template() can parse the message in fp_in. */
1154 struct Email *e_tmp = email_new();
1155 e_tmp->offset = 0;
1156 e_tmp->body = mutt_body_new();
1157 if (fstat(fileno(fp_in), &st) != 0)
1158 {
1159 mutt_perror("%s", draft_file);
1160 email_free(&e);
1161 email_free(&e_tmp);
1162 goto main_curses; // TEST31: can't test
1163 }
1164 e_tmp->body->length = st.st_size;
1165
1166 if (mutt_prepare_template(fp_in, NULL, e, e_tmp, false) < 0)
1167 {
1168 mutt_error(_("Can't parse message template: %s"), draft_file);
1169 email_free(&e);
1170 email_free(&e_tmp);
1171 goto main_curses;
1172 }
1173
1174 /* Scan for neomutt header to set `$resume_draft_files` */
1175 struct ListNode *np = NULL, *tmp = NULL;
1176 const bool c_resume_edited_draft_files = cs_subset_bool(NeoMutt->sub, "resume_edited_draft_files");
1177 STAILQ_FOREACH_SAFE(np, &e->env->userhdrs, entries, tmp)
1178 {
1179 if (mutt_istr_startswith(np->data, "X-Mutt-Resume-Draft:"))
1180 {
1181 if (c_resume_edited_draft_files)
1182 cs_str_native_set(cs, "resume_draft_files", true, NULL);
1183
1184 STAILQ_REMOVE(&e->env->userhdrs, np, ListNode, entries);
1185 FREE(&np->data);
1186 FREE(&np);
1187 }
1188 }
1189
1190 mutt_addrlist_copy(&e->env->to, &opts_env->to, false);
1191 mutt_addrlist_copy(&e->env->cc, &opts_env->cc, false);
1192 mutt_addrlist_copy(&e->env->bcc, &opts_env->bcc, false);
1193 if (opts_env->subject)
1194 mutt_env_set_subject(e->env, opts_env->subject);
1195
1196 mutt_env_free(&opts_env);
1197 email_free(&e_tmp);
1198 }
1199 /* Editing the include_file: pass it directly in.
1200 * Note that SEND_NO_FREE_HEADER is set above so it isn't unlinked. */
1201 else if (edit_infile)
1202 bodyfile = buf_string(expanded_infile);
1203 // For bodytext and unedited include_file: use the tempfile.
1204 else
1205 bodyfile = buf_string(tempfile);
1206
1207 mutt_file_fclose(&fp_in);
1208 }
1209
1210 FREE(&bodytext);
1211
1212 if (!STAILQ_EMPTY(&attach))
1213 {
1214 struct Body *b = e->body;
1215
1216 while (b && b->next)
1217 b = b->next;
1218
1219 struct ListNode *np = NULL;
1220 STAILQ_FOREACH(np, &attach, entries)
1221 {
1222 if (b)
1223 {
1225 b = b->next;
1226 }
1227 else
1228 {
1230 e->body = b;
1231 }
1232 if (!b)
1233 {
1234 mutt_error(_("%s: unable to attach file"), np->data);
1235 mutt_list_free(&attach);
1236 email_free(&e);
1237 goto main_curses; // TEST32: neomutt john@example.com -a missing
1238 }
1239 }
1240 mutt_list_free(&attach);
1241 }
1242
1243 rv = mutt_send_message(sendflags, e, bodyfile, NULL, NULL, NeoMutt->sub);
1244 /* We WANT the "Mail sent." and any possible, later error */
1246 if (ErrorBufMessage)
1247 mutt_message("%s", ErrorBuf);
1248
1249 if (edit_infile)
1250 {
1251 if (draft_file)
1252 {
1253 if (truncate(buf_string(expanded_infile), 0) == -1)
1254 {
1255 mutt_perror("%s", buf_string(expanded_infile));
1256 email_free(&e);
1257 goto main_curses; // TEST33: neomutt -H read-only -s test john@example.com -E
1258 }
1259 fp_out = mutt_file_fopen(buf_string(expanded_infile), "a");
1260 if (!fp_out)
1261 {
1262 mutt_perror("%s", buf_string(expanded_infile));
1263 email_free(&e);
1264 goto main_curses; // TEST34: can't test
1265 }
1266
1267 /* If the message was sent or postponed, these will already
1268 * have been done. */
1269 if (rv < 0)
1270 {
1271 if (e->body->next)
1272 e->body = mutt_make_multipart(e->body);
1274 mutt_prepare_envelope(e->env, false, NeoMutt->sub);
1275 mutt_env_to_intl(e->env, NULL, NULL);
1276 }
1277
1278 const bool c_crypt_protected_headers_read = cs_subset_bool(NeoMutt->sub, "crypt_protected_headers_read");
1280 c_crypt_protected_headers_read &&
1282 NeoMutt->sub);
1283 const bool c_resume_edited_draft_files = cs_subset_bool(NeoMutt->sub, "resume_edited_draft_files");
1284 if (c_resume_edited_draft_files)
1285 fprintf(fp_out, "X-Mutt-Resume-Draft: 1\n");
1286 fputc('\n', fp_out);
1287 if ((mutt_write_mime_body(e->body, fp_out, NeoMutt->sub) == -1))
1288 {
1289 mutt_file_fclose(&fp_out);
1290 email_free(&e);
1291 goto main_curses; // TEST35: can't test
1292 }
1293 mutt_file_fclose(&fp_out);
1294 }
1295
1296 email_free(&e);
1297 }
1298
1299 /* !edit_infile && draft_file will leave the tempfile around */
1300 if (!buf_is_empty(tempfile))
1301 unlink(buf_string(tempfile));
1302
1304
1305 if (rv != 0)
1306 goto main_curses; // TEST36: neomutt -H existing -s test john@example.com -E (cancel sending)
1307 }
1308 else if (sendflags & SEND_BATCH)
1309 {
1310 /* This guards against invoking `neomutt < /dev/null` and accidentally
1311 * sending an email due to a my_hdr or other setting. */
1312 mutt_error(_("No recipients specified"));
1313 goto main_curses;
1314 }
1315 else
1316 {
1317 if (flags & MUTT_CLI_MAILBOX)
1318 {
1319 const bool c_imap_passive = cs_subset_bool(NeoMutt->sub, "imap_passive");
1320 cs_subset_str_native_set(NeoMutt->sub, "imap_passive", false, NULL);
1322 if (mutt_mailbox_check(NULL, csflags) == 0)
1323 {
1324 mutt_message(_("No mailbox with new mail"));
1325 goto main_curses; // TEST37: neomutt -Z (no new mail)
1326 }
1327 buf_reset(folder);
1328 mutt_mailbox_next(NULL, folder);
1329 cs_subset_str_native_set(NeoMutt->sub, "imap_passive", c_imap_passive, NULL);
1330 }
1331 else if (flags & MUTT_CLI_SELECT)
1332 {
1333 if (flags & MUTT_CLI_NEWS)
1334 {
1335 const char *const c_news_server = cs_subset_string(NeoMutt->sub, "news_server");
1336 OptNews = true;
1337 struct Mailbox *m_cur = get_current_mailbox();
1338 CurrentNewsSrv = nntp_select_server(m_cur, c_news_server, false);
1339 if (!CurrentNewsSrv)
1340 goto main_curses; // TEST38: neomutt -G (unset news_server)
1341 }
1342 else if (TAILQ_EMPTY(&NeoMutt->accounts))
1343 {
1344 mutt_error(_("No incoming mailboxes defined"));
1345 goto main_curses; // TEST39: neomutt -n -F /dev/null -y
1346 }
1347 buf_reset(folder);
1348 struct Mailbox *m_cur = get_current_mailbox();
1349 dlg_browser(folder, MUTT_SEL_FOLDER | MUTT_SEL_MAILBOX, m_cur, NULL, NULL);
1350 if (buf_is_empty(folder))
1351 {
1352 goto main_ok; // TEST40: neomutt -y (quit selection)
1353 }
1354 }
1355
1356 if (buf_is_empty(folder))
1357 {
1358 const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
1359 if (c_spool_file)
1360 {
1361 // Check if `$spool_file` corresponds a mailboxes' description.
1362 struct Mailbox *m_desc = mailbox_find_name(c_spool_file);
1363 if (m_desc)
1364 buf_strcpy(folder, m_desc->realpath);
1365 else
1366 buf_strcpy(folder, c_spool_file);
1367 }
1368 else if (c_folder)
1369 {
1370 buf_strcpy(folder, c_folder);
1371 }
1372 /* else no folder */
1373 }
1374
1375 if (OptNews)
1376 {
1377 OptNews = false;
1378 buf_alloc(folder, PATH_MAX);
1379 nntp_expand_path(folder->data, folder->dsize, &CurrentNewsSrv->conn->account);
1380 }
1381 else
1382 {
1383 buf_expand_path(folder);
1384 }
1385
1388
1389 if (flags & MUTT_CLI_IGNORE)
1390 {
1391 /* check to see if there are any messages in the folder */
1392 switch (mx_path_is_empty(folder))
1393 {
1394 case -1:
1395 mutt_perror("%s", buf_string(folder));
1396 goto main_curses; // TEST41: neomutt -z -f missing
1397 case 1:
1398 mutt_error(_("Mailbox is empty"));
1399 goto main_curses; // TEST42: neomutt -z -f /dev/null
1400 }
1401 }
1402
1403 struct Mailbox *m_cur = mailbox_find(buf_string(folder));
1404 mutt_folder_hook(buf_string(folder), m_cur ? m_cur->name : NULL);
1406 mutt_debug(LL_NOTIFY, "NT_GLOBAL_STARTUP\n");
1408
1410 window_redraw(NULL);
1411
1412 repeat_error = true;
1413 struct Mailbox *m = mx_resolve(buf_string(folder));
1414 const bool c_read_only = cs_subset_bool(NeoMutt->sub, "read_only");
1415 if (!mx_mbox_open(m, ((flags & MUTT_CLI_RO) || c_read_only) ? MUTT_READONLY : MUTT_OPEN_NO_FLAGS))
1416 {
1417 if (m->account)
1419
1420 mailbox_free(&m);
1421 mutt_error(_("Unable to open mailbox %s"), buf_string(folder));
1422 repeat_error = false;
1423 }
1424 if (m || !explicit_folder)
1425 {
1426 struct MuttWindow *dlg = index_pager_init();
1427 dialog_push(dlg);
1428
1430 m = dlg_index(dlg, m);
1432 mailbox_free(&m);
1433
1434 dialog_pop();
1435 mutt_window_free(&dlg);
1437 repeat_error = false;
1438 }
1440#ifdef USE_SASL_CYRUS
1442#endif
1443#ifdef USE_SASL_GNU
1445#endif
1446#ifdef USE_AUTOCRYPT
1448#endif
1449 // TEST43: neomutt (no change to mailbox)
1450 // TEST44: neomutt (change mailbox)
1451 }
1452
1453main_ok:
1454 rc = 0;
1455main_curses:
1456 mutt_endwin();
1458 /* Repeat the last message to the user */
1459 if (repeat_error && ErrorBufMessage)
1460 puts(ErrorBuf);
1461main_exit:
1462 if (NeoMutt && NeoMutt->sub)
1463 {
1468 }
1469 mutt_list_free(&commands);
1471 buf_pool_release(&folder);
1472 buf_pool_release(&expanded_infile);
1473 buf_pool_release(&tempfile);
1474 mutt_list_free(&queries);
1481 menu_cleanup();
1482 crypt_cleanup();
1492 cs_free(&cs);
1494 mutt_log_stop();
1495 return rc;
1496}
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
Definition: address.c:765
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition: address.c:1210
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:480
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1297
Email Address Handling.
Email Aliases.
struct AddressList * alias_lookup(const char *name)
Find an Alias.
Definition: alias.c:277
void alternates_cleanup(void)
Free the alternates lists.
Definition: alternates.c:49
void alternates_init(void)
Set up the alternates lists.
Definition: alternates.c:60
Alternate address handling.
GUI display the mailboxes in a side panel.
void attach_init(void)
Set up the attachments lists.
Definition: attachments.c:106
void attach_cleanup(void)
Free the attachments lists.
Definition: attachments.c:92
Autocrypt end-to-end encryption.
void mutt_autocrypt_cleanup(void)
Shutdown Autocrypt.
Definition: autocrypt.c:131
int mutt_autocrypt_init(bool can_create)
Initialise Autocrypt.
Definition: autocrypt.c:99
void show_backtrace(void)
Log the program's call stack.
Definition: backtrace.c:39
Select a Mailbox from a list.
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: lib.h:58
#define MUTT_SEL_FOLDER
Select a local directory.
Definition: lib.h:60
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:75
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:290
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:394
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition: buffer.c:336
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
Color and attribute parsing.
void mutt_colors_init(void)
Initialize colours.
Definition: color.c:74
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:59
bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
Definition: dump.c:167
#define CS_DUMP_HIDE_SENSITIVE
Obscure sensitive information like passwords.
Definition: dump.h:37
uint16_t ConfigDumpFlags
Flags for dump_config(), e.g. CS_DUMP_ONLY_CHANGED.
Definition: dump.h:34
#define CS_DUMP_NO_FLAGS
No flags are set.
Definition: dump.h:35
#define CS_DUMP_SHOW_DOCS
Show one-liner documentation for the config item.
Definition: dump.h:45
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:144
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
Convenience wrapper for the config headers.
char * HomeDir
User's home directory.
Definition: globals.c:38
struct HashElem * cs_get_elem(const struct ConfigSet *cs, const char *name)
Get the HashElem representing a config item.
Definition: set.c:175
int cs_str_initial_set(const struct ConfigSet *cs, const char *name, const char *value, struct Buffer *err)
Set the initial value of a config item.
Definition: set.c:503
void cs_free(struct ConfigSet **ptr)
Free a Config Set.
Definition: set.c:141
int cs_str_reset(const struct ConfigSet *cs, const char *name, struct Buffer *err)
Reset a config item to its initial value.
Definition: set.c:438
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
Definition: set.c:127
int cs_he_reset(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
Definition: set.c:391
int cs_str_native_set(const struct ConfigSet *cs, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: set.c:760
int cs_he_initial_set(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Set the initial value of a config item.
Definition: set.c:461
int cs_he_initial_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *result)
Get the initial, or parent, value of a config item.
Definition: set.c:529
#define CSR_RESULT(x)
Definition: set.h:52
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
void config_cache_cleanup(void)
Cleanup the cache of charset config variables.
Definition: config_cache.c:145
Connection Library.
bool account_mailbox_remove(struct Account *a, struct Mailbox *m)
Remove a Mailbox from an Account.
Definition: account.c:98
Convenience wrapper for the core headers.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:90
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
Definition: mailbox.c:188
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
Definition: mailbox.c:151
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
bool mutt_should_hide_protected_subject(struct Email *e)
Should NeoMutt hide the protected subject?
Definition: crypt.c:1086
void crypto_module_cleanup(void)
Clean up the crypto modules.
Definition: crypt_mod.c:84
void crypt_cleanup(void)
Clean up backend.
Definition: cryptglue.c:141
void crypt_init(void)
Initialise the crypto backends.
Definition: cryptglue.c:93
void mutt_endwin(void)
Shutdown curses.
Definition: curs_lib.c:151
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: get.c:57
Convenience wrapper for the debug headers.
int debug_all_observer(struct NotifyCallback *nc)
Definition: notify.c:205
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:109
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:142
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:89
void mutt_browser_cleanup(void)
Clean up working Buffers.
Definition: dlg_browser.c:163
struct MuttWindow * index_pager_init(void)
Allocate the Windows for the Index/Pager.
Definition: dlg_index.c:1405
struct Body * mutt_body_new(void)
Create a new Body.
Definition: body.c:44
struct Email * email_new(void)
Create a new Email.
Definition: email.c:80
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:46
Structs that make up an email.
bool mutt_parse_mailto(struct Envelope *env, char **body, const char *src)
Parse a mailto:// url.
Definition: parse.c:1749
void mutt_filter_commandline_header_value(char *header)
Sanitise characters in a header value.
Definition: parse.c:93
int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err)
Convert an Envelope's Address fields to Punycode format.
Definition: envelope.c:355
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
Definition: envelope.c:126
struct Envelope * mutt_env_new(void)
Create a new Envelope.
Definition: envelope.c:46
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
Definition: envelope.c:69
void envlist_free(char ***envp)
Free the private copy of the environment.
Definition: envlist.c:42
char ** envlist_init(char **envp)
Create a copy of the environment.
Definition: envlist.c:58
void external_cleanup(void)
Clean up commands globals.
Definition: external.c:81
Manage where the email is piped to external commands.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
Definition: file.c:286
char * mutt_file_read_keyword(const char *file, char *buf, size_t buflen)
Read a keyword from a file.
Definition: file.c:1403
#define mutt_file_fclose(FP)
Definition: file.h:147
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:146
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:70
char * LastFolder
Previously selected mailbox.
Definition: globals.c:44
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: globals.c:72
char ErrorBuf[1024]
Copy of the last error message.
Definition: globals.c:36
bool ErrorBufMessage
true if the last message was an error
Definition: globals.c:35
char * CurrentFolder
Currently selected mailbox.
Definition: globals.c:43
struct ListHead Muttrc
List of config files to read.
Definition: globals.c:52
char * Username
User's login name.
Definition: globals.c:41
char ** EnvList
Private copy of the environment variables.
Definition: globals.c:78
Global variables.
void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file -.
Definition: dlg_browser.c:1296
struct Mailbox * dlg_index(struct MuttWindow *dlg, struct Mailbox *m_init)
Display a list of emails -.
Definition: dlg_index.c:1071
int log_disp_queue(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Save a log line to an internal queue - Implements log_dispatcher_t -.
Definition: logging.c:398
int log_disp_terminal(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Save a log line to the terminal - Implements log_dispatcher_t -.
Definition: logging.c:441
int log_disp_curses(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Display a log line in the message line - Implements log_dispatcher_t -.
Definition: mutt_logging.c:88
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_message(...)
Definition: logging2.h:91
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
#define mutt_perror(...)
Definition: logging2.h:93
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
Definition: nntp.c:2738
enum MailboxType pop_path_probe(const char *path, const struct stat *st)
Is this a POP Mailbox? - Implements MxOps::path_probe() -.
Definition: pop.c:1157
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
Definition: imap.c:2344
int main_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: init.c:265
int main_hist_observer(struct NotifyCallback *nc)
Notification that a Config Variable has change - Implements observer_t -.
Definition: history.c:702
int main_timeout_observer(struct NotifyCallback *nc)
Notification that a timeout has occurred - Implements observer_t -.
Definition: main.c:510
int main_log_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: mutt_logging.c:285
void mutt_gsasl_cleanup(void)
Shutdown GNU SASL library.
Definition: gsasl.c:148
Convenience wrapper for the gui headers.
int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, struct Body *b, enum MuttWriteHeaderMode mode, bool privacy, bool hide_protected_subject, struct ConfigSubset *sub)
Write out one RFC822 header line.
Definition: header.c:577
@ MUTT_WRITE_HEADER_POSTPONE
A postponed Email, just the envelope info.
Definition: header.h:42
Read/write command history from/to a file.
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:924
void mutt_startup_shutdown_hook(HookFlags type)
Execute any startup/shutdown hooks.
Definition: hook.c:956
void mutt_folder_hook(const char *path, const char *desc)
Perform a folder hook.
Definition: hook.c:623
Parse and execute user-defined hooks.
#define MUTT_STARTUP_HOOK
startup-hook: run when starting NeoMutt
Definition: hook.h:54
IMAP network mailbox.
void imap_logout_all(void)
Close all open connections.
Definition: imap.c:555
GUI manage the main index (list of emails)
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:715
int mutt_query_variables(struct ListHead *queries, bool show_docs)
Implement the -Q command line flag.
Definition: init.c:621
int mutt_init(struct ConfigSet *cs, const char *dlevel, const char *dfile, bool skip_sys_rc, struct ListHead *commands)
Initialise NeoMutt.
Definition: init.c:318
void mutt_opts_cleanup(void)
Clean up before quitting.
Definition: init.c:262
Config/command parsing.
void init_config(struct ConfigSet *cs)
Initialise the config system.
Definition: mutt_config.c:1055
void km_init(void)
Initialise all the menu keybindings.
Definition: init.c:180
void mutt_keys_cleanup(void)
Free the key maps.
Definition: init.c:230
void init_extended_keys(void)
Initialise map of ncurses extended keys.
Definition: init.c:137
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: init.c:243
Manage keymappings.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
int(*) log_dispatcher_ MuttLogger)
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
@ LL_MESSAGE
Log informational message.
Definition: logging2.h:42
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
@ LL_MAX
Definition: logging2.h:50
#define MUTT_CLI_SELECT
-y Start with a list of all mailboxes
Definition: main.c:200
static void init_locale(void)
Initialise the Locale/NLS settings.
Definition: main.c:392
static void localise_config(struct ConfigSet *cs)
Localise some config.
Definition: main.c:232
uint8_t CliFlags
Flags for command line options, e.g. MUTT_CLI_IGNORE.
Definition: main.c:194
static void log_translation(void)
Log the translation being used.
Definition: main.c:461
#define MUTT_CLI_MAILBOX
-Z Open first mailbox if is has new mail
Definition: main.c:197
static void log_gui(void)
Log info about the GUI.
Definition: main.c:487
void mutt_exit(int code)
Leave NeoMutt NOW.
Definition: main.c:268
static void reset_tilde(struct ConfigSet *cs)
Temporary measure.
Definition: main.c:208
static bool usage(void)
Display NeoMutt command line.
Definition: main.c:282
static int start_curses(void)
Start the Curses UI.
Definition: main.c:360
bool StartupComplete
When the config has been read.
Definition: main.c:191
static bool get_user_info(struct ConfigSet *cs)
Find the user's name, home and shell.
Definition: main.c:420
#define MUTT_CLI_RO
-R Open mailbox in read-only mode
Definition: main.c:199
#define MUTT_CLI_NO_FLAGS
No flags are set.
Definition: main.c:195
int main(int argc, char *argv[], char *envp[])
Start NeoMutt.
Definition: main.c:553
#define MUTT_CLI_IGNORE
-z Open first mailbox if it has mail
Definition: main.c:196
#define MUTT_CLI_NEWS
-g/-G Start with a list of all newsgroups
Definition: main.c:201
#define MUTT_CLI_NOSYSRC
-n Do not read the system-wide config file
Definition: main.c:198
bool OptLocales
(pseudo) set if user has valid locale definition
Definition: mbyte.c:44
#define FREE(x)
Definition: memory.h:45
#define mutt_array_size(x)
Definition: memory.h:38
GUI present the user with a selectable list.
void menu_cleanup(void)
Free the saved Menu searches.
Definition: menu.c:70
struct Body * mutt_make_multipart(struct Body *b)
Create a multipart email.
Definition: multipart.c:100
void mutt_ch_cache_cleanup(void)
Clean up the cached iconv handles and charset strings.
Definition: charset.c:1177
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:455
Convenience wrapper for the library headers.
#define FALLTHROUGH
Definition: lib.h:111
void log_queue_empty(void)
Free the contents of the queue.
Definition: logging.c:324
void log_queue_set_max_size(int size)
Set a upper limit for the queue length.
Definition: logging.c:312
void log_queue_flush(log_dispatcher_t disp)
Replay the log queue.
Definition: logging.c:346
#define _(a)
Definition: message.h:28
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition: notify.c:230
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:191
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:709
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:775
const char * mutt_istr_find(const char *haystack, const char *needle)
Find first occurrence of string (ignoring case)
Definition: string.c:570
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition: string.c:242
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:329
#define PATH_MAX
Definition: mutt.h:42
void mutt_temp_attachments_cleanup(void)
Delete all temporary attachments.
Definition: mutt_attach.c:1307
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:94
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
Definition: mutt_curses.c:79
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:75
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
Definition: mutt_curses.h:65
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
Definition: mutt_curses.h:66
void mutt_log_stop(void)
Close the log file.
Definition: mutt_logging.c:181
void mutt_log_prep(void)
Prepare to log.
Definition: mutt_logging.c:171
NeoMutt Logging.
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:168
struct Mailbox * mutt_mailbox_next(struct Mailbox *m_cur, struct Buffer *s)
Incoming folders completion routine.
Definition: mutt_mailbox.c:359
Mailbox helper functions.
void mutt_signal_init(void)
Initialise the signal handling.
Definition: mutt_signal.c:130
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:202
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:668
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition: mutt_window.h:86
void buf_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:135
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:893
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:328
Some miscellaneous functions.
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:286
struct Mailbox * mx_resolve(const char *path_or_name)
Get a Mailbox from either a path or name.
Definition: mx.c:1703
int mx_path_is_empty(struct Buffer *path)
Is the mailbox empty.
Definition: mx.c:1250
API for mailboxes.
#define MUTT_READONLY
Open in read-only mode.
Definition: mxapi.h:43
#define MUTT_MAILBOX_CHECK_IMMEDIATE
Don't postpone the actual checking.
Definition: mxapi.h:56
#define MUTT_OPEN_NO_FLAGS
No flags are set.
Definition: mxapi.h:40
#define MUTT_MAILBOX_CHECK_FORCE
Ignore MailboxTime and check for new mail.
Definition: mxapi.h:54
uint8_t CheckStatsFlags
Flags for mutt_mailbox_check.
Definition: mxapi.h:52
API for encryption/signing of emails.
struct NeoMutt * neomutt_new(struct ConfigSet *cs)
Create the main NeoMutt object.
Definition: neomutt.c:45
void neomutt_free(struct NeoMutt **ptr)
Free a NeoMutt.
Definition: neomutt.c:81
@ NT_GLOBAL_STARTUP
NeoMutt is initialised.
Definition: neomutt.h:59
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:567
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1070
@ NT_TIMEOUT
Timeout has occurred.
Definition: notify_type.h:56
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
@ NT_ALL
Register for all notifications.
Definition: notify_type.h:35
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition: notify_type.h:46
@ NT_RESIZE
Window has been resized.
Definition: notify_type.h:52
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
void buf_pool_cleanup(void)
Release the Buffer pool.
Definition: pool.c:67
POP network mailbox.
Postponed Emails.
int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
Prepare a message template.
Definition: postpone.c:483
void mutt_prex_cleanup(void)
Cleanup heap memory allocated by compiled regexes.
Definition: prex.c:336
Prototypes for many functions.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:39
Ask the user a question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
Definition: question.c:327
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:402
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define STAILQ_EMPTY(head)
Definition: queue.h:348
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:362
#define TAILQ_EMPTY(head)
Definition: queue.h:721
void rootwin_cleanup(void)
Free all the default Windows.
Definition: rootwin.c:202
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:106
void rootwin_new(void)
Create the default Windows.
Definition: rootwin.c:214
void mutt_sasl_cleanup(void)
Invoke when processing is complete.
Definition: sasl.c:786
int mutt_write_mime_body(struct Body *b, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
Definition: body.c:300
Convenience wrapper for the send headers.
void mutt_encode_descriptions(struct Body *b, bool recurse, struct ConfigSubset *sub)
RFC2047 encode the content-descriptions.
Definition: send.c:1575
int mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailArray *ea, struct ConfigSubset *sub)
Send an email.
Definition: send.c:2120
#define SEND_BATCH
Send email in batch mode (without user interaction)
Definition: send.h:47
#define SEND_NO_FREE_HEADER
Used by the -E flag.
Definition: send.h:51
#define SEND_DRAFT_FILE
Used by the -H flag.
Definition: send.h:52
uint32_t SendFlags
Flags for mutt_send_message(), e.g. SEND_REPLY.
Definition: send.h:40
#define SEND_POSTPONED
Recall a postponed email.
Definition: send.h:46
#define SEND_CONSUMED_STDIN
stdin has been read; don't read it twice
Definition: send.h:57
#define SEND_CLI_CRYPTO
Enable message security in modes that by default don't enable it.
Definition: send.h:58
#define SEND_NO_FLAGS
No flags are set.
Definition: send.h:41
struct Body * mutt_make_file_attach(const char *path, struct ConfigSubset *sub)
Create a file attachment.
Definition: sendlib.c:606
void mutt_prepare_envelope(struct Envelope *env, bool final, struct ConfigSubset *sub)
Prepare an email header.
Definition: sendlib.c:779
#define NONULL(x)
Definition: string2.h:37
#define SKIPWS(ch)
Definition: string2.h:45
The body of an email.
Definition: body.h:36
LOFF_T length
length (in bytes) of attachment
Definition: body.h:53
struct Body * next
next attachment in the list
Definition: body.h:71
String manipulation buffer.
Definition: buffer.h:36
size_t dsize
Length of data.
Definition: buffer.h:39
char * data
Pointer to data.
Definition: buffer.h:37
Container for lots of config items.
Definition: set.h:252
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:49
The envelope/body of an email.
Definition: email.h:39
struct Envelope * env
Envelope information.
Definition: email.h:68
struct Body * body
List of MIME parts.
Definition: email.h:69
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:71
The header of an Email.
Definition: envelope.h:57
struct ListHead userhdrs
user defined headers
Definition: envelope.h:85
char *const subject
Email's subject.
Definition: envelope.h:70
struct AddressList to
Email's 'To' list.
Definition: envelope.h:60
struct AddressList cc
Email's 'Cc' list.
Definition: envelope.h:61
struct AddressList bcc
Email's 'Bcc' list.
Definition: envelope.h:62
The item stored in a Hash Table.
Definition: hash.h:43
A List node for strings.
Definition: list.h:35
char * data
String.
Definition: list.h:36
A mailbox.
Definition: mailbox.h:79
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:127
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct Notify * notify_resize
Window resize notifications handler.
Definition: neomutt.h:43
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:46
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:62
Data passed to a notification function.
Definition: observer.h:34
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
void subjrx_init(void)
Create new Subject Regex List.
Definition: subjectrx.c:55
void subjrx_cleanup(void)
Free the Subject Regex List.
Definition: subjectrx.c:46
Subject Regex handling.
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:297
bool TsSupported
Terminal Setting is supported.
Definition: terminal.c:42
bool mutt_ts_capability(void)
Check terminal capabilities.
Definition: terminal.c:72
#define buf_mktemp(buf)
Definition: tmp.h:33
enum UrlScheme url_check_scheme(const char *str)
Check the protocol of a URL.
Definition: url.c:226
@ U_MAILTO
Url is mailto://.
Definition: url.h:45
bool print_copyright(void)
Print copyright message.
Definition: version.c:518
bool print_version(FILE *fp)
Print system and compile info to a file.
Definition: version.c:393
Display version and copyright about NeoMutt.