NeoMutt  2024-02-01-35-geee02f
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c
Go to the documentation of this file.
1
37#include "config.h"
38#include <errno.h>
39#include <limits.h>
40#include <stdbool.h>
41#include <stdio.h>
42#include <string.h>
43#include <unistd.h>
44#include "mutt/lib.h"
45#include "address/lib.h"
46#include "config/lib.h"
47#include "email/lib.h"
48#include "core/lib.h"
49#include "alias/lib.h"
50#include "gui/lib.h"
51#include "mutt.h"
52#include "commands.h"
53#include "attach/lib.h"
54#include "color/lib.h"
55#include "imap/lib.h"
56#include "key/lib.h"
57#include "menu/lib.h"
58#include "pager/lib.h"
59#include "parse/lib.h"
60#include "store/lib.h"
61#include "alternates.h"
62#include "globals.h"
63#include "muttlib.h"
64#include "mx.h"
65#include "score.h"
66#include "version.h"
67#ifdef USE_INOTIFY
68#include "monitor.h"
69#endif
70#ifdef ENABLE_NLS
71#include <libintl.h>
72#endif
73
77
78#define MAX_ERRS 128
79
84{
85 TB_UNSET = -1,
88};
89
94{
98};
99
106static bool is_function(const char *name)
107{
108 for (size_t i = 0; MenuNames[i].name; i++)
109 {
110 const struct MenuFuncOp *fns = km_get_table(MenuNames[i].value);
111 if (!fns)
112 continue;
113
114 for (int j = 0; fns[j].name; j++)
115 if (mutt_str_equal(name, fns[j].name))
116 return true;
117 }
118 return false;
119}
120
130int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s,
131 struct Buffer *err)
132{
133 while (mutt_istr_equal(buf->data, "-group"))
134 {
135 if (!MoreArgs(s))
136 {
137 buf_strcpy(err, _("-group: no group name"));
138 return -1;
139 }
140
142
144
145 if (!MoreArgs(s))
146 {
147 buf_strcpy(err, _("out of arguments"));
148 return -1;
149 }
150
152 }
153
154 return 0;
155}
156
164enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer *err)
165{
167
168 enum CommandResult ret = parse_rc_line(line, err);
169
170 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
172 FREE(&np->data);
173 FREE(&np);
174
175 return ret;
176}
177
185{
186 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
187 if (np && np->data)
188 return mutt_str_dup(np->data);
189
190 // stack is empty, return our own dummy file relative to cwd
191 struct Buffer *cwd = buf_pool_get();
192 mutt_path_getcwd(cwd);
193 buf_addstr(cwd, "/dummy.rc");
194 char *ret = buf_strdup(cwd);
195 buf_pool_release(&cwd);
196 return ret;
197}
198
205int source_rc(const char *rcfile_path, struct Buffer *err)
206{
207 int lineno = 0, rc = 0, warnings = 0;
208 enum CommandResult line_rc;
209 struct Buffer *token = NULL, *linebuf = NULL;
210 char *line = NULL;
211 char *currentline = NULL;
212 char rcfile[PATH_MAX] = { 0 };
213 size_t linelen = 0;
214 pid_t pid;
215
216 mutt_str_copy(rcfile, rcfile_path, sizeof(rcfile));
217
218 size_t rcfilelen = mutt_str_len(rcfile);
219 if (rcfilelen == 0)
220 return -1;
221
222 bool ispipe = rcfile[rcfilelen - 1] == '|';
223
224 if (!ispipe)
225 {
226 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
227 if (!mutt_path_to_absolute(rcfile, np ? NONULL(np->data) : ""))
228 {
229 mutt_error(_("Error: Can't build path of '%s'"), rcfile_path);
230 return -1;
231 }
232
233 STAILQ_FOREACH(np, &MuttrcStack, entries)
234 {
235 if (mutt_str_equal(np->data, rcfile))
236 {
237 break;
238 }
239 }
240 if (np)
241 {
242 mutt_error(_("Error: Cyclic sourcing of configuration file '%s'"), rcfile);
243 return -1;
244 }
245
247 }
248
249 mutt_debug(LL_DEBUG2, "Reading configuration file '%s'\n", rcfile);
250
251 FILE *fp = mutt_open_read(rcfile, &pid);
252 if (!fp)
253 {
254 buf_printf(err, "%s: %s", rcfile, strerror(errno));
255 return -1;
256 }
257
258 token = buf_pool_get();
259 linebuf = buf_pool_get();
260
261 const char *const c_config_charset = cs_subset_string(NeoMutt->sub, "config_charset");
262 const char *const c_charset = cc_charset();
263 while ((line = mutt_file_read_line(line, &linelen, fp, &lineno, MUTT_RL_CONT)) != NULL)
264 {
265 const bool conv = c_config_charset && c_charset;
266 if (conv)
267 {
268 currentline = mutt_str_dup(line);
269 if (!currentline)
270 continue;
271 mutt_ch_convert_string(&currentline, c_config_charset, c_charset, MUTT_ICONV_NO_FLAGS);
272 }
273 else
274 {
275 currentline = line;
276 }
277
278 buf_strcpy(linebuf, currentline);
279
280 buf_reset(err);
281 line_rc = parse_rc_buffer(linebuf, token, err);
282 if (line_rc == MUTT_CMD_ERROR)
283 {
284 mutt_error("%s:%d: %s", rcfile, lineno, buf_string(err));
285 if (--rc < -MAX_ERRS)
286 {
287 if (conv)
288 FREE(&currentline);
289 break;
290 }
291 }
292 else if (line_rc == MUTT_CMD_WARNING)
293 {
294 /* Warning */
295 mutt_warning("%s:%d: %s", rcfile, lineno, buf_string(err));
296 warnings++;
297 }
298 else if (line_rc == MUTT_CMD_FINISH)
299 {
300 if (conv)
301 FREE(&currentline);
302 break; /* Found "finish" command */
303 }
304 else
305 {
306 if (rc < 0)
307 rc = -1;
308 }
309 if (conv)
310 FREE(&currentline);
311 }
312
313 FREE(&line);
314 mutt_file_fclose(&fp);
315 if (pid != -1)
316 filter_wait(pid);
317
318 if (rc)
319 {
320 /* the neomuttrc source keyword */
321 buf_reset(err);
322 buf_printf(err, (rc >= -MAX_ERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
323 rcfile);
324 rc = -1;
325 }
326 else
327 {
328 /* Don't alias errors with warnings */
329 if (warnings > 0)
330 {
331 buf_printf(err, ngettext("source: %d warning in %s", "source: %d warnings in %s", warnings),
332 warnings, rcfile);
333 rc = -2;
334 }
335 }
336
337 if (!ispipe && !STAILQ_EMPTY(&MuttrcStack))
338 {
339 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
341 FREE(&np->data);
342 FREE(&np);
343 }
344
345 buf_pool_release(&token);
346 buf_pool_release(&linebuf);
347 return rc;
348}
349
353static enum CommandResult parse_cd(struct Buffer *buf, struct Buffer *s,
354 intptr_t data, struct Buffer *err)
355{
357 buf_expand_path(buf);
358 if (buf_is_empty(buf))
359 {
360 if (HomeDir)
361 {
362 buf_strcpy(buf, HomeDir);
363 }
364 else
365 {
366 buf_printf(err, _("%s: too few arguments"), "cd");
367 return MUTT_CMD_ERROR;
368 }
369 }
370
371 if (chdir(buf_string(buf)) != 0)
372 {
373 buf_printf(err, "cd: %s", strerror(errno));
374 return MUTT_CMD_ERROR;
375 }
376
377 return MUTT_CMD_SUCCESS;
378}
379
383static enum CommandResult parse_echo(struct Buffer *buf, struct Buffer *s,
384 intptr_t data, struct Buffer *err)
385{
386 if (!MoreArgs(s))
387 {
388 buf_printf(err, _("%s: too few arguments"), "echo");
389 return MUTT_CMD_WARNING;
390 }
392 OptForceRefresh = true;
393 mutt_message("%s", buf->data);
394 OptForceRefresh = false;
395 mutt_sleep(0);
396
397 return MUTT_CMD_SUCCESS;
398}
399
407static enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s,
408 intptr_t data, struct Buffer *err)
409{
410 if (MoreArgs(s))
411 {
412 buf_printf(err, _("%s: too many arguments"), "finish");
413 return MUTT_CMD_WARNING;
414 }
415
416 return MUTT_CMD_FINISH;
417}
418
422static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
423 intptr_t data, struct Buffer *err)
424{
425 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
426 enum GroupState gstate = GS_NONE;
427
428 do
429 {
431 if (parse_grouplist(&gl, buf, s, err) == -1)
432 goto bail;
433
434 if ((data == MUTT_UNGROUP) && mutt_istr_equal(buf->data, "*"))
435 {
437 goto out;
438 }
439
440 if (mutt_istr_equal(buf->data, "-rx"))
441 {
442 gstate = GS_RX;
443 }
444 else if (mutt_istr_equal(buf->data, "-addr"))
445 {
446 gstate = GS_ADDR;
447 }
448 else
449 {
450 switch (gstate)
451 {
452 case GS_NONE:
453 buf_printf(err, _("%sgroup: missing -rx or -addr"),
454 (data == MUTT_UNGROUP) ? "un" : "");
455 goto warn;
456
457 case GS_RX:
458 if ((data == MUTT_GROUP) &&
459 (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
460 {
461 goto bail;
462 }
463 else if ((data == MUTT_UNGROUP) &&
464 (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
465 {
466 goto bail;
467 }
468 break;
469
470 case GS_ADDR:
471 {
472 char *estr = NULL;
473 struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
474 mutt_addrlist_parse2(&al, buf->data);
475 if (TAILQ_EMPTY(&al))
476 goto bail;
477 if (mutt_addrlist_to_intl(&al, &estr))
478 {
479 buf_printf(err, _("%sgroup: warning: bad IDN '%s'"),
480 (data == 1) ? "un" : "", estr);
482 FREE(&estr);
483 goto bail;
484 }
485 if (data == MUTT_GROUP)
487 else if (data == MUTT_UNGROUP)
490 break;
491 }
492 }
493 }
494 } while (MoreArgs(s));
495
496out:
498 return MUTT_CMD_SUCCESS;
499
500bail:
502 return MUTT_CMD_ERROR;
503
504warn:
506 return MUTT_CMD_WARNING;
507}
508
522static enum CommandResult parse_ifdef(struct Buffer *buf, struct Buffer *s,
523 intptr_t data, struct Buffer *err)
524{
526
527 if (buf_is_empty(buf))
528 {
529 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
530 return MUTT_CMD_WARNING;
531 }
532
533 // is the item defined as:
534 bool res = cs_subset_lookup(NeoMutt->sub, buf->data) // a variable?
535 || feature_enabled(buf->data) // a compiled-in feature?
536 || is_function(buf->data) // a function?
537 || command_get(buf->data) // a command?
538#ifdef USE_HCACHE
539 || store_is_valid_backend(buf->data) // a store? (database)
540#endif
541 || mutt_str_getenv(buf->data); // an environment variable?
542
543 if (!MoreArgs(s))
544 {
545 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
546 return MUTT_CMD_WARNING;
547 }
549
550 /* ifdef KNOWN_SYMBOL or ifndef UNKNOWN_SYMBOL */
551 if ((res && (data == 0)) || (!res && (data == 1)))
552 {
553 enum CommandResult rc = parse_rc_line(buf->data, err);
554 if (rc == MUTT_CMD_ERROR)
555 {
556 mutt_error(_("Error: %s"), buf_string(err));
557 return MUTT_CMD_ERROR;
558 }
559 return rc;
560 }
561 return MUTT_CMD_SUCCESS;
562}
563
567static enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s,
568 intptr_t data, struct Buffer *err)
569{
570 do
571 {
574 add_to_stailq(&Ignore, buf->data);
575 } while (MoreArgs(s));
576
577 return MUTT_CMD_SUCCESS;
578}
579
583static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
584 intptr_t data, struct Buffer *err)
585{
586 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
587
588 do
589 {
591
592 if (parse_grouplist(&gl, buf, s, err) == -1)
593 goto bail;
594
596
597 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
598 goto bail;
599
600 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
601 goto bail;
602 } while (MoreArgs(s));
603
605 return MUTT_CMD_SUCCESS;
606
607bail:
609 return MUTT_CMD_ERROR;
610}
611
615static enum CommandResult mailbox_add(const char *folder, const char *mailbox,
616 const char *label, enum TriBool poll,
617 enum TriBool notify, struct Buffer *err)
618{
619 mutt_debug(LL_DEBUG1, "Adding mailbox: '%s' label '%s', poll %s, notify %s\n",
620 mailbox, label ? label : "[NONE]",
621 (poll == TB_UNSET) ? "[UNSPECIFIED]" :
622 (poll == TB_TRUE) ? "true" :
623 "false",
624 (notify == TB_UNSET) ? "[UNSPECIFIED]" :
625 (notify == TB_TRUE) ? "true" :
626 "false");
627 struct Mailbox *m = mailbox_new();
628
629 buf_strcpy(&m->pathbuf, mailbox);
630 /* int rc = */ mx_path_canon2(m, folder);
631
632 if (m->type <= MUTT_UNKNOWN)
633 {
634 buf_printf(err, "Unknown Mailbox: %s", m->realpath);
635 mailbox_free(&m);
636 return MUTT_CMD_ERROR;
637 }
638
639 bool new_account = false;
640 struct Account *a = mx_ac_find(m);
641 if (!a)
642 {
643 a = account_new(NULL, NeoMutt->sub);
644 a->type = m->type;
645 new_account = true;
646 }
647
648 if (!new_account)
649 {
650 struct Mailbox *m_old = mx_mbox_find(a, m->realpath);
651 if (m_old)
652 {
653 if (!m_old->visible)
654 {
655 m_old->visible = true;
656 m_old->gen = mailbox_gen();
657 }
658
659 if (label)
660 mutt_str_replace(&m_old->name, label);
661
662 if (notify != TB_UNSET)
663 m_old->notify_user = notify;
664
665 if (poll != TB_UNSET)
666 m_old->poll_new_mail = poll;
667
668 struct EventMailbox ev_m = { m_old };
670
671 mailbox_free(&m);
672 return MUTT_CMD_SUCCESS;
673 }
674 }
675
676 if (label)
677 m->name = mutt_str_dup(label);
678
679 if (notify != TB_UNSET)
680 m->notify_user = notify;
681
682 if (poll != TB_UNSET)
683 m->poll_new_mail = poll;
684
685 if (!mx_ac_add(a, m))
686 {
687 mailbox_free(&m);
688 if (new_account)
689 {
690 cs_subset_free(&a->sub);
691 FREE(&a->name);
692 notify_free(&a->notify);
693 FREE(&a);
694 }
695 return MUTT_CMD_SUCCESS;
696 }
697
698 if (new_account)
699 {
701 }
702
703 // this is finally a visible mailbox in the sidebar and mailboxes list
704 m->visible = true;
705
706#ifdef USE_INOTIFY
708#endif
709
710 return MUTT_CMD_SUCCESS;
711}
712
718enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s,
719 intptr_t data, struct Buffer *err)
720{
722
723 struct Buffer *label = buf_pool_get();
724 struct Buffer *mailbox = buf_pool_get();
725
726 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
727 while (MoreArgs(s))
728 {
729 bool label_set = false;
730 enum TriBool notify = TB_UNSET;
731 enum TriBool poll = TB_UNSET;
732
733 do
734 {
735 // Start by handling the options
737
738 if (mutt_str_equal(buf_string(buf), "-label"))
739 {
740 if (!MoreArgs(s))
741 {
742 buf_printf(err, _("%s: too few arguments"), "mailboxes -label");
743 goto done;
744 }
745
747 label_set = true;
748 }
749 else if (mutt_str_equal(buf_string(buf), "-nolabel"))
750 {
751 buf_reset(label);
752 label_set = true;
753 }
754 else if (mutt_str_equal(buf_string(buf), "-notify"))
755 {
756 notify = TB_TRUE;
757 }
758 else if (mutt_str_equal(buf_string(buf), "-nonotify"))
759 {
760 notify = TB_FALSE;
761 }
762 else if (mutt_str_equal(buf_string(buf), "-poll"))
763 {
764 poll = TB_TRUE;
765 }
766 else if (mutt_str_equal(buf_string(buf), "-nopoll"))
767 {
768 poll = TB_FALSE;
769 }
770 else if ((data & MUTT_NAMED) && !label_set)
771 {
772 if (!MoreArgs(s))
773 {
774 buf_printf(err, _("%s: too few arguments"), "named-mailboxes");
775 goto done;
776 }
777
778 buf_copy(label, buf);
779 label_set = true;
780 }
781 else
782 {
783 buf_copy(mailbox, buf);
784 break;
785 }
786 } while (MoreArgs(s));
787
788 if (buf_is_empty(mailbox))
789 {
790 buf_printf(err, _("%s: too few arguments"), "mailboxes");
791 goto done;
792 }
793
794 rc = mailbox_add(c_folder, buf_string(mailbox),
795 label_set ? buf_string(label) : NULL, poll, notify, err);
796 if (rc != MUTT_CMD_SUCCESS)
797 goto done;
798
799 buf_reset(label);
800 buf_reset(mailbox);
801 }
802
803 rc = MUTT_CMD_SUCCESS;
804
805done:
806 buf_pool_release(&label);
807 buf_pool_release(&mailbox);
808 return rc;
809}
810
814enum CommandResult parse_my_hdr(struct Buffer *buf, struct Buffer *s,
815 intptr_t data, struct Buffer *err)
816{
818 char *p = strpbrk(buf->data, ": \t");
819 if (!p || (*p != ':'))
820 {
821 buf_strcpy(err, _("invalid header field"));
822 return MUTT_CMD_WARNING;
823 }
824
825 struct EventHeader ev_h = { buf->data };
826 struct ListNode *n = header_find(&UserHeader, buf->data);
827
828 if (n)
829 {
830 header_update(n, buf->data);
831 mutt_debug(LL_NOTIFY, "NT_HEADER_CHANGE: %s\n", buf->data);
833 }
834 else
835 {
836 header_add(&UserHeader, buf->data);
837 mutt_debug(LL_NOTIFY, "NT_HEADER_ADD: %s\n", buf->data);
839 }
840
841 return MUTT_CMD_SUCCESS;
842}
843
854{
855 struct Buffer *tempfile = buf_pool_get();
856 buf_mktemp(tempfile);
857
858 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
859 if (!fp_out)
860 {
861 // L10N: '%s' is the file name of the temporary file
862 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
863 buf_pool_release(&tempfile);
864 return MUTT_CMD_ERROR;
865 }
866
867 dump_config(NeoMutt->sub->cs, flags, fp_out);
868
869 mutt_file_fclose(&fp_out);
870
871 struct PagerData pdata = { 0 };
872 struct PagerView pview = { &pdata };
873
874 pdata.fname = buf_string(tempfile);
875
876 pview.banner = "set";
878 pview.mode = PAGER_MODE_OTHER;
879
880 mutt_do_pager(&pview, NULL);
881 buf_pool_release(&tempfile);
882
883 return MUTT_CMD_SUCCESS;
884}
885
889static int envlist_sort(const void *a, const void *b, void *sdata)
890{
891 return strcmp(*(const char **) a, *(const char **) b);
892}
893
897static enum CommandResult parse_setenv(struct Buffer *buf, struct Buffer *s,
898 intptr_t data, struct Buffer *err)
899{
900 char **envp = EnvList;
901
902 bool query = false;
903 bool prefix = false;
904 bool unset = (data == MUTT_SET_UNSET);
905
906 if (!MoreArgs(s))
907 {
908 if (!StartupComplete)
909 {
910 buf_printf(err, _("%s: too few arguments"), "setenv");
911 return MUTT_CMD_WARNING;
912 }
913
914 struct Buffer *tempfile = buf_pool_get();
915 buf_mktemp(tempfile);
916
917 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
918 if (!fp_out)
919 {
920 // L10N: '%s' is the file name of the temporary file
921 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
922 buf_pool_release(&tempfile);
923 return MUTT_CMD_ERROR;
924 }
925
926 int count = 0;
927 for (char **env = EnvList; *env; env++)
928 count++;
929
930 mutt_qsort_r(EnvList, count, sizeof(char *), envlist_sort, NULL);
931
932 for (char **env = EnvList; *env; env++)
933 fprintf(fp_out, "%s\n", *env);
934
935 mutt_file_fclose(&fp_out);
936
937 struct PagerData pdata = { 0 };
938 struct PagerView pview = { &pdata };
939
940 pdata.fname = buf_string(tempfile);
941
942 pview.banner = "setenv";
944 pview.mode = PAGER_MODE_OTHER;
945
946 mutt_do_pager(&pview, NULL);
947 buf_pool_release(&tempfile);
948
949 return MUTT_CMD_SUCCESS;
950 }
951
952 if (*s->dptr == '?')
953 {
954 query = true;
955 prefix = true;
956
957 if (unset)
958 {
959 buf_printf(err, _("Can't query option with the '%s' command"), "unsetenv");
960 return MUTT_CMD_WARNING;
961 }
962
963 s->dptr++;
964 }
965
966 /* get variable name */
968
969 if (*s->dptr == '?')
970 {
971 if (unset)
972 {
973 buf_printf(err, _("Can't query option with the '%s' command"), "unsetenv");
974 return MUTT_CMD_WARNING;
975 }
976
977 if (prefix)
978 {
979 buf_printf(err, _("Can't use a prefix when querying a variable"));
980 return MUTT_CMD_WARNING;
981 }
982
983 query = true;
984 s->dptr++;
985 }
986
987 if (query)
988 {
989 bool found = false;
990 while (envp && *envp)
991 {
992 /* This will display all matches for "^QUERY" */
993 if (mutt_str_startswith(*envp, buf->data))
994 {
995 if (!found)
996 {
997 mutt_endwin();
998 found = true;
999 }
1000 puts(*envp);
1001 }
1002 envp++;
1003 }
1004
1005 if (found)
1006 {
1008 return MUTT_CMD_SUCCESS;
1009 }
1010
1011 buf_printf(err, _("%s is unset"), buf->data);
1012 return MUTT_CMD_WARNING;
1013 }
1014
1015 if (unset)
1016 {
1017 if (!envlist_unset(&EnvList, buf->data))
1018 {
1019 buf_printf(err, _("%s is unset"), buf->data);
1020 return MUTT_CMD_WARNING;
1021 }
1022 return MUTT_CMD_SUCCESS;
1023 }
1024
1025 /* set variable */
1026
1027 if (*s->dptr == '=')
1028 {
1029 s->dptr++;
1030 SKIPWS(s->dptr);
1031 }
1032
1033 if (!MoreArgs(s))
1034 {
1035 buf_printf(err, _("%s: too few arguments"), "setenv");
1036 return MUTT_CMD_WARNING;
1037 }
1038
1039 char *name = mutt_str_dup(buf->data);
1041 envlist_set(&EnvList, name, buf->data, true);
1042 FREE(&name);
1043
1044 return MUTT_CMD_SUCCESS;
1045}
1046
1050static enum CommandResult parse_source(struct Buffer *buf, struct Buffer *s,
1051 intptr_t data, struct Buffer *err)
1052{
1053 char path[PATH_MAX] = { 0 };
1054
1055 do
1056 {
1057 if (parse_extract_token(buf, s, TOKEN_NO_FLAGS) != 0)
1058 {
1059 buf_printf(err, _("source: error at %s"), s->dptr);
1060 return MUTT_CMD_ERROR;
1061 }
1062 mutt_str_copy(path, buf->data, sizeof(path));
1063 mutt_expand_path(path, sizeof(path));
1064
1065 if (source_rc(path, err) < 0)
1066 {
1067 buf_printf(err, _("source: file %s could not be sourced"), path);
1068 return MUTT_CMD_ERROR;
1069 }
1070
1071 } while (MoreArgs(s));
1072
1073 return MUTT_CMD_SUCCESS;
1074}
1075
1079static enum CommandResult parse_nospam(struct Buffer *buf, struct Buffer *s,
1080 intptr_t data, struct Buffer *err)
1081{
1082 if (!MoreArgs(s))
1083 {
1084 buf_printf(err, _("%s: too few arguments"), "nospam");
1085 return MUTT_CMD_ERROR;
1086 }
1087
1088 // Extract the first token, a regex or "*"
1090
1091 if (MoreArgs(s))
1092 {
1093 buf_printf(err, _("%s: too many arguments"), "finish");
1094 return MUTT_CMD_ERROR;
1095 }
1096
1097 // "*" is special - clear both spam and nospam lists
1098 if (mutt_str_equal(buf_string(buf), "*"))
1099 {
1102 return MUTT_CMD_SUCCESS;
1103 }
1104
1105 // If it's on the spam list, just remove it
1107 return MUTT_CMD_SUCCESS;
1108
1109 // Otherwise, add it to the nospam list
1110 if (mutt_regexlist_add(&NoSpamList, buf_string(buf), REG_ICASE, err) != 0)
1111 return MUTT_CMD_ERROR;
1112
1113 return MUTT_CMD_SUCCESS;
1114}
1115
1119static enum CommandResult parse_spam(struct Buffer *buf, struct Buffer *s,
1120 intptr_t data, struct Buffer *err)
1121{
1122 if (!MoreArgs(s))
1123 {
1124 buf_printf(err, _("%s: too few arguments"), "spam");
1125 return MUTT_CMD_ERROR;
1126 }
1127
1128 // Extract the first token, a regex
1130
1131 // If there's a second parameter, it's a template for the spam tag
1132 if (MoreArgs(s))
1133 {
1134 struct Buffer *templ = buf_pool_get();
1136
1137 // Add to the spam list
1138 int rc = mutt_replacelist_add(&SpamList, buf_string(buf), buf_string(templ), err);
1139 buf_pool_release(&templ);
1140 if (rc != 0)
1141 return MUTT_CMD_ERROR;
1142 }
1143 else
1144 {
1145 // If not, try to remove from the nospam list
1147 }
1148
1149 return MUTT_CMD_SUCCESS;
1150}
1151
1157static enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s,
1158 intptr_t data, struct Buffer *err)
1159{
1160 do
1161 {
1163 add_to_stailq((struct ListHead *) data, buf->data);
1164 } while (MoreArgs(s));
1165
1166 return MUTT_CMD_SUCCESS;
1167}
1168
1172static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
1173 intptr_t data, struct Buffer *err)
1174{
1175 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
1176
1177 do
1178 {
1180
1181 if (parse_grouplist(&gl, buf, s, err) == -1)
1182 goto bail;
1183
1186
1187 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
1188 goto bail;
1189 if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
1190 goto bail;
1191 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
1192 goto bail;
1193 } while (MoreArgs(s));
1194
1196 return MUTT_CMD_SUCCESS;
1197
1198bail:
1200 return MUTT_CMD_ERROR;
1201}
1202
1210enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s,
1211 intptr_t data, struct Buffer *err)
1212{
1213 if (!buf || !s || !err)
1214 return MUTT_CMD_ERROR;
1215
1216 buf_reset(err);
1217
1218 if (MoreArgs(s))
1219 {
1221
1222 if (MoreArgs(s))
1223 {
1224 buf_printf(err, _("%s: too many arguments"), "subscribe-to");
1225 return MUTT_CMD_WARNING;
1226 }
1227
1228 if (!buf_is_empty(buf))
1229 {
1230 /* Expand and subscribe */
1231 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), true) == 0)
1232 {
1233 mutt_message(_("Subscribed to %s"), buf->data);
1234 return MUTT_CMD_SUCCESS;
1235 }
1236
1237 buf_printf(err, _("Could not subscribe to %s"), buf->data);
1238 return MUTT_CMD_ERROR;
1239 }
1240
1241 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1242 return MUTT_CMD_ERROR;
1243 }
1244
1245 buf_addstr(err, _("No folder specified"));
1246 return MUTT_CMD_WARNING;
1247}
1248
1256static enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s,
1257 intptr_t data, struct Buffer *err)
1258{
1259 if (!s)
1260 return MUTT_CMD_ERROR;
1261
1262 struct Buffer *tagbuf = buf_pool_get();
1263 struct Buffer *fmtbuf = buf_pool_get();
1264
1265 while (MoreArgs(s))
1266 {
1268 const char *tag = buf_string(tagbuf);
1269 if (*tag == '\0')
1270 continue;
1271
1273 const char *fmt = buf_string(fmtbuf);
1274
1275 /* avoid duplicates */
1276 const char *tmp = mutt_hash_find(TagFormats, fmt);
1277 if (tmp)
1278 {
1279 mutt_warning(_("tag format '%s' already registered as '%s'"), fmt, tmp);
1280 continue;
1281 }
1282
1284 }
1285
1286 buf_pool_release(&tagbuf);
1287 buf_pool_release(&fmtbuf);
1288 return MUTT_CMD_SUCCESS;
1289}
1290
1298static enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s,
1299 intptr_t data, struct Buffer *err)
1300{
1301 if (!s)
1302 return MUTT_CMD_ERROR;
1303
1304 struct Buffer *tagbuf = buf_pool_get();
1305 struct Buffer *trnbuf = buf_pool_get();
1306
1307 while (MoreArgs(s))
1308 {
1310 const char *tag = buf_string(tagbuf);
1311 if (*tag == '\0')
1312 continue;
1313
1315 const char *trn = buf_string(trnbuf);
1316
1317 /* avoid duplicates */
1318 const char *tmp = mutt_hash_find(TagTransforms, tag);
1319 if (tmp)
1320 {
1321 mutt_warning(_("tag transform '%s' already registered as '%s'"), tag, tmp);
1322 continue;
1323 }
1324
1326 }
1327
1328 buf_pool_release(&tagbuf);
1329 buf_pool_release(&trnbuf);
1330 return MUTT_CMD_SUCCESS;
1331}
1332
1336static enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s,
1337 intptr_t data, struct Buffer *err)
1338{
1339 do
1340 {
1342
1343 /* don't add "*" to the unignore list */
1344 if (!mutt_str_equal(buf->data, "*"))
1345 add_to_stailq(&UnIgnore, buf->data);
1346
1348 } while (MoreArgs(s));
1349
1350 return MUTT_CMD_SUCCESS;
1351}
1352
1356static enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s,
1357 intptr_t data, struct Buffer *err)
1358{
1360 do
1361 {
1365
1366 if (!mutt_str_equal(buf->data, "*") &&
1367 (mutt_regexlist_add(&UnMailLists, buf->data, REG_ICASE, err) != 0))
1368 {
1369 return MUTT_CMD_ERROR;
1370 }
1371 } while (MoreArgs(s));
1372
1373 return MUTT_CMD_SUCCESS;
1374}
1375
1380static void do_unmailboxes(struct Mailbox *m)
1381{
1382#ifdef USE_INOTIFY
1383 if (m->poll_new_mail)
1385#endif
1386 m->visible = false;
1387 m->gen = -1;
1388 if (m->opened)
1389 {
1390 struct EventMailbox ev_m = { NULL };
1391 mutt_debug(LL_NOTIFY, "NT_MAILBOX_CHANGE: NULL\n");
1393 }
1394 else
1395 {
1397 mailbox_free(&m);
1398 }
1399}
1400
1404static void do_unmailboxes_star(void)
1405{
1406 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
1408 struct MailboxNode *np = NULL;
1409 struct MailboxNode *nptmp = NULL;
1410 STAILQ_FOREACH_SAFE(np, &ml, entries, nptmp)
1411 {
1413 }
1415}
1416
1422enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s,
1423 intptr_t data, struct Buffer *err)
1424{
1425 while (MoreArgs(s))
1426 {
1428
1429 if (mutt_str_equal(buf->data, "*"))
1430 {
1432 return MUTT_CMD_SUCCESS;
1433 }
1434
1435 buf_expand_path(buf);
1436
1437 struct Account *a = NULL;
1438 TAILQ_FOREACH(a, &NeoMutt->accounts, entries)
1439 {
1440 struct Mailbox *m = mx_mbox_find(a, buf_string(buf));
1441 if (m)
1442 {
1443 do_unmailboxes(m);
1444 break;
1445 }
1446 }
1447 }
1448 return MUTT_CMD_SUCCESS;
1449}
1450
1454static enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s,
1455 intptr_t data, struct Buffer *err)
1456{
1457 struct ListNode *np = NULL, *tmp = NULL;
1458 size_t l;
1459
1460 do
1461 {
1463 if (mutt_str_equal("*", buf->data))
1464 {
1465 /* Clear all headers, send a notification for each header */
1466 STAILQ_FOREACH(np, &UserHeader, entries)
1467 {
1468 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1469 struct EventHeader ev_h = { np->data };
1471 }
1473 continue;
1474 }
1475
1476 l = mutt_str_len(buf->data);
1477 if (buf->data[l - 1] == ':')
1478 l--;
1479
1480 STAILQ_FOREACH_SAFE(np, &UserHeader, entries, tmp)
1481 {
1482 if (mutt_istrn_equal(buf->data, np->data, l) && (np->data[l] == ':'))
1483 {
1484 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1485 struct EventHeader ev_h = { np->data };
1487
1488 header_free(&UserHeader, np);
1489 }
1490 }
1491 } while (MoreArgs(s));
1492 return MUTT_CMD_SUCCESS;
1493}
1494
1500static enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s,
1501 intptr_t data, struct Buffer *err)
1502{
1503 do
1504 {
1506 /* Check for deletion of entire list */
1507 if (mutt_str_equal(buf->data, "*"))
1508 {
1509 mutt_list_free((struct ListHead *) data);
1510 break;
1511 }
1512 remove_from_stailq((struct ListHead *) data, buf->data);
1513 } while (MoreArgs(s));
1514
1515 return MUTT_CMD_SUCCESS;
1516}
1517
1521static enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s,
1522 intptr_t data, struct Buffer *err)
1523{
1525 do
1526 {
1529
1530 if (!mutt_str_equal(buf->data, "*") &&
1531 (mutt_regexlist_add(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0))
1532 {
1533 return MUTT_CMD_ERROR;
1534 }
1535 } while (MoreArgs(s));
1536
1537 return MUTT_CMD_SUCCESS;
1538}
1539
1548 intptr_t data, struct Buffer *err)
1549{
1550 if (!buf || !s || !err)
1551 return MUTT_CMD_ERROR;
1552
1553 if (MoreArgs(s))
1554 {
1556
1557 if (MoreArgs(s))
1558 {
1559 buf_printf(err, _("%s: too many arguments"), "unsubscribe-from");
1560 return MUTT_CMD_WARNING;
1561 }
1562
1563 if (buf->data && (*buf->data != '\0'))
1564 {
1565 /* Expand and subscribe */
1566 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), false) == 0)
1567 {
1568 mutt_message(_("Unsubscribed from %s"), buf->data);
1569 return MUTT_CMD_SUCCESS;
1570 }
1571
1572 buf_printf(err, _("Could not unsubscribe from %s"), buf->data);
1573 return MUTT_CMD_ERROR;
1574 }
1575
1576 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1577 return MUTT_CMD_ERROR;
1578 }
1579
1580 buf_addstr(err, _("No folder specified"));
1581 return MUTT_CMD_WARNING;
1582}
1583
1587static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s,
1588 intptr_t data, struct Buffer *err)
1589{
1590 // silently ignore 'version' if it's in a config file
1591 if (!StartupComplete)
1592 return MUTT_CMD_SUCCESS;
1593
1594 struct Buffer *tempfile = buf_pool_get();
1595 buf_mktemp(tempfile);
1596
1597 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
1598 if (!fp_out)
1599 {
1600 // L10N: '%s' is the file name of the temporary file
1601 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
1602 buf_pool_release(&tempfile);
1603 return MUTT_CMD_ERROR;
1604 }
1605
1606 print_version(fp_out);
1607 mutt_file_fclose(&fp_out);
1608
1609 struct PagerData pdata = { 0 };
1610 struct PagerView pview = { &pdata };
1611
1612 pdata.fname = buf_string(tempfile);
1613
1614 pview.banner = "version";
1615 pview.flags = MUTT_PAGER_NO_FLAGS;
1616 pview.mode = PAGER_MODE_OTHER;
1617
1618 mutt_do_pager(&pview, NULL);
1619 buf_pool_release(&tempfile);
1620
1621 return MUTT_CMD_SUCCESS;
1622}
1623
1628{
1630}
1631
1635static const struct Command MuttCommands[] = {
1636 // clang-format off
1637 { "alias", parse_alias, 0 },
1638 { "alternates", parse_alternates, 0 },
1639 { "alternative_order", parse_stailq, IP &AlternativeOrderList },
1640 { "attachments", parse_attachments, 0 },
1641 { "auto_view", parse_stailq, IP &AutoViewList },
1642 { "bind", mutt_parse_bind, 0 },
1643 { "cd", parse_cd, 0 },
1644 { "color", mutt_parse_color, 0 },
1645 { "echo", parse_echo, 0 },
1646 { "exec", mutt_parse_exec, 0 },
1647 { "finish", parse_finish, 0 },
1648 { "group", parse_group, MUTT_GROUP },
1649 { "hdr_order", parse_stailq, IP &HeaderOrderList },
1650 { "ifdef", parse_ifdef, 0 },
1651 { "ifndef", parse_ifdef, 1 },
1652 { "ignore", parse_ignore, 0 },
1653 { "lists", parse_lists, 0 },
1654 { "macro", mutt_parse_macro, 1 },
1655 { "mailboxes", parse_mailboxes, 0 },
1656 { "mailto_allow", parse_stailq, IP &MailToAllow },
1657 { "mime_lookup", parse_stailq, IP &MimeLookupList },
1658 { "mono", mutt_parse_mono, 0 },
1659 { "my_hdr", parse_my_hdr, 0 },
1660 { "named-mailboxes", parse_mailboxes, MUTT_NAMED },
1661 { "nospam", parse_nospam, 0 },
1662 { "push", mutt_parse_push, 0 },
1663 { "reset", parse_set, MUTT_SET_RESET },
1664 { "score", mutt_parse_score, 0 },
1665 { "set", parse_set, MUTT_SET_SET },
1666 { "setenv", parse_setenv, MUTT_SET_SET },
1667 { "source", parse_source, 0 },
1668 { "spam", parse_spam, 0 },
1669 { "subjectrx", parse_subjectrx_list, 0 },
1670 { "subscribe", parse_subscribe, 0 },
1671 { "tag-formats", parse_tag_formats, 0 },
1672 { "tag-transforms", parse_tag_transforms, 0 },
1673 { "toggle", parse_set, MUTT_SET_INV },
1674 { "unalias", parse_unalias, 0 },
1675 { "unalternates", parse_unalternates, 0 },
1676 { "unalternative_order", parse_unstailq, IP &AlternativeOrderList },
1677 { "unattachments", parse_unattachments, 0 },
1678 { "unauto_view", parse_unstailq, IP &AutoViewList },
1679 { "unbind", mutt_parse_unbind, MUTT_UNBIND },
1680 { "uncolor", mutt_parse_uncolor, 0 },
1681 { "ungroup", parse_group, MUTT_UNGROUP },
1682 { "unhdr_order", parse_unstailq, IP &HeaderOrderList },
1683 { "unignore", parse_unignore, 0 },
1684 { "unlists", parse_unlists, 0 },
1685 { "unmacro", mutt_parse_unbind, MUTT_UNMACRO },
1686 { "unmailboxes", parse_unmailboxes, 0 },
1687 { "unmailto_allow", parse_unstailq, IP &MailToAllow },
1688 { "unmime_lookup", parse_unstailq, IP &MimeLookupList },
1689 { "unmono", mutt_parse_unmono, 0 },
1690 { "unmy_hdr", parse_unmy_hdr, 0 },
1691 { "unscore", mutt_parse_unscore, 0 },
1692 { "unset", parse_set, MUTT_SET_UNSET },
1693 { "unsetenv", parse_setenv, MUTT_SET_UNSET },
1694 { "unsubjectrx", parse_unsubjectrx_list, 0 },
1695 { "unsubscribe", parse_unsubscribe, 0 },
1696 { "version", parse_version, 0 },
1697 // clang-format on
1698};
1699
1704{
1706}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1464
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:644
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.
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:178
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:93
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:308
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:243
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:412
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:618
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:588
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:97
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:1635
enum CommandResult set_dump(ConfigDumpFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
Definition: commands.c:853
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:615
GroupState
Type of email address group.
Definition: commands.c:94
@ GS_RX
Entry is a regular expression.
Definition: commands.c:96
@ GS_NONE
Group is missing an argument.
Definition: commands.c:95
@ GS_ADDR
Entry is an address.
Definition: commands.c:97
#define MAX_ERRS
Definition: commands.c:78
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:164
void commands_init(void)
Initialize commands array and register default commands.
Definition: commands.c:1703
int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err)
Parse a group context.
Definition: commands.c:130
void source_stack_cleanup(void)
Free memory from the stack used for the source command.
Definition: commands.c:1627
static void do_unmailboxes_star(void)
Remove all Mailboxes from the Sidebar/notifications.
Definition: commands.c:1404
static struct ListHead MuttrcStack
LIFO designed to contain the list of config files that have been sourced and avoid cyclic sourcing.
Definition: commands.c:76
TriBool
Tri-state boolean.
Definition: commands.c:84
@ TB_FALSE
Value is false.
Definition: commands.c:86
@ TB_TRUE
Value is true.
Definition: commands.c:87
@ TB_UNSET
Value hasn't been set.
Definition: commands.c:85
static void do_unmailboxes(struct Mailbox *m)
Remove a Mailbox from the Sidebar/notifications.
Definition: commands.c:1380
int source_rc(const char *rcfile_path, struct Buffer *err)
Read an initialization file.
Definition: commands.c:205
char * mutt_get_sourced_cwd(void)
Get the current file path that is being parsed.
Definition: commands.c:184
static bool is_function(const char *name)
Is the argument a neomutt function?
Definition: commands.c:106
Functions to parse commands in a config file.
#define MUTT_NAMED
Definition: commands.h:35
bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
Definition: dump.c:167
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:38
bool StartupComplete
When the config has been read.
Definition: main.c:191
#define IP
Definition: set.h:54
const char * cc_charset(void)
Get the cached value of $charset.
Definition: config_cache.c:116
bool account_mailbox_remove(struct Account *a, struct Mailbox *m)
Remove a Mailbox from an Account.
Definition: account.c:98
struct Account * account_new(const char *name, struct ConfigSubset *sub)
Create a new Account.
Definition: account.c:44
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 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:173
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:42
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h:44
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition: curs_lib.c:175
void mutt_endwin(void)
Shutdown curses.
Definition: curs_lib.c:153
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:208
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:166
struct ListNode * header_update(struct ListNode *hdr, const char *header)
Update an existing header.
Definition: email.c:180
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:143
struct ReplaceList SpamList
List of regexes to match subscribed mailing lists.
Definition: globals.c:46
struct RegexList SubscribedLists
List of header patterns to unignore (see)
Definition: globals.c:48
struct HashTable * AutoSubscribeCache
< Hash Table: "mailto:" -> AutoSubscribeCache
Definition: globals.c:36
struct RegexList UnSubscribedLists
Definition: globals.c:54
struct RegexList UnMailLists
List of regexes to exclude false matches in SubscribedLists.
Definition: globals.c:52
struct RegexList MailLists
List of permitted fields in a mailto: url.
Definition: globals.c:40
struct ListHead MailToAllow
List of regexes to identify non-spam emails.
Definition: globals.c:42
struct ListHead Ignore
List of regexes to match mailing lists.
Definition: globals.c:38
struct RegexList NoSpamList
List of regexes and patterns to match spam emails.
Definition: globals.c:44
struct ListHead UnIgnore
List of regexes to exclude false matches in MailLists.
Definition: globals.c:50
Structs that make up an email.
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:178
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:176
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:177
bool envlist_set(char ***envp, const char *name, const char *value, bool overwrite)
Set an environment variable.
Definition: envlist.c:88
bool envlist_unset(char ***envp, const char *name)
Unset an environment variable.
Definition: envlist.c:136
int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: extract.c:50
#define TOKEN_SPACE
Don't treat whitespace as a term.
Definition: extract.h:49
#define TOKEN_QUOTE
Don't interpret quotes.
Definition: extract.h:50
#define TOKEN_EQUAL
Treat '=' as a special.
Definition: extract.h:47
#define MoreArgs(buf)
Definition: extract.h:32
#define TOKEN_QUESTION
Treat '?' as a special.
Definition: extract.h:56
#define TOKEN_NO_FLAGS
No flags are set.
Definition: extract.h:46
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:801
#define MUTT_RL_CONT
-continuation
Definition: file.h:41
#define mutt_file_fclose(FP)
Definition: file.h:148
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:147
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:219
struct ListHead MimeLookupList
List of mime types that that shouldn't use the mailcap entry.
Definition: globals.c:51
struct ListHead AlternativeOrderList
List of preferred mime types to display.
Definition: globals.c:48
struct ListHead AutoViewList
List of mime types to auto view.
Definition: globals.c:49
bool OptForceRefresh
(pseudo) refresh even during macros
Definition: globals.c:65
struct ListHead UserHeader
List of custom headers to add to outgoing emails.
Definition: globals.c:54
struct ListHead HeaderOrderList
List of header fields in the order they should be displayed.
Definition: globals.c:50
char ** EnvList
Private copy of the environment variables.
Definition: globals.c:78
Global variables.
int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *al)
Remove an AddressList from a GroupList.
Definition: group.c:291
void mutt_grouplist_add(struct GroupList *gl, struct Group *group)
Add a Group to a GroupList.
Definition: group.c:183
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:322
struct Group * mutt_pattern_group(const char *pat)
Match a pattern to a Group.
Definition: group.c:118
int mutt_grouplist_remove_regex(struct GroupList *gl, const char *s)
Remove matching addresses from a GroupList.
Definition: group.c:347
void mutt_grouplist_destroy(struct GroupList *gl)
Free a GroupList.
Definition: group.c:203
void mutt_grouplist_clear(struct GroupList *gl)
Clear a GroupList.
Definition: group.c:149
void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *al)
Add Address list to a GroupList.
Definition: group.c:272
#define MUTT_GROUP
'group' config command
Definition: group.h:32
#define MUTT_UNGROUP
'ungroup' config command
Definition: group.h:33
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:407
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:1157
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:1587
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:1356
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:422
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:425
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:1119
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:200
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:498
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:1500
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:1547
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:1336
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:522
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:1050
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:90
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:1422
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:1454
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:530
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:508
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:1172
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:1298
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:477
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:353
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:567
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:1210
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:135
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:251
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:718
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:1256
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:535
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:583
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:383
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:814
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:1521
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:897
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:476
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:1079
#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:889
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:1222
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition: lib.c:528
Manage keymappings.
#define MUTT_UNBIND
Parse 'unbind' command.
Definition: lib.h:47
#define MUTT_UNMACRO
Parse 'unmacro' command.
Definition: lib.h:48
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
#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:483
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Definition: monitor.c:527
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:830
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Definition: charset.h:72
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:332
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
Definition: path.c:472
int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat)
Remove a pattern from a list.
Definition: regex.c:591
void mutt_regexlist_free(struct RegexList *rl)
Free a RegexList object.
Definition: regex.c:179
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:140
void mutt_replacelist_free(struct ReplaceList *rl)
Free a ReplaceList object.
Definition: regex.c:475
int mutt_regexlist_remove(struct RegexList *rl, const char *str)
Remove a Regex from a list.
Definition: regex.c:235
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:271
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:721
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
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:230
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:545
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:630
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:502
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:329
Many unsorted constants and some structs.
#define PATH_MAX
Definition: mutt.h:42
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1715
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1690
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:126
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1421
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:331
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1279
Some miscellaneous functions.
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1541
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1721
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1517
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1469
API for mailboxes.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:163
bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
Add an Account to the global list.
Definition: neomutt.c:105
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:186
@ 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:60
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:142
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:67
#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:129
#define NONULL(x)
Definition: string2.h:37
#define SKIPWS(ch)
Definition: string2.h:45
A group of associated Mailboxes.
Definition: account.h:36
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:37
char * name
Name of Account.
Definition: account.h:38
struct Notify * notify
Notifications: NotifyAccount, EventAccount.
Definition: account.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: account.h:39
String manipulation buffer.
Definition: buffer.h:36
char * dptr
Current read/write position.
Definition: buffer.h:38
size_t dsize
Length of data.
Definition: buffer.h:39
char * data
Pointer to data.
Definition: buffer.h:37
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
An event that happened to a header.
Definition: email.h:185
An Event that happened to a Mailbox.
Definition: mailbox.h:187
A List node for strings.
Definition: list.h:35
char * data
String.
Definition: list.h:36
List of Mailboxes.
Definition: mailbox.h:154
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:155
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:115
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition: mailbox.h:145
bool notify_user
Notify the user of new mail.
Definition: mailbox.h:113
struct Buffer pathbuf
Path of the Mailbox.
Definition: mailbox.h:80
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:127
bool visible
True if a result of "mailboxes".
Definition: mailbox.h:130
int opened
Number of times mailbox is opened.
Definition: mailbox.h:128
int gen
Generation number, for sorting.
Definition: mailbox.h:147
const char * name
String value.
Definition: mapping.h:34
Mapping between a function and an operation.
Definition: lib.h:101
const char * name
Name of the function.
Definition: lib.h:102
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:161
const char * fname
Name of the file to read.
Definition: lib.h:165
Paged view into some data.
Definition: lib.h:172
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:173
enum PagerMode mode
Pager mode.
Definition: lib.h:174
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:175
const char * banner
Title to display in status bar.
Definition: lib.h:176
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition: subset.c:108
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition: subset.c:187
struct HashTable * TagFormats
Hash Table: "inbox" -> "GI" - Tag format strings.
Definition: tags.c:42
struct HashTable * TagTransforms
Hash Table: "inbox" -> "i" - Alternative tag names.
Definition: tags.c:41
#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:393
bool feature_enabled(const char *name)
Test if a compile-time feature is enabled.
Definition: version.c:545
Display version and copyright about NeoMutt.