NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <errno.h>
33#include <limits.h>
34#include <stdbool.h>
35#include <stdio.h>
36#include <string.h>
37#include <unistd.h>
38#include "mutt/lib.h"
39#include "address/lib.h"
40#include "config/lib.h"
41#include "email/lib.h"
42#include "core/lib.h"
43#include "alias/lib.h"
44#include "gui/lib.h"
45#include "mutt.h"
46#include "commands.h"
47#include "attach/lib.h"
48#include "color/lib.h"
49#include "imap/lib.h"
50#include "key/lib.h"
51#include "menu/lib.h"
52#include "pager/lib.h"
53#include "parse/lib.h"
54#include "store/lib.h"
55#include "alternates.h"
56#include "globals.h"
57#include "muttlib.h"
58#include "mx.h"
59#include "score.h"
60#include "version.h"
61#ifdef USE_INOTIFY
62#include "monitor.h"
63#endif
64#ifdef ENABLE_NLS
65#include <libintl.h>
66#endif
67
71
72#define MAX_ERRS 128
73
78{
79 TB_UNSET = -1,
82};
83
88{
92};
93
100static bool is_function(const char *name)
101{
102 for (size_t i = 0; MenuNames[i].name; i++)
103 {
104 const struct MenuFuncOp *fns = km_get_table(MenuNames[i].value);
105 if (!fns)
106 continue;
107
108 for (int j = 0; fns[j].name; j++)
109 if (mutt_str_equal(name, fns[j].name))
110 return true;
111 }
112 return false;
113}
114
124int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s,
125 struct Buffer *err)
126{
127 while (mutt_istr_equal(buf->data, "-group"))
128 {
129 if (!MoreArgs(s))
130 {
131 buf_strcpy(err, _("-group: no group name"));
132 return -1;
133 }
134
136
138
139 if (!MoreArgs(s))
140 {
141 buf_strcpy(err, _("out of arguments"));
142 return -1;
143 }
144
146 }
147
148 return 0;
149}
150
158enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer *err)
159{
161
162 enum CommandResult ret = parse_rc_line(line, err);
163
164 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
166 FREE(&np->data);
167 FREE(&np);
168
169 return ret;
170}
171
179{
180 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
181 if (np && np->data)
182 return mutt_str_dup(np->data);
183
184 // stack is empty, return our own dummy file relative to cwd
185 struct Buffer *cwd = buf_pool_get();
186 mutt_path_getcwd(cwd);
187 buf_addstr(cwd, "/dummy.rc");
188 char *ret = buf_strdup(cwd);
189 buf_pool_release(&cwd);
190 return ret;
191}
192
199int source_rc(const char *rcfile_path, struct Buffer *err)
200{
201 int lineno = 0, rc = 0, warnings = 0;
202 enum CommandResult line_rc;
203 struct Buffer *token = NULL, *linebuf = NULL;
204 char *line = NULL;
205 char *currentline = NULL;
206 char rcfile[PATH_MAX] = { 0 };
207 size_t linelen = 0;
208 pid_t pid;
209
210 mutt_str_copy(rcfile, rcfile_path, sizeof(rcfile));
211
212 size_t rcfilelen = mutt_str_len(rcfile);
213 if (rcfilelen == 0)
214 return -1;
215
216 bool ispipe = rcfile[rcfilelen - 1] == '|';
217
218 if (!ispipe)
219 {
220 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
221 if (!mutt_path_to_absolute(rcfile, np ? NONULL(np->data) : ""))
222 {
223 mutt_error(_("Error: Can't build path of '%s'"), rcfile_path);
224 return -1;
225 }
226
227 STAILQ_FOREACH(np, &MuttrcStack, entries)
228 {
229 if (mutt_str_equal(np->data, rcfile))
230 {
231 break;
232 }
233 }
234 if (np)
235 {
236 mutt_error(_("Error: Cyclic sourcing of configuration file '%s'"), rcfile);
237 return -1;
238 }
239
241 }
242
243 mutt_debug(LL_DEBUG2, "Reading configuration file '%s'\n", rcfile);
244
245 FILE *fp = mutt_open_read(rcfile, &pid);
246 if (!fp)
247 {
248 buf_printf(err, "%s: %s", rcfile, strerror(errno));
249 return -1;
250 }
251
252 token = buf_pool_get();
253 linebuf = buf_pool_get();
254
255 const char *const c_config_charset = cs_subset_string(NeoMutt->sub, "config_charset");
256 const char *const c_charset = cc_charset();
257 while ((line = mutt_file_read_line(line, &linelen, fp, &lineno, MUTT_RL_CONT)) != NULL)
258 {
259 const bool conv = c_config_charset && c_charset;
260 if (conv)
261 {
262 currentline = mutt_str_dup(line);
263 if (!currentline)
264 continue;
265 mutt_ch_convert_string(&currentline, c_config_charset, c_charset, MUTT_ICONV_NO_FLAGS);
266 }
267 else
268 {
269 currentline = line;
270 }
271
272 buf_strcpy(linebuf, currentline);
273
274 buf_reset(err);
275 line_rc = parse_rc_buffer(linebuf, token, err);
276 if (line_rc == MUTT_CMD_ERROR)
277 {
278 mutt_error("%s:%d: %s", rcfile, lineno, buf_string(err));
279 if (--rc < -MAX_ERRS)
280 {
281 if (conv)
282 FREE(&currentline);
283 break;
284 }
285 }
286 else if (line_rc == MUTT_CMD_WARNING)
287 {
288 /* Warning */
289 mutt_warning("%s:%d: %s", rcfile, lineno, buf_string(err));
290 warnings++;
291 }
292 else if (line_rc == MUTT_CMD_FINISH)
293 {
294 if (conv)
295 FREE(&currentline);
296 break; /* Found "finish" command */
297 }
298 else
299 {
300 if (rc < 0)
301 rc = -1;
302 }
303 if (conv)
304 FREE(&currentline);
305 }
306
307 FREE(&line);
308 mutt_file_fclose(&fp);
309 if (pid != -1)
310 filter_wait(pid);
311
312 if (rc)
313 {
314 /* the neomuttrc source keyword */
315 buf_reset(err);
316 buf_printf(err, (rc >= -MAX_ERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
317 rcfile);
318 rc = -1;
319 }
320 else
321 {
322 /* Don't alias errors with warnings */
323 if (warnings > 0)
324 {
325 buf_printf(err, ngettext("source: %d warning in %s", "source: %d warnings in %s", warnings),
326 warnings, rcfile);
327 rc = -2;
328 }
329 }
330
331 if (!ispipe && !STAILQ_EMPTY(&MuttrcStack))
332 {
333 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
335 FREE(&np->data);
336 FREE(&np);
337 }
338
339 buf_pool_release(&token);
340 buf_pool_release(&linebuf);
341 return rc;
342}
343
347static enum CommandResult parse_cd(struct Buffer *buf, struct Buffer *s,
348 intptr_t data, struct Buffer *err)
349{
351 buf_expand_path(buf);
352 if (buf_len(buf) == 0)
353 {
354 if (HomeDir)
355 {
356 buf_strcpy(buf, HomeDir);
357 }
358 else
359 {
360 buf_printf(err, _("%s: too few arguments"), "cd");
361 return MUTT_CMD_ERROR;
362 }
363 }
364
365 if (chdir(buf_string(buf)) != 0)
366 {
367 buf_printf(err, "cd: %s", strerror(errno));
368 return MUTT_CMD_ERROR;
369 }
370
371 return MUTT_CMD_SUCCESS;
372}
373
377static enum CommandResult parse_echo(struct Buffer *buf, struct Buffer *s,
378 intptr_t data, struct Buffer *err)
379{
380 if (!MoreArgs(s))
381 {
382 buf_printf(err, _("%s: too few arguments"), "echo");
383 return MUTT_CMD_WARNING;
384 }
386 OptForceRefresh = true;
387 mutt_message("%s", buf->data);
388 OptForceRefresh = false;
389 mutt_sleep(0);
390
391 return MUTT_CMD_SUCCESS;
392}
393
401static enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s,
402 intptr_t data, struct Buffer *err)
403{
404 if (MoreArgs(s))
405 {
406 buf_printf(err, _("%s: too many arguments"), "finish");
407 return MUTT_CMD_WARNING;
408 }
409
410 return MUTT_CMD_FINISH;
411}
412
416static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
417 intptr_t data, struct Buffer *err)
418{
419 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
420 enum GroupState gstate = GS_NONE;
421
422 do
423 {
425 if (parse_grouplist(&gl, buf, s, err) == -1)
426 goto bail;
427
428 if ((data == MUTT_UNGROUP) && mutt_istr_equal(buf->data, "*"))
429 {
431 goto out;
432 }
433
434 if (mutt_istr_equal(buf->data, "-rx"))
435 {
436 gstate = GS_RX;
437 }
438 else if (mutt_istr_equal(buf->data, "-addr"))
439 {
440 gstate = GS_ADDR;
441 }
442 else
443 {
444 switch (gstate)
445 {
446 case GS_NONE:
447 buf_printf(err, _("%sgroup: missing -rx or -addr"),
448 (data == MUTT_UNGROUP) ? "un" : "");
449 goto warn;
450
451 case GS_RX:
452 if ((data == MUTT_GROUP) &&
453 (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
454 {
455 goto bail;
456 }
457 else if ((data == MUTT_UNGROUP) &&
458 (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
459 {
460 goto bail;
461 }
462 break;
463
464 case GS_ADDR:
465 {
466 char *estr = NULL;
467 struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
468 mutt_addrlist_parse2(&al, buf->data);
469 if (TAILQ_EMPTY(&al))
470 goto bail;
471 if (mutt_addrlist_to_intl(&al, &estr))
472 {
473 buf_printf(err, _("%sgroup: warning: bad IDN '%s'"),
474 (data == 1) ? "un" : "", estr);
476 FREE(&estr);
477 goto bail;
478 }
479 if (data == MUTT_GROUP)
481 else if (data == MUTT_UNGROUP)
484 break;
485 }
486 }
487 }
488 } while (MoreArgs(s));
489
490out:
492 return MUTT_CMD_SUCCESS;
493
494bail:
496 return MUTT_CMD_ERROR;
497
498warn:
500 return MUTT_CMD_WARNING;
501}
502
516static enum CommandResult parse_ifdef(struct Buffer *buf, struct Buffer *s,
517 intptr_t data, struct Buffer *err)
518{
520
521 if (buf_is_empty(buf))
522 {
523 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
524 return MUTT_CMD_WARNING;
525 }
526
527 // is the item defined as:
528 bool res = cs_subset_lookup(NeoMutt->sub, buf->data) // a variable?
529 || feature_enabled(buf->data) // a compiled-in feature?
530 || is_function(buf->data) // a function?
531 || command_get(buf->data) // a command?
532#ifdef USE_HCACHE
533 || store_is_valid_backend(buf->data) // a store? (database)
534#endif
535 || mutt_str_getenv(buf->data); // an environment variable?
536
537 if (!MoreArgs(s))
538 {
539 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
540 return MUTT_CMD_WARNING;
541 }
543
544 /* ifdef KNOWN_SYMBOL or ifndef UNKNOWN_SYMBOL */
545 if ((res && (data == 0)) || (!res && (data == 1)))
546 {
547 enum CommandResult rc = parse_rc_line(buf->data, err);
548 if (rc == MUTT_CMD_ERROR)
549 {
550 mutt_error(_("Error: %s"), buf_string(err));
551 return MUTT_CMD_ERROR;
552 }
553 return rc;
554 }
555 return MUTT_CMD_SUCCESS;
556}
557
561static enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s,
562 intptr_t data, struct Buffer *err)
563{
564 do
565 {
568 add_to_stailq(&Ignore, buf->data);
569 } while (MoreArgs(s));
570
571 return MUTT_CMD_SUCCESS;
572}
573
577static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
578 intptr_t data, struct Buffer *err)
579{
580 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
581
582 do
583 {
585
586 if (parse_grouplist(&gl, buf, s, err) == -1)
587 goto bail;
588
590
591 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
592 goto bail;
593
594 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
595 goto bail;
596 } while (MoreArgs(s));
597
599 return MUTT_CMD_SUCCESS;
600
601bail:
603 return MUTT_CMD_ERROR;
604}
605
609static enum CommandResult mailbox_add(const char *folder, const char *mailbox,
610 const char *label, enum TriBool poll,
611 enum TriBool notify, struct Buffer *err)
612{
613 mutt_debug(LL_DEBUG1, "Adding mailbox: '%s' label '%s', poll %s, notify %s\n",
614 mailbox, label ? label : "[NONE]",
615 (poll == TB_UNSET) ? "[UNSPECIFIED]" :
616 (poll == TB_TRUE) ? "true" :
617 "false",
618 (notify == TB_UNSET) ? "[UNSPECIFIED]" :
619 (notify == TB_TRUE) ? "true" :
620 "false");
621 struct Mailbox *m = mailbox_new();
622
623 buf_strcpy(&m->pathbuf, mailbox);
624 /* int rc = */ mx_path_canon2(m, folder);
625
626 if (m->type <= MUTT_UNKNOWN)
627 {
628 buf_printf(err, "Unknown Mailbox: %s", m->realpath);
629 mailbox_free(&m);
630 return MUTT_CMD_ERROR;
631 }
632
633 bool new_account = false;
634 struct Account *a = mx_ac_find(m);
635 if (!a)
636 {
637 a = account_new(NULL, NeoMutt->sub);
638 a->type = m->type;
639 new_account = true;
640 }
641
642 if (!new_account)
643 {
644 struct Mailbox *m_old = mx_mbox_find(a, m->realpath);
645 if (m_old)
646 {
647 if (!m_old->visible)
648 {
649 m_old->visible = true;
650 m_old->gen = mailbox_gen();
651 }
652
653 if (label)
654 mutt_str_replace(&m_old->name, label);
655
656 if (notify != TB_UNSET)
657 m_old->notify_user = notify;
658
659 if (poll != TB_UNSET)
660 m_old->poll_new_mail = poll;
661
662 struct EventMailbox ev_m = { m_old };
664
665 mailbox_free(&m);
666 return MUTT_CMD_SUCCESS;
667 }
668 }
669
670 if (label)
671 m->name = mutt_str_dup(label);
672
673 if (notify != TB_UNSET)
674 m->notify_user = notify;
675
676 if (poll != TB_UNSET)
677 m->poll_new_mail = poll;
678
679 if (!mx_ac_add(a, m))
680 {
681 mailbox_free(&m);
682 if (new_account)
683 {
684 cs_subset_free(&a->sub);
685 FREE(&a->name);
686 notify_free(&a->notify);
687 FREE(&a);
688 }
689 return MUTT_CMD_SUCCESS;
690 }
691
692 if (new_account)
693 {
695 }
696
697 // this is finally a visible mailbox in the sidebar and mailboxes list
698 m->visible = true;
699
700#ifdef USE_INOTIFY
702#endif
703
704 return MUTT_CMD_SUCCESS;
705}
706
712enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s,
713 intptr_t data, struct Buffer *err)
714{
716
717 struct Buffer *label = buf_pool_get();
718 struct Buffer *mailbox = buf_pool_get();
719
720 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
721 while (MoreArgs(s))
722 {
723 bool label_set = false;
724 enum TriBool notify = TB_UNSET;
725 enum TriBool poll = TB_UNSET;
726
727 do
728 {
729 // Start by handling the options
731
732 if (mutt_str_equal(buf_string(buf), "-label"))
733 {
734 if (!MoreArgs(s))
735 {
736 buf_printf(err, _("%s: too few arguments"), "mailboxes -label");
737 goto done;
738 }
739
741 label_set = true;
742 }
743 else if (mutt_str_equal(buf_string(buf), "-nolabel"))
744 {
745 buf_reset(label);
746 label_set = true;
747 }
748 else if (mutt_str_equal(buf_string(buf), "-notify"))
749 {
750 notify = TB_TRUE;
751 }
752 else if (mutt_str_equal(buf_string(buf), "-nonotify"))
753 {
754 notify = TB_FALSE;
755 }
756 else if (mutt_str_equal(buf_string(buf), "-poll"))
757 {
758 poll = TB_TRUE;
759 }
760 else if (mutt_str_equal(buf_string(buf), "-nopoll"))
761 {
762 poll = TB_FALSE;
763 }
764 else if ((data & MUTT_NAMED) && !label_set)
765 {
766 if (!MoreArgs(s))
767 {
768 buf_printf(err, _("%s: too few arguments"), "named-mailboxes");
769 goto done;
770 }
771
772 buf_copy(label, buf);
773 label_set = true;
774 }
775 else
776 {
777 buf_copy(mailbox, buf);
778 break;
779 }
780 } while (MoreArgs(s));
781
782 if (buf_is_empty(mailbox))
783 {
784 buf_printf(err, _("%s: too few arguments"), "mailboxes");
785 goto done;
786 }
787
788 rc = mailbox_add(c_folder, buf_string(mailbox),
789 label_set ? buf_string(label) : NULL, poll, notify, err);
790 if (rc != MUTT_CMD_SUCCESS)
791 goto done;
792
793 buf_reset(label);
794 buf_reset(mailbox);
795 }
796
797 rc = MUTT_CMD_SUCCESS;
798
799done:
800 buf_pool_release(&label);
801 buf_pool_release(&mailbox);
802 return rc;
803}
804
808enum CommandResult parse_my_hdr(struct Buffer *buf, struct Buffer *s,
809 intptr_t data, struct Buffer *err)
810{
812 char *p = strpbrk(buf->data, ": \t");
813 if (!p || (*p != ':'))
814 {
815 buf_strcpy(err, _("invalid header field"));
816 return MUTT_CMD_WARNING;
817 }
818
819 struct EventHeader ev_h = { buf->data };
820 struct ListNode *n = header_find(&UserHeader, buf->data);
821
822 if (n)
823 {
824 header_update(n, buf->data);
825 mutt_debug(LL_NOTIFY, "NT_HEADER_CHANGE: %s\n", buf->data);
827 }
828 else
829 {
830 header_add(&UserHeader, buf->data);
831 mutt_debug(LL_NOTIFY, "NT_HEADER_ADD: %s\n", buf->data);
833 }
834
835 return MUTT_CMD_SUCCESS;
836}
837
848{
849 struct Buffer *tempfile = buf_pool_get();
850 buf_mktemp(tempfile);
851
852 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
853 if (!fp_out)
854 {
855 // L10N: '%s' is the file name of the temporary file
856 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
857 buf_pool_release(&tempfile);
858 return MUTT_CMD_ERROR;
859 }
860
861 dump_config(NeoMutt->sub->cs, flags, fp_out);
862
863 mutt_file_fclose(&fp_out);
864
865 struct PagerData pdata = { 0 };
866 struct PagerView pview = { &pdata };
867
868 pdata.fname = buf_string(tempfile);
869
870 pview.banner = "set";
872 pview.mode = PAGER_MODE_OTHER;
873
874 mutt_do_pager(&pview, NULL);
875 buf_pool_release(&tempfile);
876
877 return MUTT_CMD_SUCCESS;
878}
879
883static int envlist_sort(const void *a, const void *b, void *sdata)
884{
885 return strcmp(*(const char **) a, *(const char **) b);
886}
887
891static enum CommandResult parse_setenv(struct Buffer *buf, struct Buffer *s,
892 intptr_t data, struct Buffer *err)
893{
894 char **envp = EnvList;
895
896 bool query = false;
897 bool prefix = false;
898 bool unset = (data == MUTT_SET_UNSET);
899
900 if (!MoreArgs(s))
901 {
902 if (!StartupComplete)
903 {
904 buf_printf(err, _("%s: too few arguments"), "setenv");
905 return MUTT_CMD_WARNING;
906 }
907
908 struct Buffer *tempfile = buf_pool_get();
909 buf_mktemp(tempfile);
910
911 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
912 if (!fp_out)
913 {
914 // L10N: '%s' is the file name of the temporary file
915 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
916 buf_pool_release(&tempfile);
917 return MUTT_CMD_ERROR;
918 }
919
920 int count = 0;
921 for (char **env = EnvList; *env; env++)
922 count++;
923
924 mutt_qsort_r(EnvList, count, sizeof(char *), envlist_sort, NULL);
925
926 for (char **env = EnvList; *env; env++)
927 fprintf(fp_out, "%s\n", *env);
928
929 mutt_file_fclose(&fp_out);
930
931 struct PagerData pdata = { 0 };
932 struct PagerView pview = { &pdata };
933
934 pdata.fname = buf_string(tempfile);
935
936 pview.banner = "setenv";
938 pview.mode = PAGER_MODE_OTHER;
939
940 mutt_do_pager(&pview, NULL);
941 buf_pool_release(&tempfile);
942
943 return MUTT_CMD_SUCCESS;
944 }
945
946 if (*s->dptr == '?')
947 {
948 query = true;
949 prefix = true;
950
951 if (unset)
952 {
953 buf_printf(err, _("Can't query a variable with the '%s' command"), "unsetenv");
954 return MUTT_CMD_WARNING;
955 }
956
957 s->dptr++;
958 }
959
960 /* get variable name */
962
963 if (*s->dptr == '?')
964 {
965 if (unset)
966 {
967 buf_printf(err, _("Can't query a variable with the '%s' command"), "unsetenv");
968 return MUTT_CMD_WARNING;
969 }
970
971 if (prefix)
972 {
973 buf_printf(err, _("Can't use a prefix when querying a variable"));
974 return MUTT_CMD_WARNING;
975 }
976
977 query = true;
978 s->dptr++;
979 }
980
981 if (query)
982 {
983 bool found = false;
984 while (envp && *envp)
985 {
986 /* This will display all matches for "^QUERY" */
987 if (mutt_str_startswith(*envp, buf->data))
988 {
989 if (!found)
990 {
991 mutt_endwin();
992 found = true;
993 }
994 puts(*envp);
995 }
996 envp++;
997 }
998
999 if (found)
1000 {
1002 return MUTT_CMD_SUCCESS;
1003 }
1004
1005 buf_printf(err, _("%s is unset"), buf->data);
1006 return MUTT_CMD_WARNING;
1007 }
1008
1009 if (unset)
1010 {
1011 if (!envlist_unset(&EnvList, buf->data))
1012 {
1013 buf_printf(err, _("%s is unset"), buf->data);
1014 return MUTT_CMD_WARNING;
1015 }
1016 return MUTT_CMD_SUCCESS;
1017 }
1018
1019 /* set variable */
1020
1021 if (*s->dptr == '=')
1022 {
1023 s->dptr++;
1024 SKIPWS(s->dptr);
1025 }
1026
1027 if (!MoreArgs(s))
1028 {
1029 buf_printf(err, _("%s: too few arguments"), "setenv");
1030 return MUTT_CMD_WARNING;
1031 }
1032
1033 char *name = mutt_str_dup(buf->data);
1035 envlist_set(&EnvList, name, buf->data, true);
1036 FREE(&name);
1037
1038 return MUTT_CMD_SUCCESS;
1039}
1040
1044static enum CommandResult parse_source(struct Buffer *buf, struct Buffer *s,
1045 intptr_t data, struct Buffer *err)
1046{
1047 char path[PATH_MAX] = { 0 };
1048
1049 do
1050 {
1051 if (parse_extract_token(buf, s, TOKEN_NO_FLAGS) != 0)
1052 {
1053 buf_printf(err, _("source: error at %s"), s->dptr);
1054 return MUTT_CMD_ERROR;
1055 }
1056 mutt_str_copy(path, buf->data, sizeof(path));
1057 mutt_expand_path(path, sizeof(path));
1058
1059 if (source_rc(path, err) < 0)
1060 {
1061 buf_printf(err, _("source: file %s could not be sourced"), path);
1062 return MUTT_CMD_ERROR;
1063 }
1064
1065 } while (MoreArgs(s));
1066
1067 return MUTT_CMD_SUCCESS;
1068}
1069
1073static enum CommandResult parse_nospam(struct Buffer *buf, struct Buffer *s,
1074 intptr_t data, struct Buffer *err)
1075{
1076 if (!MoreArgs(s))
1077 {
1078 buf_printf(err, _("%s: too few arguments"), "nospam");
1079 return MUTT_CMD_ERROR;
1080 }
1081
1082 // Extract the first token, a regex or "*"
1084
1085 if (MoreArgs(s))
1086 {
1087 buf_printf(err, _("%s: too many arguments"), "finish");
1088 return MUTT_CMD_ERROR;
1089 }
1090
1091 // "*" is special - clear both spam and nospam lists
1092 if (mutt_str_equal(buf_string(buf), "*"))
1093 {
1096 return MUTT_CMD_SUCCESS;
1097 }
1098
1099 // If it's on the spam list, just remove it
1101 return MUTT_CMD_SUCCESS;
1102
1103 // Otherwise, add it to the nospam list
1104 if (mutt_regexlist_add(&NoSpamList, buf_string(buf), REG_ICASE, err) != 0)
1105 return MUTT_CMD_ERROR;
1106
1107 return MUTT_CMD_SUCCESS;
1108}
1109
1113static enum CommandResult parse_spam(struct Buffer *buf, struct Buffer *s,
1114 intptr_t data, struct Buffer *err)
1115{
1116 if (!MoreArgs(s))
1117 {
1118 buf_printf(err, _("%s: too few arguments"), "spam");
1119 return MUTT_CMD_ERROR;
1120 }
1121
1122 // Extract the first token, a regex
1124
1125 // If there's a second parameter, it's a template for the spam tag
1126 if (MoreArgs(s))
1127 {
1128 struct Buffer *templ = buf_pool_get();
1130
1131 // Add to the spam list
1132 int rc = mutt_replacelist_add(&SpamList, buf_string(buf), buf_string(templ), err);
1133 buf_pool_release(&templ);
1134 if (rc != 0)
1135 return MUTT_CMD_ERROR;
1136 }
1137 else
1138 {
1139 // If not, try to remove from the nospam list
1141 }
1142
1143 return MUTT_CMD_SUCCESS;
1144}
1145
1151static enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s,
1152 intptr_t data, struct Buffer *err)
1153{
1154 do
1155 {
1157 add_to_stailq((struct ListHead *) data, buf->data);
1158 } while (MoreArgs(s));
1159
1160 return MUTT_CMD_SUCCESS;
1161}
1162
1166static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
1167 intptr_t data, struct Buffer *err)
1168{
1169 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
1170
1171 do
1172 {
1174
1175 if (parse_grouplist(&gl, buf, s, err) == -1)
1176 goto bail;
1177
1180
1181 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
1182 goto bail;
1183 if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
1184 goto bail;
1185 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
1186 goto bail;
1187 } while (MoreArgs(s));
1188
1190 return MUTT_CMD_SUCCESS;
1191
1192bail:
1194 return MUTT_CMD_ERROR;
1195}
1196
1204enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s,
1205 intptr_t data, struct Buffer *err)
1206{
1207 if (!buf || !s || !err)
1208 return MUTT_CMD_ERROR;
1209
1210 buf_reset(err);
1211
1212 if (MoreArgs(s))
1213 {
1215
1216 if (MoreArgs(s))
1217 {
1218 buf_printf(err, _("%s: too many arguments"), "subscribe-to");
1219 return MUTT_CMD_WARNING;
1220 }
1221
1222 if (!buf_is_empty(buf))
1223 {
1224 /* Expand and subscribe */
1225 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), true) == 0)
1226 {
1227 mutt_message(_("Subscribed to %s"), buf->data);
1228 return MUTT_CMD_SUCCESS;
1229 }
1230
1231 buf_printf(err, _("Could not subscribe to %s"), buf->data);
1232 return MUTT_CMD_ERROR;
1233 }
1234
1235 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1236 return MUTT_CMD_ERROR;
1237 }
1238
1239 buf_addstr(err, _("No folder specified"));
1240 return MUTT_CMD_WARNING;
1241}
1242
1250static enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s,
1251 intptr_t data, struct Buffer *err)
1252{
1253 if (!s)
1254 return MUTT_CMD_ERROR;
1255
1256 struct Buffer *tagbuf = buf_pool_get();
1257 struct Buffer *fmtbuf = buf_pool_get();
1258
1259 while (MoreArgs(s))
1260 {
1262 const char *tag = buf_string(tagbuf);
1263 if (*tag == '\0')
1264 continue;
1265
1267 const char *fmt = buf_string(fmtbuf);
1268
1269 /* avoid duplicates */
1270 const char *tmp = mutt_hash_find(TagFormats, fmt);
1271 if (tmp)
1272 {
1273 mutt_warning(_("tag format '%s' already registered as '%s'"), fmt, tmp);
1274 continue;
1275 }
1276
1278 }
1279
1280 buf_pool_release(&tagbuf);
1281 buf_pool_release(&fmtbuf);
1282 return MUTT_CMD_SUCCESS;
1283}
1284
1292static enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s,
1293 intptr_t data, struct Buffer *err)
1294{
1295 if (!s)
1296 return MUTT_CMD_ERROR;
1297
1298 struct Buffer *tagbuf = buf_pool_get();
1299 struct Buffer *trnbuf = buf_pool_get();
1300
1301 while (MoreArgs(s))
1302 {
1304 const char *tag = buf_string(tagbuf);
1305 if (*tag == '\0')
1306 continue;
1307
1309 const char *trn = buf_string(trnbuf);
1310
1311 /* avoid duplicates */
1312 const char *tmp = mutt_hash_find(TagTransforms, tag);
1313 if (tmp)
1314 {
1315 mutt_warning(_("tag transform '%s' already registered as '%s'"), tag, tmp);
1316 continue;
1317 }
1318
1320 }
1321
1322 buf_pool_release(&tagbuf);
1323 buf_pool_release(&trnbuf);
1324 return MUTT_CMD_SUCCESS;
1325}
1326
1330static enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s,
1331 intptr_t data, struct Buffer *err)
1332{
1333 do
1334 {
1336
1337 /* don't add "*" to the unignore list */
1338 if (!mutt_str_equal(buf->data, "*"))
1339 add_to_stailq(&UnIgnore, buf->data);
1340
1342 } while (MoreArgs(s));
1343
1344 return MUTT_CMD_SUCCESS;
1345}
1346
1350static enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s,
1351 intptr_t data, struct Buffer *err)
1352{
1354 do
1355 {
1359
1360 if (!mutt_str_equal(buf->data, "*") &&
1361 (mutt_regexlist_add(&UnMailLists, buf->data, REG_ICASE, err) != 0))
1362 {
1363 return MUTT_CMD_ERROR;
1364 }
1365 } while (MoreArgs(s));
1366
1367 return MUTT_CMD_SUCCESS;
1368}
1369
1374static void do_unmailboxes(struct Mailbox *m)
1375{
1376#ifdef USE_INOTIFY
1377 if (m->poll_new_mail)
1379#endif
1380 m->visible = false;
1381 m->gen = -1;
1382 if (m->opened)
1383 {
1384 struct EventMailbox ev_m = { NULL };
1385 mutt_debug(LL_NOTIFY, "NT_MAILBOX_CHANGE: NULL\n");
1387 }
1388 else
1389 {
1391 mailbox_free(&m);
1392 }
1393}
1394
1398static void do_unmailboxes_star(void)
1399{
1400 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
1402 struct MailboxNode *np = NULL;
1403 struct MailboxNode *nptmp = NULL;
1404 STAILQ_FOREACH_SAFE(np, &ml, entries, nptmp)
1405 {
1407 }
1409}
1410
1416enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s,
1417 intptr_t data, struct Buffer *err)
1418{
1419 while (MoreArgs(s))
1420 {
1422
1423 if (mutt_str_equal(buf->data, "*"))
1424 {
1426 return MUTT_CMD_SUCCESS;
1427 }
1428
1429 buf_expand_path(buf);
1430
1431 struct Account *a = NULL;
1432 TAILQ_FOREACH(a, &NeoMutt->accounts, entries)
1433 {
1434 struct Mailbox *m = mx_mbox_find(a, buf_string(buf));
1435 if (m)
1436 {
1437 do_unmailboxes(m);
1438 break;
1439 }
1440 }
1441 }
1442 return MUTT_CMD_SUCCESS;
1443}
1444
1448static enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s,
1449 intptr_t data, struct Buffer *err)
1450{
1451 struct ListNode *np = NULL, *tmp = NULL;
1452 size_t l;
1453
1454 do
1455 {
1457 if (mutt_str_equal("*", buf->data))
1458 {
1459 /* Clear all headers, send a notification for each header */
1460 STAILQ_FOREACH(np, &UserHeader, entries)
1461 {
1462 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1463 struct EventHeader ev_h = { np->data };
1465 }
1467 continue;
1468 }
1469
1470 l = mutt_str_len(buf->data);
1471 if (buf->data[l - 1] == ':')
1472 l--;
1473
1474 STAILQ_FOREACH_SAFE(np, &UserHeader, entries, tmp)
1475 {
1476 if (mutt_istrn_equal(buf->data, np->data, l) && (np->data[l] == ':'))
1477 {
1478 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1479 struct EventHeader ev_h = { np->data };
1481
1482 header_free(&UserHeader, np);
1483 }
1484 }
1485 } while (MoreArgs(s));
1486 return MUTT_CMD_SUCCESS;
1487}
1488
1494static enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s,
1495 intptr_t data, struct Buffer *err)
1496{
1497 do
1498 {
1500 /* Check for deletion of entire list */
1501 if (mutt_str_equal(buf->data, "*"))
1502 {
1503 mutt_list_free((struct ListHead *) data);
1504 break;
1505 }
1506 remove_from_stailq((struct ListHead *) data, buf->data);
1507 } while (MoreArgs(s));
1508
1509 return MUTT_CMD_SUCCESS;
1510}
1511
1515static enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s,
1516 intptr_t data, struct Buffer *err)
1517{
1519 do
1520 {
1523
1524 if (!mutt_str_equal(buf->data, "*") &&
1525 (mutt_regexlist_add(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0))
1526 {
1527 return MUTT_CMD_ERROR;
1528 }
1529 } while (MoreArgs(s));
1530
1531 return MUTT_CMD_SUCCESS;
1532}
1533
1542 intptr_t data, struct Buffer *err)
1543{
1544 if (!buf || !s || !err)
1545 return MUTT_CMD_ERROR;
1546
1547 if (MoreArgs(s))
1548 {
1550
1551 if (MoreArgs(s))
1552 {
1553 buf_printf(err, _("%s: too many arguments"), "unsubscribe-from");
1554 return MUTT_CMD_WARNING;
1555 }
1556
1557 if (buf->data && (*buf->data != '\0'))
1558 {
1559 /* Expand and subscribe */
1560 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), false) == 0)
1561 {
1562 mutt_message(_("Unsubscribed from %s"), buf->data);
1563 return MUTT_CMD_SUCCESS;
1564 }
1565
1566 buf_printf(err, _("Could not unsubscribe from %s"), buf->data);
1567 return MUTT_CMD_ERROR;
1568 }
1569
1570 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1571 return MUTT_CMD_ERROR;
1572 }
1573
1574 buf_addstr(err, _("No folder specified"));
1575 return MUTT_CMD_WARNING;
1576}
1577
1581static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s,
1582 intptr_t data, struct Buffer *err)
1583{
1584 // silently ignore 'version' if it's in a config file
1585 if (!StartupComplete)
1586 return MUTT_CMD_SUCCESS;
1587
1588 struct Buffer *tempfile = buf_pool_get();
1589 buf_mktemp(tempfile);
1590
1591 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
1592 if (!fp_out)
1593 {
1594 // L10N: '%s' is the file name of the temporary file
1595 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
1596 buf_pool_release(&tempfile);
1597 return MUTT_CMD_ERROR;
1598 }
1599
1600 print_version(fp_out);
1601 mutt_file_fclose(&fp_out);
1602
1603 struct PagerData pdata = { 0 };
1604 struct PagerView pview = { &pdata };
1605
1606 pdata.fname = buf_string(tempfile);
1607
1608 pview.banner = "version";
1609 pview.flags = MUTT_PAGER_NO_FLAGS;
1610 pview.mode = PAGER_MODE_OTHER;
1611
1612 mutt_do_pager(&pview, NULL);
1613 buf_pool_release(&tempfile);
1614
1615 return MUTT_CMD_SUCCESS;
1616}
1617
1622{
1624}
1625
1629static const struct Command MuttCommands[] = {
1630 // clang-format off
1631 { "alias", parse_alias, 0 },
1632 { "alternates", parse_alternates, 0 },
1633 { "alternative_order", parse_stailq, IP &AlternativeOrderList },
1634 { "attachments", parse_attachments, 0 },
1635 { "auto_view", parse_stailq, IP &AutoViewList },
1636 { "bind", mutt_parse_bind, 0 },
1637 { "cd", parse_cd, 0 },
1638 { "color", mutt_parse_color, 0 },
1639 { "echo", parse_echo, 0 },
1640 { "exec", mutt_parse_exec, 0 },
1641 { "finish", parse_finish, 0 },
1642 { "group", parse_group, MUTT_GROUP },
1643 { "hdr_order", parse_stailq, IP &HeaderOrderList },
1644 { "ifdef", parse_ifdef, 0 },
1645 { "ifndef", parse_ifdef, 1 },
1646 { "ignore", parse_ignore, 0 },
1647 { "lists", parse_lists, 0 },
1648 { "macro", mutt_parse_macro, 1 },
1649 { "mailboxes", parse_mailboxes, 0 },
1650 { "mailto_allow", parse_stailq, IP &MailToAllow },
1651 { "mime_lookup", parse_stailq, IP &MimeLookupList },
1652 { "mono", mutt_parse_mono, 0 },
1653 { "my_hdr", parse_my_hdr, 0 },
1654 { "named-mailboxes", parse_mailboxes, MUTT_NAMED },
1655 { "nospam", parse_nospam, 0 },
1656 { "push", mutt_parse_push, 0 },
1657 { "reset", parse_set, MUTT_SET_RESET },
1658 { "score", mutt_parse_score, 0 },
1659 { "set", parse_set, MUTT_SET_SET },
1660 { "setenv", parse_setenv, MUTT_SET_SET },
1661 { "source", parse_source, 0 },
1662 { "spam", parse_spam, 0 },
1663 { "subjectrx", parse_subjectrx_list, 0 },
1664 { "subscribe", parse_subscribe, 0 },
1665 { "tag-formats", parse_tag_formats, 0 },
1666 { "tag-transforms", parse_tag_transforms, 0 },
1667 { "toggle", parse_set, MUTT_SET_INV },
1668 { "unalias", parse_unalias, 0 },
1669 { "unalternates", parse_unalternates, 0 },
1670 { "unalternative_order", parse_unstailq, IP &AlternativeOrderList },
1671 { "unattachments", parse_unattachments, 0 },
1672 { "unauto_view", parse_unstailq, IP &AutoViewList },
1673 { "unbind", mutt_parse_unbind, MUTT_UNBIND },
1674 { "uncolor", mutt_parse_uncolor, 0 },
1675 { "ungroup", parse_group, MUTT_UNGROUP },
1676 { "unhdr_order", parse_unstailq, IP &HeaderOrderList },
1677 { "unignore", parse_unignore, 0 },
1678 { "unlists", parse_unlists, 0 },
1679 { "unmacro", mutt_parse_unbind, MUTT_UNMACRO },
1680 { "unmailboxes", parse_unmailboxes, 0 },
1681 { "unmailto_allow", parse_unstailq, IP &MailToAllow },
1682 { "unmime_lookup", parse_unstailq, IP &MimeLookupList },
1683 { "unmono", mutt_parse_unmono, 0 },
1684 { "unmy_hdr", parse_unmy_hdr, 0 },
1685 { "unscore", mutt_parse_unscore, 0 },
1686 { "unset", parse_set, MUTT_SET_UNSET },
1687 { "unsetenv", parse_setenv, MUTT_SET_UNSET },
1688 { "unsubjectrx", parse_unsubjectrx_list, 0 },
1689 { "unsubscribe", parse_unsubscribe, 0 },
1690 { "version", parse_version, 0 },
1691 // clang-format on
1692};
1693
1698{
1700}
bool account_mailbox_remove(struct Account *a, struct Mailbox *m)
Remove a Mailbox from an Account.
Definition: account.c:97
struct Account * account_new(const char *name, struct ConfigSubset *sub)
Create a new Account.
Definition: account.c:43
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1461
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:641
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1294
Email Address Handling.
Email Aliases.
Alternate address handling.
GUI display the mailboxes in a side panel.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:173
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:466
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:88
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:303
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:238
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:407
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:572
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:542
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
Color and attribute parsing.
CommandResult
Error codes for command_t parse functions.
Definition: command.h:36
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: command.h:39
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: command.h:37
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: command.h:38
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
Definition: command.h:40
static const struct Command MuttCommands[]
General NeoMutt Commands.
Definition: commands.c:1629
enum CommandResult set_dump(ConfigDumpFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
Definition: commands.c:847
static enum CommandResult mailbox_add(const char *folder, const char *mailbox, const char *label, enum TriBool poll, enum TriBool notify, struct Buffer *err)
Add a new Mailbox.
Definition: commands.c:609
GroupState
Type of email address group.
Definition: commands.c:88
@ GS_RX
Entry is a regular expression.
Definition: commands.c:90
@ GS_NONE
Group is missing an argument.
Definition: commands.c:89
@ GS_ADDR
Entry is an address.
Definition: commands.c:91
#define MAX_ERRS
Definition: commands.c:72
enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer *err)
Parse and run a muttrc line in a relative directory.
Definition: commands.c:158
void commands_init(void)
Initialize commands array and register default commands.
Definition: commands.c:1697
int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err)
Parse a group context.
Definition: commands.c:124
void source_stack_cleanup(void)
Free memory from the stack used for the source command.
Definition: commands.c:1621
static void do_unmailboxes_star(void)
Remove all Mailboxes from the Sidebar/notifications.
Definition: commands.c:1398
static struct ListHead MuttrcStack
LIFO designed to contain the list of config files that have been sourced and avoid cyclic sourcing.
Definition: commands.c:70
TriBool
Tri-state boolean.
Definition: commands.c:78
@ TB_FALSE
Value is false.
Definition: commands.c:80
@ TB_TRUE
Value is true.
Definition: commands.c:81
@ TB_UNSET
Value hasn't been set.
Definition: commands.c:79
static void do_unmailboxes(struct Mailbox *m)
Remove a Mailbox from the Sidebar/notifications.
Definition: commands.c:1374
int source_rc(const char *rcfile_path, struct Buffer *err)
Read an initialization file.
Definition: commands.c:199
char * mutt_get_sourced_cwd(void)
Get the current file path that is being parsed.
Definition: commands.c:178
static bool is_function(const char *name)
Is the argument a neomutt function?
Definition: commands.c:100
Functions to parse commands in a config file.
#define MUTT_NAMED
Definition: commands.h:36
bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
Definition: dump.c:165
uint16_t ConfigDumpFlags
Flags for dump_config(), e.g. CS_DUMP_ONLY_CHANGED.
Definition: dump.h:34
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
Convenience wrapper for the config headers.
char * HomeDir
User's home directory.
Definition: globals.c:39
bool StartupComplete
When the config has been read.
Definition: main.c:188
#define IP
Definition: set.h:54
const char * cc_charset(void)
Get the cached value of $charset.
Definition: config_cache.c:115
void commands_register(const struct Command *cmds, const size_t num_cmds)
Add commands to Commands array.
Definition: command.c:53
struct Command * command_get(const char *s)
Get a Command by its name.
Definition: command.c:87
Convenience wrapper for the core headers.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition: curs_lib.c:184
void mutt_endwin(void)
Shutdown curses.
Definition: curs_lib.c:150
int mutt_do_pager(struct PagerView *pview, struct Email *e)
Display some page-able text to the user (help or attachment)
Definition: do_pager.c:123
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:206
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:164
struct ListNode * header_update(struct ListNode *hdr, const char *header)
Update an existing header.
Definition: email.c:178
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:141
struct ReplaceList SpamList
List of regexes to match subscribed mailing lists.
Definition: globals.c:45
struct RegexList SubscribedLists
List of header patterns to unignore (see)
Definition: globals.c:47
struct HashTable * AutoSubscribeCache
< Hash Table: "mailto:" -> AutoSubscribeCache
Definition: globals.c:35
struct RegexList UnSubscribedLists
Definition: globals.c:53
struct RegexList UnMailLists
List of regexes to exclude false matches in SubscribedLists.
Definition: globals.c:51
struct RegexList MailLists
List of permitted fields in a mailto: url.
Definition: globals.c:39
struct ListHead MailToAllow
List of regexes to identify non-spam emails.
Definition: globals.c:41
struct ListHead Ignore
List of regexes to match mailing lists.
Definition: globals.c:37
struct RegexList NoSpamList
List of regexes and patterns to match spam emails.
Definition: globals.c:43
struct ListHead UnIgnore
List of regexes to exclude false matches in MailLists.
Definition: globals.c:49
Structs that make up an email.
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:176
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:174
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:175
bool envlist_set(char ***envp, const char *name, const char *value, bool overwrite)
Set an environment variable.
Definition: envlist.c:87
bool envlist_unset(char ***envp, const char *name)
Unset an environment variable.
Definition: envlist.c:135
int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: extract.c:48
#define TOKEN_SPACE
Don't treat whitespace as a term.
Definition: extract.h:48
#define TOKEN_QUOTE
Don't interpret quotes.
Definition: extract.h:49
#define TOKEN_EQUAL
Treat '=' as a special.
Definition: extract.h:46
#define MoreArgs(buf)
Definition: extract.h:31
#define TOKEN_QUESTION
Treat '?' as a special.
Definition: extract.h:55
#define TOKEN_NO_FLAGS
No flags are set.
Definition: extract.h:45
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
Definition: file.c:763
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:636
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
#define MUTT_RL_CONT
-continuation
Definition: file.h:40
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:218
struct ListHead MimeLookupList
List of mime types that that shouldn't use the mailcap entry.
Definition: globals.c:52
struct ListHead AlternativeOrderList
List of preferred mime types to display.
Definition: globals.c:49
struct ListHead AutoViewList
List of mime types to auto view.
Definition: globals.c:50
bool OptForceRefresh
(pseudo) refresh even during macros
Definition: globals.c:70
struct ListHead UserHeader
List of custom headers to add to outgoing emails.
Definition: globals.c:55
struct ListHead HeaderOrderList
List of header fields in the order they should be displayed.
Definition: globals.c:51
char ** EnvList
Private copy of the environment variables.
Definition: globals.c:83
Global variables.
int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *al)
Remove an AddressList from a GroupList.
Definition: group.c:290
void mutt_grouplist_add(struct GroupList *gl, struct Group *group)
Add a Group to a GroupList.
Definition: group.c:182
int mutt_grouplist_add_regex(struct GroupList *gl, const char *s, uint16_t flags, struct Buffer *err)
Add matching Addresses to a GroupList.
Definition: group.c:321
struct Group * mutt_pattern_group(const char *pat)
Match a pattern to a Group.
Definition: group.c:117
int mutt_grouplist_remove_regex(struct GroupList *gl, const char *s)
Remove matching addresses from a GroupList.
Definition: group.c:346
void mutt_grouplist_destroy(struct GroupList *gl)
Free a GroupList.
Definition: group.c:202
void mutt_grouplist_clear(struct GroupList *gl)
Clear a GroupList.
Definition: group.c:148
void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *al)
Add Address list to a GroupList.
Definition: group.c:271
#define MUTT_GROUP
'group' config command
Definition: group.h:33
#define MUTT_UNGROUP
'ungroup' config command
Definition: group.h:34
static enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'finish' command - Implements Command::parse() -.
Definition: commands.c:401
static enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse a list command - Implements Command::parse() -.
Definition: commands.c:1151
static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'version' command - Implements Command::parse() -.
Definition: commands.c:1581
static enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unlists' command - Implements Command::parse() -.
Definition: commands.c:1350
static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'group' and 'ungroup' commands - Implements Command::parse() -.
Definition: commands.c:416
enum CommandResult parse_unsubjectrx_list(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsubjectrx' command - Implements Command::parse() -.
Definition: subjectrx.c:184
enum CommandResult parse_set(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'set' family of commands - Implements Command::parse() -.
Definition: set.c:423
static enum CommandResult parse_spam(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'spam' command - Implements Command::parse() -.
Definition: commands.c:1113
enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'alternates' command - Implements Command::parse() -.
Definition: alternates.c:92
enum CommandResult mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unscore' command - Implements Command::parse() -.
Definition: score.c:197
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unmono' command - Implements Command::parse() -.
Definition: command.c:496
static enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse an unlist command - Implements Command::parse() -.
Definition: commands.c:1494
enum CommandResult mutt_parse_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'bind' command - Implements Command::parse() -.
Definition: parse.c:363
enum CommandResult parse_subjectrx_list(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'subjectrx' command - Implements Command::parse() -.
Definition: subjectrx.c:167
enum CommandResult parse_unsubscribe_from(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsubscribe-from' command - Implements Command::parse() -.
Definition: commands.c:1541
static enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unignore' command - Implements Command::parse() -.
Definition: commands.c:1330
static enum CommandResult parse_ifdef(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'ifdef' and 'ifndef' commands - Implements Command::parse() -.
Definition: commands.c:516
static enum CommandResult parse_source(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'source' command - Implements Command::parse() -.
Definition: commands.c:1044
enum CommandResult parse_unalternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unalternates' command - Implements Command::parse() -.
Definition: alternates.c:128
enum CommandResult mutt_parse_score(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'score' command - Implements Command::parse() -.
Definition: score.c:87
enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unmailboxes' command - Implements Command::parse() -.
Definition: commands.c:1416
static enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unmy_hdr' command - Implements Command::parse() -.
Definition: commands.c:1448
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'mono' command - Implements Command::parse() -.
Definition: command.c:528
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'color' command - Implements Command::parse() -.
Definition: command.c:506
static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'subscribe' command - Implements Command::parse() -.
Definition: commands.c:1166
static enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'tag-transforms' command - Implements Command::parse() -.
Definition: commands.c:1292
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'uncolor' command - Implements Command::parse() -.
Definition: command.c:475
static enum CommandResult parse_cd(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'cd' command - Implements Command::parse() -.
Definition: commands.c:347
static enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'ignore' command - Implements Command::parse() -.
Definition: commands.c:561
enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'subscribe-to' command - Implements Command::parse() -.
Definition: commands.c:1204
enum CommandResult mutt_parse_unbind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unbind' command - Implements Command::parse() -.
Definition: parse.c:472
enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'alias' command - Implements Command::parse() -.
Definition: commands.c:47
enum CommandResult parse_unalias(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unalias' command - Implements Command::parse() -.
Definition: commands.c:160
enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'mailboxes' command - Implements Command::parse() -.
Definition: commands.c:712
static enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'tag-formats' command - Implements Command::parse() -.
Definition: commands.c:1250
enum CommandResult mutt_parse_macro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'macro' command - Implements Command::parse() -.
Definition: parse.c:559
enum CommandResult parse_unattachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unattachments' command - Implements Command::parse() -.
Definition: attachments.c:534
static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'lists' command - Implements Command::parse() -.
Definition: commands.c:577
static enum CommandResult parse_echo(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'echo' command - Implements Command::parse() -.
Definition: commands.c:377
enum CommandResult parse_my_hdr(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'my_hdr' command - Implements Command::parse() -.
Definition: commands.c:808
static enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsubscribe' command - Implements Command::parse() -.
Definition: commands.c:1515
static enum CommandResult parse_setenv(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'setenv' and 'unsetenv' commands - Implements Command::parse() -.
Definition: commands.c:891
enum CommandResult mutt_parse_push(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'push' command - Implements Command::parse() -.
Definition: parse.c:344
enum CommandResult parse_attachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'attachments' command - Implements Command::parse() -.
Definition: attachments.c:475
enum CommandResult mutt_parse_exec(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'exec' command - Implements Command::parse() -.
Definition: parse.c:645
static enum CommandResult parse_nospam(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'nospam' command - Implements Command::parse() -.
Definition: commands.c:1073
#define mutt_warning(...)
Definition: logging2.h:90
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_message(...)
Definition: logging2.h:91
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
static int envlist_sort(const void *a, const void *b, void *sdata)
Compare two environment strings - Implements sort_t -.
Definition: commands.c:883
Convenience wrapper for the gui headers.
struct HashElem * mutt_hash_insert(struct HashTable *table, const char *strkey, void *data)
Add a new element to the Hash Table (with string keys)
Definition: hash.c:335
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:362
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:457
IMAP network mailbox.
int imap_subscribe(char *path, bool subscribe)
Subscribe to a mailbox.
Definition: imap.c:1210
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition: lib.c:529
Manage keymappings.
#define MUTT_UNBIND
Parse 'unbind' command.
Definition: lib.h:48
#define MUTT_UNMACRO
Parse 'unmacro' command.
Definition: lib.h:49
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
Definition: list.c:45
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
@ LL_DEBUG2
Log at debug level 2.
Definition: logging2.h:44
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
int mailbox_gen(void)
Get the next generation number.
Definition: mailbox.c:59
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:69
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:90
@ NT_MAILBOX_CHANGE
Mailbox has been changed.
Definition: mailbox.h:172
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:42
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h: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.
int mutt_monitor_add(struct Mailbox *m)
Add a watch for a mailbox.
Definition: monitor.c:480
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Definition: monitor.c:524
Monitor files for changes.
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
Definition: charset.c:826
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Definition: charset.h:71
Convenience wrapper for the library headers.
#define _(a)
Definition: message.h:28
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
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:75
bool mutt_path_to_absolute(char *path, const char *reference)
Convert relative filepath to an absolute path.
Definition: path.c:329
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
Definition: path.c:469
int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat)
Remove a pattern from a list.
Definition: regex.c:588
void mutt_regexlist_free(struct RegexList *rl)
Free a RegexList object.
Definition: regex.c:175
int mutt_regexlist_add(struct RegexList *rl, const char *str, uint16_t flags, struct Buffer *err)
Compile a regex string and add it to a list.
Definition: regex.c:136
void mutt_replacelist_free(struct ReplaceList *rl)
Free a ReplaceList object.
Definition: regex.c:472
int mutt_regexlist_remove(struct RegexList *rl, const char *str)
Remove a Regex from a list.
Definition: regex.c:231
int mutt_replacelist_add(struct ReplaceList *rl, const char *pat, const char *templ, struct Buffer *err)
Add a pattern and a template to a list.
Definition: regex.c:267
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:775
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:763
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:862
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:228
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:568
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:653
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Definition: string.c:525
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:327
Many unsorted constants and some structs.
#define PATH_MAX
Definition: mutt.h:41
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1712
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1687
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:124
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1418
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:329
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1276
Some miscellaneous functions.
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1548
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1728
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1524
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1476
API for mailboxes.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:162
bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
Add an Account to the global list.
Definition: neomutt.c:104
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:185
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:49
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:47
GUI display a file/email/help in a viewport with paging.
#define MUTT_PAGER_NO_FLAGS
No flags are set.
Definition: lib.h:59
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:141
Text parsing functions.
@ MUTT_SET_INV
default is to invert all vars
Definition: set.h:37
@ MUTT_SET_SET
default is to set all vars
Definition: set.h:36
@ MUTT_SET_RESET
default is to reset all vars to default
Definition: set.h:39
@ MUTT_SET_UNSET
default is to unset all vars
Definition: set.h:38
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 mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
Definition: qsort_r.c:66
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define STAILQ_REMOVE_HEAD(head, field)
Definition: queue.h:422
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_FIRST(head)
Definition: queue.h:350
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define STAILQ_EMPTY(head)
Definition: queue.h:348
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:637
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:362
#define TAILQ_EMPTY(head)
Definition: queue.h:721
enum CommandResult parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
Definition: rc.c:104
enum CommandResult parse_rc_buffer(struct Buffer *line, struct Buffer *token, struct Buffer *err)
Parse a line of user config.
Definition: rc.c:46
Routines for adding user scores to emails.
Key value store.
bool store_is_valid_backend(const char *str)
Is the string a valid Store backend.
Definition: store.c:128
#define NONULL(x)
Definition: string2.h:37
#define SKIPWS(ch)
Definition: string2.h:45
A group of associated Mailboxes.
Definition: account.h:37
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
char * name
Name of Account.
Definition: account.h:39
struct Notify * notify
Notifications: NotifyAccount, EventAccount.
Definition: account.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: account.h:40
String manipulation buffer.
Definition: buffer.h:34
char * dptr
Current read/write position.
Definition: buffer.h:36
size_t dsize
Length of data.
Definition: buffer.h:37
char * data
Pointer to data.
Definition: buffer.h:35
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
An event that happened to a header.
Definition: email.h:183
An Event that happened to a Mailbox.
Definition: mailbox.h:186
A List node for strings.
Definition: list.h:35
char * data
String.
Definition: list.h:36
List of Mailboxes.
Definition: mailbox.h:153
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
A mailbox.
Definition: mailbox.h:79
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
bool poll_new_mail
Check for new mail.
Definition: mailbox.h:114
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition: mailbox.h:144
bool notify_user
Notify the user of new mail.
Definition: mailbox.h:112
struct Buffer pathbuf
Path of the Mailbox.
Definition: mailbox.h:80
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:126
bool visible
True if a result of "mailboxes".
Definition: mailbox.h:129
int opened
Number of times mailbox is opened.
Definition: mailbox.h:127
int gen
Generation number, for sorting.
Definition: mailbox.h:146
const char * name
String value.
Definition: mapping.h:33
Mapping between a function and an operation.
Definition: lib.h:102
const char * name
Name of the function.
Definition: lib.h:103
Container for Accounts, Notifications.
Definition: neomutt.h:41
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
Data to be displayed by PagerView.
Definition: lib.h:160
const char * fname
Name of the file to read.
Definition: lib.h:164
Paged view into some data.
Definition: lib.h:171
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:172
enum PagerMode mode
Pager mode.
Definition: lib.h:173
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:174
const char * banner
Title to display in status bar.
Definition: lib.h:175
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition: subset.c:99
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition: subset.c:178
struct HashTable * TagFormats
Hash Table: "inbox" -> "GI" - Tag format strings.
Definition: tags.c:39
struct HashTable * TagTransforms
Hash Table: "inbox" -> "i" - Alternative tag names.
Definition: tags.c:38
#define buf_mktemp(buf)
Definition: tmp.h:33
const struct Mapping MenuNames[]
Menu name lookup table.
Definition: type.c:37
bool print_version(FILE *fp)
Print system and compile info to a file.
Definition: version.c:394
bool feature_enabled(const char *name)
Test if a compile-time feature is enabled.
Definition: version.c:546
Display version and copyright about NeoMutt.