NeoMutt  2024-04-25-76-g20fe7b
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 <sys/types.h>
44#include <unistd.h>
45#include "mutt/lib.h"
46#include "address/lib.h"
47#include "config/lib.h"
48#include "email/lib.h"
49#include "core/lib.h"
50#include "alias/lib.h"
51#include "gui/lib.h"
52#include "mutt.h"
53#include "commands.h"
54#include "attach/lib.h"
55#include "color/lib.h"
56#include "imap/lib.h"
57#include "key/lib.h"
58#include "menu/lib.h"
59#include "pager/lib.h"
60#include "parse/lib.h"
61#include "store/lib.h"
62#include "alternates.h"
63#include "globals.h"
64#include "muttlib.h"
65#include "mx.h"
66#include "score.h"
67#include "version.h"
68#ifdef USE_INOTIFY
69#include "monitor.h"
70#endif
71#ifdef ENABLE_NLS
72#include <libintl.h>
73#endif
74
78
79#define MAX_ERRS 128
80
85{
86 TB_UNSET = -1,
89};
90
95{
99};
100
107static bool is_function(const char *name)
108{
109 for (size_t i = 0; MenuNames[i].name; i++)
110 {
111 const struct MenuFuncOp *fns = km_get_table(MenuNames[i].value);
112 if (!fns)
113 continue;
114
115 for (int j = 0; fns[j].name; j++)
116 if (mutt_str_equal(name, fns[j].name))
117 return true;
118 }
119 return false;
120}
121
131int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s,
132 struct Buffer *err)
133{
134 while (mutt_istr_equal(buf->data, "-group"))
135 {
136 if (!MoreArgs(s))
137 {
138 buf_strcpy(err, _("-group: no group name"));
139 return -1;
140 }
141
143
145
146 if (!MoreArgs(s))
147 {
148 buf_strcpy(err, _("out of arguments"));
149 return -1;
150 }
151
153 }
154
155 return 0;
156}
157
165enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer *err)
166{
168
169 enum CommandResult ret = parse_rc_line(line, err);
170
171 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
173 FREE(&np->data);
174 FREE(&np);
175
176 return ret;
177}
178
186{
187 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
188 if (np && np->data)
189 return mutt_str_dup(np->data);
190
191 // stack is empty, return our own dummy file relative to cwd
192 struct Buffer *cwd = buf_pool_get();
193 mutt_path_getcwd(cwd);
194 buf_addstr(cwd, "/dummy.rc");
195 char *ret = buf_strdup(cwd);
196 buf_pool_release(&cwd);
197 return ret;
198}
199
206int source_rc(const char *rcfile_path, struct Buffer *err)
207{
208 int lineno = 0, rc = 0, warnings = 0;
209 enum CommandResult line_rc;
210 struct Buffer *token = NULL, *linebuf = NULL;
211 char *line = NULL;
212 char *currentline = NULL;
213 char rcfile[PATH_MAX] = { 0 };
214 size_t linelen = 0;
215 pid_t pid;
216
217 mutt_str_copy(rcfile, rcfile_path, sizeof(rcfile));
218
219 size_t rcfilelen = mutt_str_len(rcfile);
220 if (rcfilelen == 0)
221 return -1;
222
223 bool ispipe = rcfile[rcfilelen - 1] == '|';
224
225 if (!ispipe)
226 {
227 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
228 if (!mutt_path_to_absolute(rcfile, np ? NONULL(np->data) : ""))
229 {
230 mutt_error(_("Error: Can't build path of '%s'"), rcfile_path);
231 return -1;
232 }
233
234 STAILQ_FOREACH(np, &MuttrcStack, entries)
235 {
236 if (mutt_str_equal(np->data, rcfile))
237 {
238 break;
239 }
240 }
241 if (np)
242 {
243 mutt_error(_("Error: Cyclic sourcing of configuration file '%s'"), rcfile);
244 return -1;
245 }
246
248 }
249
250 mutt_debug(LL_DEBUG2, "Reading configuration file '%s'\n", rcfile);
251
252 FILE *fp = mutt_open_read(rcfile, &pid);
253 if (!fp)
254 {
255 buf_printf(err, "%s: %s", rcfile, strerror(errno));
256 return -1;
257 }
258
259 token = buf_pool_get();
260 linebuf = buf_pool_get();
261
262 const char *const c_config_charset = cs_subset_string(NeoMutt->sub, "config_charset");
263 const char *const c_charset = cc_charset();
264 while ((line = mutt_file_read_line(line, &linelen, fp, &lineno, MUTT_RL_CONT)) != NULL)
265 {
266 const bool conv = c_config_charset && c_charset;
267 if (conv)
268 {
269 currentline = mutt_str_dup(line);
270 if (!currentline)
271 continue;
272 mutt_ch_convert_string(&currentline, c_config_charset, c_charset, MUTT_ICONV_NO_FLAGS);
273 }
274 else
275 {
276 currentline = line;
277 }
278
279 buf_strcpy(linebuf, currentline);
280
281 buf_reset(err);
282 line_rc = parse_rc_buffer(linebuf, token, err);
283 if (line_rc == MUTT_CMD_ERROR)
284 {
285 mutt_error("%s:%d: %s", rcfile, lineno, buf_string(err));
286 if (--rc < -MAX_ERRS)
287 {
288 if (conv)
289 FREE(&currentline);
290 break;
291 }
292 }
293 else if (line_rc == MUTT_CMD_WARNING)
294 {
295 /* Warning */
296 mutt_warning("%s:%d: %s", rcfile, lineno, buf_string(err));
297 warnings++;
298 }
299 else if (line_rc == MUTT_CMD_FINISH)
300 {
301 if (conv)
302 FREE(&currentline);
303 break; /* Found "finish" command */
304 }
305 else
306 {
307 if (rc < 0)
308 rc = -1;
309 }
310 if (conv)
311 FREE(&currentline);
312 }
313
314 FREE(&line);
315 mutt_file_fclose(&fp);
316 if (pid != -1)
317 filter_wait(pid);
318
319 if (rc)
320 {
321 /* the neomuttrc source keyword */
322 buf_reset(err);
323 buf_printf(err, (rc >= -MAX_ERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
324 rcfile);
325 rc = -1;
326 }
327 else
328 {
329 /* Don't alias errors with warnings */
330 if (warnings > 0)
331 {
332 buf_printf(err, ngettext("source: %d warning in %s", "source: %d warnings in %s", warnings),
333 warnings, rcfile);
334 rc = -2;
335 }
336 }
337
338 if (!ispipe && !STAILQ_EMPTY(&MuttrcStack))
339 {
340 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
342 FREE(&np->data);
343 FREE(&np);
344 }
345
346 buf_pool_release(&token);
347 buf_pool_release(&linebuf);
348 return rc;
349}
350
354static enum CommandResult parse_cd(struct Buffer *buf, struct Buffer *s,
355 intptr_t data, struct Buffer *err)
356{
358 buf_expand_path(buf);
359 if (buf_is_empty(buf))
360 {
361 if (HomeDir)
362 {
363 buf_strcpy(buf, HomeDir);
364 }
365 else
366 {
367 buf_printf(err, _("%s: too few arguments"), "cd");
368 return MUTT_CMD_ERROR;
369 }
370 }
371
372 if (chdir(buf_string(buf)) != 0)
373 {
374 buf_printf(err, "cd: %s", strerror(errno));
375 return MUTT_CMD_ERROR;
376 }
377
378 return MUTT_CMD_SUCCESS;
379}
380
384static enum CommandResult parse_echo(struct Buffer *buf, struct Buffer *s,
385 intptr_t data, struct Buffer *err)
386{
387 if (!MoreArgs(s))
388 {
389 buf_printf(err, _("%s: too few arguments"), "echo");
390 return MUTT_CMD_WARNING;
391 }
393 OptForceRefresh = true;
394 mutt_message("%s", buf->data);
395 OptForceRefresh = false;
396 mutt_sleep(0);
397
398 return MUTT_CMD_SUCCESS;
399}
400
408static enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s,
409 intptr_t data, struct Buffer *err)
410{
411 if (MoreArgs(s))
412 {
413 buf_printf(err, _("%s: too many arguments"), "finish");
414 return MUTT_CMD_WARNING;
415 }
416
417 return MUTT_CMD_FINISH;
418}
419
423static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
424 intptr_t data, struct Buffer *err)
425{
426 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
427 enum GroupState gstate = GS_NONE;
428
429 do
430 {
432 if (parse_grouplist(&gl, buf, s, err) == -1)
433 goto bail;
434
435 if ((data == MUTT_UNGROUP) && mutt_istr_equal(buf->data, "*"))
436 {
438 goto out;
439 }
440
441 if (mutt_istr_equal(buf->data, "-rx"))
442 {
443 gstate = GS_RX;
444 }
445 else if (mutt_istr_equal(buf->data, "-addr"))
446 {
447 gstate = GS_ADDR;
448 }
449 else
450 {
451 switch (gstate)
452 {
453 case GS_NONE:
454 buf_printf(err, _("%sgroup: missing -rx or -addr"),
455 (data == MUTT_UNGROUP) ? "un" : "");
456 goto warn;
457
458 case GS_RX:
459 if ((data == MUTT_GROUP) &&
460 (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
461 {
462 goto bail;
463 }
464 else if ((data == MUTT_UNGROUP) &&
465 (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
466 {
467 goto bail;
468 }
469 break;
470
471 case GS_ADDR:
472 {
473 char *estr = NULL;
474 struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
475 mutt_addrlist_parse2(&al, buf->data);
476 if (TAILQ_EMPTY(&al))
477 goto bail;
478 if (mutt_addrlist_to_intl(&al, &estr))
479 {
480 buf_printf(err, _("%sgroup: warning: bad IDN '%s'"),
481 (data == 1) ? "un" : "", estr);
483 FREE(&estr);
484 goto bail;
485 }
486 if (data == MUTT_GROUP)
488 else if (data == MUTT_UNGROUP)
491 break;
492 }
493 }
494 }
495 } while (MoreArgs(s));
496
497out:
499 return MUTT_CMD_SUCCESS;
500
501bail:
503 return MUTT_CMD_ERROR;
504
505warn:
507 return MUTT_CMD_WARNING;
508}
509
523static enum CommandResult parse_ifdef(struct Buffer *buf, struct Buffer *s,
524 intptr_t data, struct Buffer *err)
525{
527
528 if (buf_is_empty(buf))
529 {
530 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
531 return MUTT_CMD_WARNING;
532 }
533
534 // is the item defined as:
535 bool res = cs_subset_lookup(NeoMutt->sub, buf->data) // a variable?
536 || feature_enabled(buf->data) // a compiled-in feature?
537 || is_function(buf->data) // a function?
538 || command_get(buf->data) // a command?
539#ifdef USE_HCACHE
540 || store_is_valid_backend(buf->data) // a store? (database)
541#endif
542 || mutt_str_getenv(buf->data); // an environment variable?
543
544 if (!MoreArgs(s))
545 {
546 buf_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
547 return MUTT_CMD_WARNING;
548 }
550
551 /* ifdef KNOWN_SYMBOL or ifndef UNKNOWN_SYMBOL */
552 if ((res && (data == 0)) || (!res && (data == 1)))
553 {
554 enum CommandResult rc = parse_rc_line(buf->data, err);
555 if (rc == MUTT_CMD_ERROR)
556 {
557 mutt_error(_("Error: %s"), buf_string(err));
558 return MUTT_CMD_ERROR;
559 }
560 return rc;
561 }
562 return MUTT_CMD_SUCCESS;
563}
564
568static enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s,
569 intptr_t data, struct Buffer *err)
570{
571 do
572 {
575 add_to_stailq(&Ignore, buf->data);
576 } while (MoreArgs(s));
577
578 return MUTT_CMD_SUCCESS;
579}
580
584static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
585 intptr_t data, struct Buffer *err)
586{
587 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
588
589 do
590 {
592
593 if (parse_grouplist(&gl, buf, s, err) == -1)
594 goto bail;
595
597
598 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
599 goto bail;
600
601 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
602 goto bail;
603 } while (MoreArgs(s));
604
606 return MUTT_CMD_SUCCESS;
607
608bail:
610 return MUTT_CMD_ERROR;
611}
612
623static enum CommandResult mailbox_add(const char *folder, const char *mailbox,
624 const char *label, enum TriBool poll,
625 enum TriBool notify, struct Buffer *err)
626{
627 mutt_debug(LL_DEBUG1, "Adding mailbox: '%s' label '%s', poll %s, notify %s\n",
628 mailbox, label ? label : "[NONE]",
629 (poll == TB_UNSET) ? "[UNSPECIFIED]" :
630 (poll == TB_TRUE) ? "true" :
631 "false",
632 (notify == TB_UNSET) ? "[UNSPECIFIED]" :
633 (notify == TB_TRUE) ? "true" :
634 "false");
635 struct Mailbox *m = mailbox_new();
636
637 buf_strcpy(&m->pathbuf, mailbox);
638 /* int rc = */ mx_path_canon2(m, folder);
639
640 if (m->type <= MUTT_UNKNOWN)
641 {
642 buf_printf(err, "Unknown Mailbox: %s", m->realpath);
643 mailbox_free(&m);
644 return MUTT_CMD_ERROR;
645 }
646
647 bool new_account = false;
648 struct Account *a = mx_ac_find(m);
649 if (!a)
650 {
651 a = account_new(NULL, NeoMutt->sub);
652 a->type = m->type;
653 new_account = true;
654 }
655
656 if (!new_account)
657 {
658 struct Mailbox *m_old = mx_mbox_find(a, m->realpath);
659 if (m_old)
660 {
661 if (!m_old->visible)
662 {
663 m_old->visible = true;
664 m_old->gen = mailbox_gen();
665 }
666
667 if (label)
668 mutt_str_replace(&m_old->name, label);
669
670 if (notify != TB_UNSET)
671 m_old->notify_user = notify;
672
673 if (poll != TB_UNSET)
674 m_old->poll_new_mail = poll;
675
676 struct EventMailbox ev_m = { m_old };
678
679 mailbox_free(&m);
680 return MUTT_CMD_SUCCESS;
681 }
682 }
683
684 if (label)
685 m->name = mutt_str_dup(label);
686
687 if (notify != TB_UNSET)
688 m->notify_user = notify;
689
690 if (poll != TB_UNSET)
691 m->poll_new_mail = poll;
692
693 if (!mx_ac_add(a, m))
694 {
695 mailbox_free(&m);
696 if (new_account)
697 {
698 cs_subset_free(&a->sub);
699 FREE(&a->name);
700 notify_free(&a->notify);
701 FREE(&a);
702 }
703 return MUTT_CMD_SUCCESS;
704 }
705
706 if (new_account)
707 {
709 }
710
711 // this is finally a visible mailbox in the sidebar and mailboxes list
712 m->visible = true;
713
714#ifdef USE_INOTIFY
716#endif
717
718 return MUTT_CMD_SUCCESS;
719}
720
727bool mailbox_add_simple(const char *mailbox, struct Buffer *err)
728{
729 enum CommandResult rc = mailbox_add("", mailbox, NULL, TB_UNSET, TB_UNSET, err);
730
731 return (rc == MUTT_CMD_SUCCESS);
732}
733
739enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s,
740 intptr_t data, struct Buffer *err)
741{
743
744 struct Buffer *label = buf_pool_get();
745 struct Buffer *mailbox = buf_pool_get();
746
747 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
748 while (MoreArgs(s))
749 {
750 bool label_set = false;
751 enum TriBool notify = TB_UNSET;
752 enum TriBool poll = TB_UNSET;
753
754 do
755 {
756 // Start by handling the options
758
759 if (mutt_str_equal(buf_string(buf), "-label"))
760 {
761 if (!MoreArgs(s))
762 {
763 buf_printf(err, _("%s: too few arguments"), "mailboxes -label");
764 goto done;
765 }
766
768 label_set = true;
769 }
770 else if (mutt_str_equal(buf_string(buf), "-nolabel"))
771 {
772 buf_reset(label);
773 label_set = true;
774 }
775 else if (mutt_str_equal(buf_string(buf), "-notify"))
776 {
777 notify = TB_TRUE;
778 }
779 else if (mutt_str_equal(buf_string(buf), "-nonotify"))
780 {
781 notify = TB_FALSE;
782 }
783 else if (mutt_str_equal(buf_string(buf), "-poll"))
784 {
785 poll = TB_TRUE;
786 }
787 else if (mutt_str_equal(buf_string(buf), "-nopoll"))
788 {
789 poll = TB_FALSE;
790 }
791 else if ((data & MUTT_NAMED) && !label_set)
792 {
793 if (!MoreArgs(s))
794 {
795 buf_printf(err, _("%s: too few arguments"), "named-mailboxes");
796 goto done;
797 }
798
799 buf_copy(label, buf);
800 label_set = true;
801 }
802 else
803 {
804 buf_copy(mailbox, buf);
805 break;
806 }
807 } while (MoreArgs(s));
808
809 if (buf_is_empty(mailbox))
810 {
811 buf_printf(err, _("%s: too few arguments"), "mailboxes");
812 goto done;
813 }
814
815 rc = mailbox_add(c_folder, buf_string(mailbox),
816 label_set ? buf_string(label) : NULL, poll, notify, err);
817 if (rc != MUTT_CMD_SUCCESS)
818 goto done;
819
820 buf_reset(label);
821 buf_reset(mailbox);
822 }
823
824 rc = MUTT_CMD_SUCCESS;
825
826done:
827 buf_pool_release(&label);
828 buf_pool_release(&mailbox);
829 return rc;
830}
831
835enum CommandResult parse_my_hdr(struct Buffer *buf, struct Buffer *s,
836 intptr_t data, struct Buffer *err)
837{
839 char *p = strpbrk(buf->data, ": \t");
840 if (!p || (*p != ':'))
841 {
842 buf_strcpy(err, _("invalid header field"));
843 return MUTT_CMD_WARNING;
844 }
845
846 struct EventHeader ev_h = { buf->data };
847 struct ListNode *n = header_find(&UserHeader, buf->data);
848
849 if (n)
850 {
851 header_update(n, buf->data);
852 mutt_debug(LL_NOTIFY, "NT_HEADER_CHANGE: %s\n", buf->data);
854 }
855 else
856 {
857 header_add(&UserHeader, buf->data);
858 mutt_debug(LL_NOTIFY, "NT_HEADER_ADD: %s\n", buf->data);
860 }
861
862 return MUTT_CMD_SUCCESS;
863}
864
875{
876 struct Buffer *tempfile = buf_pool_get();
877 buf_mktemp(tempfile);
878
879 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
880 if (!fp_out)
881 {
882 // L10N: '%s' is the file name of the temporary file
883 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
884 buf_pool_release(&tempfile);
885 return MUTT_CMD_ERROR;
886 }
887
888 dump_config(NeoMutt->sub->cs, flags, fp_out);
889
890 mutt_file_fclose(&fp_out);
891
892 struct PagerData pdata = { 0 };
893 struct PagerView pview = { &pdata };
894
895 pdata.fname = buf_string(tempfile);
896
897 pview.banner = "set";
899 pview.mode = PAGER_MODE_OTHER;
900
901 mutt_do_pager(&pview, NULL);
902 buf_pool_release(&tempfile);
903
904 return MUTT_CMD_SUCCESS;
905}
906
910static int envlist_sort(const void *a, const void *b, void *sdata)
911{
912 return strcmp(*(const char **) a, *(const char **) b);
913}
914
918static enum CommandResult parse_setenv(struct Buffer *buf, struct Buffer *s,
919 intptr_t data, struct Buffer *err)
920{
921 char **envp = EnvList;
922
923 bool query = false;
924 bool prefix = false;
925 bool unset = (data == MUTT_SET_UNSET);
926
927 if (!MoreArgs(s))
928 {
929 if (!StartupComplete)
930 {
931 buf_printf(err, _("%s: too few arguments"), "setenv");
932 return MUTT_CMD_WARNING;
933 }
934
935 struct Buffer *tempfile = buf_pool_get();
936 buf_mktemp(tempfile);
937
938 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
939 if (!fp_out)
940 {
941 // L10N: '%s' is the file name of the temporary file
942 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
943 buf_pool_release(&tempfile);
944 return MUTT_CMD_ERROR;
945 }
946
947 int count = 0;
948 for (char **env = EnvList; *env; env++)
949 count++;
950
951 mutt_qsort_r(EnvList, count, sizeof(char *), envlist_sort, NULL);
952
953 for (char **env = EnvList; *env; env++)
954 fprintf(fp_out, "%s\n", *env);
955
956 mutt_file_fclose(&fp_out);
957
958 struct PagerData pdata = { 0 };
959 struct PagerView pview = { &pdata };
960
961 pdata.fname = buf_string(tempfile);
962
963 pview.banner = "setenv";
965 pview.mode = PAGER_MODE_OTHER;
966
967 mutt_do_pager(&pview, NULL);
968 buf_pool_release(&tempfile);
969
970 return MUTT_CMD_SUCCESS;
971 }
972
973 if (*s->dptr == '?')
974 {
975 query = true;
976 prefix = true;
977
978 if (unset)
979 {
980 buf_printf(err, _("Can't query option with the '%s' command"), "unsetenv");
981 return MUTT_CMD_WARNING;
982 }
983
984 s->dptr++;
985 }
986
987 /* get variable name */
989
990 if (*s->dptr == '?')
991 {
992 if (unset)
993 {
994 buf_printf(err, _("Can't query option with the '%s' command"), "unsetenv");
995 return MUTT_CMD_WARNING;
996 }
997
998 if (prefix)
999 {
1000 buf_printf(err, _("Can't use a prefix when querying a variable"));
1001 return MUTT_CMD_WARNING;
1002 }
1003
1004 query = true;
1005 s->dptr++;
1006 }
1007
1008 if (query)
1009 {
1010 bool found = false;
1011 while (envp && *envp)
1012 {
1013 /* This will display all matches for "^QUERY" */
1014 if (mutt_str_startswith(*envp, buf->data))
1015 {
1016 if (!found)
1017 {
1018 mutt_endwin();
1019 found = true;
1020 }
1021 puts(*envp);
1022 }
1023 envp++;
1024 }
1025
1026 if (found)
1027 {
1029 return MUTT_CMD_SUCCESS;
1030 }
1031
1032 buf_printf(err, _("%s is unset"), buf->data);
1033 return MUTT_CMD_WARNING;
1034 }
1035
1036 if (unset)
1037 {
1038 if (!envlist_unset(&EnvList, buf->data))
1039 {
1040 buf_printf(err, _("%s is unset"), buf->data);
1041 return MUTT_CMD_WARNING;
1042 }
1043 return MUTT_CMD_SUCCESS;
1044 }
1045
1046 /* set variable */
1047
1048 if (*s->dptr == '=')
1049 {
1050 s->dptr++;
1051 SKIPWS(s->dptr);
1052 }
1053
1054 if (!MoreArgs(s))
1055 {
1056 buf_printf(err, _("%s: too few arguments"), "setenv");
1057 return MUTT_CMD_WARNING;
1058 }
1059
1060 char *name = mutt_str_dup(buf->data);
1062 envlist_set(&EnvList, name, buf->data, true);
1063 FREE(&name);
1064
1065 return MUTT_CMD_SUCCESS;
1066}
1067
1071static enum CommandResult parse_source(struct Buffer *buf, struct Buffer *s,
1072 intptr_t data, struct Buffer *err)
1073{
1074 char path[PATH_MAX] = { 0 };
1075
1076 do
1077 {
1078 if (parse_extract_token(buf, s, TOKEN_NO_FLAGS) != 0)
1079 {
1080 buf_printf(err, _("source: error at %s"), s->dptr);
1081 return MUTT_CMD_ERROR;
1082 }
1083 mutt_str_copy(path, buf->data, sizeof(path));
1084 mutt_expand_path(path, sizeof(path));
1085
1086 if (source_rc(path, err) < 0)
1087 {
1088 buf_printf(err, _("source: file %s could not be sourced"), path);
1089 return MUTT_CMD_ERROR;
1090 }
1091
1092 } while (MoreArgs(s));
1093
1094 return MUTT_CMD_SUCCESS;
1095}
1096
1100static enum CommandResult parse_nospam(struct Buffer *buf, struct Buffer *s,
1101 intptr_t data, struct Buffer *err)
1102{
1103 if (!MoreArgs(s))
1104 {
1105 buf_printf(err, _("%s: too few arguments"), "nospam");
1106 return MUTT_CMD_ERROR;
1107 }
1108
1109 // Extract the first token, a regex or "*"
1111
1112 if (MoreArgs(s))
1113 {
1114 buf_printf(err, _("%s: too many arguments"), "finish");
1115 return MUTT_CMD_ERROR;
1116 }
1117
1118 // "*" is special - clear both spam and nospam lists
1119 if (mutt_str_equal(buf_string(buf), "*"))
1120 {
1123 return MUTT_CMD_SUCCESS;
1124 }
1125
1126 // If it's on the spam list, just remove it
1128 return MUTT_CMD_SUCCESS;
1129
1130 // Otherwise, add it to the nospam list
1131 if (mutt_regexlist_add(&NoSpamList, buf_string(buf), REG_ICASE, err) != 0)
1132 return MUTT_CMD_ERROR;
1133
1134 return MUTT_CMD_SUCCESS;
1135}
1136
1140static enum CommandResult parse_spam(struct Buffer *buf, struct Buffer *s,
1141 intptr_t data, struct Buffer *err)
1142{
1143 if (!MoreArgs(s))
1144 {
1145 buf_printf(err, _("%s: too few arguments"), "spam");
1146 return MUTT_CMD_ERROR;
1147 }
1148
1149 // Extract the first token, a regex
1151
1152 // If there's a second parameter, it's a template for the spam tag
1153 if (MoreArgs(s))
1154 {
1155 struct Buffer *templ = buf_pool_get();
1157
1158 // Add to the spam list
1159 int rc = mutt_replacelist_add(&SpamList, buf_string(buf), buf_string(templ), err);
1160 buf_pool_release(&templ);
1161 if (rc != 0)
1162 return MUTT_CMD_ERROR;
1163 }
1164 else
1165 {
1166 // If not, try to remove from the nospam list
1168 }
1169
1170 return MUTT_CMD_SUCCESS;
1171}
1172
1178static enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s,
1179 intptr_t data, struct Buffer *err)
1180{
1181 do
1182 {
1184 add_to_stailq((struct ListHead *) data, buf->data);
1185 } while (MoreArgs(s));
1186
1187 return MUTT_CMD_SUCCESS;
1188}
1189
1193static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
1194 intptr_t data, struct Buffer *err)
1195{
1196 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
1197
1198 do
1199 {
1201
1202 if (parse_grouplist(&gl, buf, s, err) == -1)
1203 goto bail;
1204
1207
1208 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
1209 goto bail;
1210 if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
1211 goto bail;
1212 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
1213 goto bail;
1214 } while (MoreArgs(s));
1215
1217 return MUTT_CMD_SUCCESS;
1218
1219bail:
1221 return MUTT_CMD_ERROR;
1222}
1223
1231enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s,
1232 intptr_t data, struct Buffer *err)
1233{
1234 if (!buf || !s || !err)
1235 return MUTT_CMD_ERROR;
1236
1237 buf_reset(err);
1238
1239 if (MoreArgs(s))
1240 {
1242
1243 if (MoreArgs(s))
1244 {
1245 buf_printf(err, _("%s: too many arguments"), "subscribe-to");
1246 return MUTT_CMD_WARNING;
1247 }
1248
1249 if (!buf_is_empty(buf))
1250 {
1251 /* Expand and subscribe */
1252 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), true) == 0)
1253 {
1254 mutt_message(_("Subscribed to %s"), buf->data);
1255 return MUTT_CMD_SUCCESS;
1256 }
1257
1258 buf_printf(err, _("Could not subscribe to %s"), buf->data);
1259 return MUTT_CMD_ERROR;
1260 }
1261
1262 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1263 return MUTT_CMD_ERROR;
1264 }
1265
1266 buf_addstr(err, _("No folder specified"));
1267 return MUTT_CMD_WARNING;
1268}
1269
1277static enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s,
1278 intptr_t data, struct Buffer *err)
1279{
1280 if (!s)
1281 return MUTT_CMD_ERROR;
1282
1283 struct Buffer *tagbuf = buf_pool_get();
1284 struct Buffer *fmtbuf = buf_pool_get();
1285
1286 while (MoreArgs(s))
1287 {
1289 const char *tag = buf_string(tagbuf);
1290 if (*tag == '\0')
1291 continue;
1292
1294 const char *fmt = buf_string(fmtbuf);
1295
1296 /* avoid duplicates */
1297 const char *tmp = mutt_hash_find(TagFormats, fmt);
1298 if (tmp)
1299 {
1300 mutt_warning(_("tag format '%s' already registered as '%s'"), fmt, tmp);
1301 continue;
1302 }
1303
1305 }
1306
1307 buf_pool_release(&tagbuf);
1308 buf_pool_release(&fmtbuf);
1309 return MUTT_CMD_SUCCESS;
1310}
1311
1319static enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s,
1320 intptr_t data, struct Buffer *err)
1321{
1322 if (!s)
1323 return MUTT_CMD_ERROR;
1324
1325 struct Buffer *tagbuf = buf_pool_get();
1326 struct Buffer *trnbuf = buf_pool_get();
1327
1328 while (MoreArgs(s))
1329 {
1331 const char *tag = buf_string(tagbuf);
1332 if (*tag == '\0')
1333 continue;
1334
1336 const char *trn = buf_string(trnbuf);
1337
1338 /* avoid duplicates */
1339 const char *tmp = mutt_hash_find(TagTransforms, tag);
1340 if (tmp)
1341 {
1342 mutt_warning(_("tag transform '%s' already registered as '%s'"), tag, tmp);
1343 continue;
1344 }
1345
1347 }
1348
1349 buf_pool_release(&tagbuf);
1350 buf_pool_release(&trnbuf);
1351 return MUTT_CMD_SUCCESS;
1352}
1353
1357static enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s,
1358 intptr_t data, struct Buffer *err)
1359{
1360 do
1361 {
1363
1364 /* don't add "*" to the unignore list */
1365 if (!mutt_str_equal(buf->data, "*"))
1366 add_to_stailq(&UnIgnore, buf->data);
1367
1369 } while (MoreArgs(s));
1370
1371 return MUTT_CMD_SUCCESS;
1372}
1373
1377static enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s,
1378 intptr_t data, struct Buffer *err)
1379{
1381 do
1382 {
1386
1387 if (!mutt_str_equal(buf->data, "*") &&
1388 (mutt_regexlist_add(&UnMailLists, buf->data, REG_ICASE, err) != 0))
1389 {
1390 return MUTT_CMD_ERROR;
1391 }
1392 } while (MoreArgs(s));
1393
1394 return MUTT_CMD_SUCCESS;
1395}
1396
1401static void do_unmailboxes(struct Mailbox *m)
1402{
1403#ifdef USE_INOTIFY
1404 if (m->poll_new_mail)
1406#endif
1407 m->visible = false;
1408 m->gen = -1;
1409 if (m->opened)
1410 {
1411 struct EventMailbox ev_m = { NULL };
1412 mutt_debug(LL_NOTIFY, "NT_MAILBOX_CHANGE: NULL\n");
1414 }
1415 else
1416 {
1418 mailbox_free(&m);
1419 }
1420}
1421
1425static void do_unmailboxes_star(void)
1426{
1427 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
1429 struct MailboxNode *np = NULL;
1430 struct MailboxNode *nptmp = NULL;
1431 STAILQ_FOREACH_SAFE(np, &ml, entries, nptmp)
1432 {
1434 }
1436}
1437
1443enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s,
1444 intptr_t data, struct Buffer *err)
1445{
1446 while (MoreArgs(s))
1447 {
1449
1450 if (mutt_str_equal(buf->data, "*"))
1451 {
1453 return MUTT_CMD_SUCCESS;
1454 }
1455
1456 buf_expand_path(buf);
1457
1458 struct Account *a = NULL;
1459 TAILQ_FOREACH(a, &NeoMutt->accounts, entries)
1460 {
1461 struct Mailbox *m = mx_mbox_find(a, buf_string(buf));
1462 if (m)
1463 {
1464 do_unmailboxes(m);
1465 break;
1466 }
1467 }
1468 }
1469 return MUTT_CMD_SUCCESS;
1470}
1471
1475static enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s,
1476 intptr_t data, struct Buffer *err)
1477{
1478 struct ListNode *np = NULL, *tmp = NULL;
1479 size_t l;
1480
1481 do
1482 {
1484 if (mutt_str_equal("*", buf->data))
1485 {
1486 /* Clear all headers, send a notification for each header */
1487 STAILQ_FOREACH(np, &UserHeader, entries)
1488 {
1489 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1490 struct EventHeader ev_h = { np->data };
1492 }
1494 continue;
1495 }
1496
1497 l = mutt_str_len(buf->data);
1498 if (buf->data[l - 1] == ':')
1499 l--;
1500
1501 STAILQ_FOREACH_SAFE(np, &UserHeader, entries, tmp)
1502 {
1503 if (mutt_istrn_equal(buf->data, np->data, l) && (np->data[l] == ':'))
1504 {
1505 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1506 struct EventHeader ev_h = { np->data };
1508
1509 header_free(&UserHeader, np);
1510 }
1511 }
1512 } while (MoreArgs(s));
1513 return MUTT_CMD_SUCCESS;
1514}
1515
1521static enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s,
1522 intptr_t data, struct Buffer *err)
1523{
1524 do
1525 {
1527 /* Check for deletion of entire list */
1528 if (mutt_str_equal(buf->data, "*"))
1529 {
1530 mutt_list_free((struct ListHead *) data);
1531 break;
1532 }
1533 remove_from_stailq((struct ListHead *) data, buf->data);
1534 } while (MoreArgs(s));
1535
1536 return MUTT_CMD_SUCCESS;
1537}
1538
1542static enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s,
1543 intptr_t data, struct Buffer *err)
1544{
1546 do
1547 {
1550
1551 if (!mutt_str_equal(buf->data, "*") &&
1552 (mutt_regexlist_add(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0))
1553 {
1554 return MUTT_CMD_ERROR;
1555 }
1556 } while (MoreArgs(s));
1557
1558 return MUTT_CMD_SUCCESS;
1559}
1560
1569 intptr_t data, struct Buffer *err)
1570{
1571 if (!buf || !s || !err)
1572 return MUTT_CMD_ERROR;
1573
1574 if (MoreArgs(s))
1575 {
1577
1578 if (MoreArgs(s))
1579 {
1580 buf_printf(err, _("%s: too many arguments"), "unsubscribe-from");
1581 return MUTT_CMD_WARNING;
1582 }
1583
1584 if (buf->data && (*buf->data != '\0'))
1585 {
1586 /* Expand and subscribe */
1587 if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), false) == 0)
1588 {
1589 mutt_message(_("Unsubscribed from %s"), buf->data);
1590 return MUTT_CMD_SUCCESS;
1591 }
1592
1593 buf_printf(err, _("Could not unsubscribe from %s"), buf->data);
1594 return MUTT_CMD_ERROR;
1595 }
1596
1597 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1598 return MUTT_CMD_ERROR;
1599 }
1600
1601 buf_addstr(err, _("No folder specified"));
1602 return MUTT_CMD_WARNING;
1603}
1604
1608static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s,
1609 intptr_t data, struct Buffer *err)
1610{
1611 // silently ignore 'version' if it's in a config file
1612 if (!StartupComplete)
1613 return MUTT_CMD_SUCCESS;
1614
1615 struct Buffer *tempfile = buf_pool_get();
1616 buf_mktemp(tempfile);
1617
1618 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
1619 if (!fp_out)
1620 {
1621 // L10N: '%s' is the file name of the temporary file
1622 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
1623 buf_pool_release(&tempfile);
1624 return MUTT_CMD_ERROR;
1625 }
1626
1627 print_version(fp_out);
1628 mutt_file_fclose(&fp_out);
1629
1630 struct PagerData pdata = { 0 };
1631 struct PagerView pview = { &pdata };
1632
1633 pdata.fname = buf_string(tempfile);
1634
1635 pview.banner = "version";
1636 pview.flags = MUTT_PAGER_NO_FLAGS;
1637 pview.mode = PAGER_MODE_OTHER;
1638
1639 mutt_do_pager(&pview, NULL);
1640 buf_pool_release(&tempfile);
1641
1642 return MUTT_CMD_SUCCESS;
1643}
1644
1649{
1651}
1652
1656static const struct Command MuttCommands[] = {
1657 // clang-format off
1658 { "alias", parse_alias, 0 },
1659 { "alternates", parse_alternates, 0 },
1660 { "alternative_order", parse_stailq, IP &AlternativeOrderList },
1661 { "attachments", parse_attachments, 0 },
1662 { "auto_view", parse_stailq, IP &AutoViewList },
1663 { "bind", mutt_parse_bind, 0 },
1664 { "cd", parse_cd, 0 },
1665 { "color", mutt_parse_color, 0 },
1666 { "echo", parse_echo, 0 },
1667 { "exec", mutt_parse_exec, 0 },
1668 { "finish", parse_finish, 0 },
1669 { "group", parse_group, MUTT_GROUP },
1670 { "hdr_order", parse_stailq, IP &HeaderOrderList },
1671 { "ifdef", parse_ifdef, 0 },
1672 { "ifndef", parse_ifdef, 1 },
1673 { "ignore", parse_ignore, 0 },
1674 { "lists", parse_lists, 0 },
1675 { "macro", mutt_parse_macro, 1 },
1676 { "mailboxes", parse_mailboxes, 0 },
1677 { "mailto_allow", parse_stailq, IP &MailToAllow },
1678 { "mime_lookup", parse_stailq, IP &MimeLookupList },
1679 { "mono", mutt_parse_mono, 0 },
1680 { "my_hdr", parse_my_hdr, 0 },
1681 { "named-mailboxes", parse_mailboxes, MUTT_NAMED },
1682 { "nospam", parse_nospam, 0 },
1683 { "push", mutt_parse_push, 0 },
1684 { "reset", parse_set, MUTT_SET_RESET },
1685 { "score", mutt_parse_score, 0 },
1686 { "set", parse_set, MUTT_SET_SET },
1687 { "setenv", parse_setenv, MUTT_SET_SET },
1688 { "source", parse_source, 0 },
1689 { "spam", parse_spam, 0 },
1690 { "subjectrx", parse_subjectrx_list, 0 },
1691 { "subscribe", parse_subscribe, 0 },
1692 { "tag-formats", parse_tag_formats, 0 },
1693 { "tag-transforms", parse_tag_transforms, 0 },
1694 { "toggle", parse_set, MUTT_SET_INV },
1695 { "unalias", parse_unalias, 0 },
1696 { "unalternates", parse_unalternates, 0 },
1697 { "unalternative_order", parse_unstailq, IP &AlternativeOrderList },
1698 { "unattachments", parse_unattachments, 0 },
1699 { "unauto_view", parse_unstailq, IP &AutoViewList },
1700 { "unbind", mutt_parse_unbind, MUTT_UNBIND },
1701 { "uncolor", mutt_parse_uncolor, 0 },
1702 { "ungroup", parse_group, MUTT_UNGROUP },
1703 { "unhdr_order", parse_unstailq, IP &HeaderOrderList },
1704 { "unignore", parse_unignore, 0 },
1705 { "unlists", parse_unlists, 0 },
1706 { "unmacro", mutt_parse_unbind, MUTT_UNMACRO },
1707 { "unmailboxes", parse_unmailboxes, 0 },
1708 { "unmailto_allow", parse_unstailq, IP &MailToAllow },
1709 { "unmime_lookup", parse_unstailq, IP &MimeLookupList },
1710 { "unmono", mutt_parse_unmono, 0 },
1711 { "unmy_hdr", parse_unmy_hdr, 0 },
1712 { "unscore", mutt_parse_unscore, 0 },
1713 { "unset", parse_set, MUTT_SET_UNSET },
1714 { "unsetenv", parse_setenv, MUTT_SET_UNSET },
1715 { "unsubjectrx", parse_unsubjectrx_list, 0 },
1716 { "unsubscribe", parse_unsubscribe, 0 },
1717 { "version", parse_version, 0 },
1718 // clang-format on
1719};
1720
1725{
1727}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1460
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:1293
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:161
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:76
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:291
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:226
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:395
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:601
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:571
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
Color and attribute parsing.
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:1656
enum CommandResult set_dump(ConfigDumpFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
Definition: commands.c:874
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:623
GroupState
Type of email address group.
Definition: commands.c:95
@ GS_RX
Entry is a regular expression.
Definition: commands.c:97
@ GS_NONE
Group is missing an argument.
Definition: commands.c:96
@ GS_ADDR
Entry is an address.
Definition: commands.c:98
#define MAX_ERRS
Definition: commands.c:79
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:165
void commands_init(void)
Initialize commands array and register default commands.
Definition: commands.c:1724
int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err)
Parse a group context.
Definition: commands.c:131
void source_stack_cleanup(void)
Free memory from the stack used for the source command.
Definition: commands.c:1648
static void do_unmailboxes_star(void)
Remove all Mailboxes from the Sidebar/notifications.
Definition: commands.c:1425
static struct ListHead MuttrcStack
LIFO designed to contain the list of config files that have been sourced and avoid cyclic sourcing.
Definition: commands.c:77
TriBool
Tri-state boolean.
Definition: commands.c:85
@ TB_FALSE
Value is false.
Definition: commands.c:87
@ TB_TRUE
Value is true.
Definition: commands.c:88
@ TB_UNSET
Value hasn't been set.
Definition: commands.c:86
bool mailbox_add_simple(const char *mailbox, struct Buffer *err)
Add a new Mailbox.
Definition: commands.c:727
static void do_unmailboxes(struct Mailbox *m)
Remove a Mailbox from the Sidebar/notifications.
Definition: commands.c:1401
int source_rc(const char *rcfile_path, struct Buffer *err)
Read an initialization file.
Definition: commands.c:206
char * mutt_get_sourced_cwd(void)
Get the current file path that is being parsed.
Definition: commands.c:185
static bool is_function(const char *name)
Is the argument a neomutt function?
Definition: commands.c:107
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: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:291
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:192
#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:58
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:68
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:89
@ NT_MAILBOX_CHANGE
Mailbox has been changed.
Definition: mailbox.h:185
@ 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:173
void mutt_endwin(void)
Shutdown curses.
Definition: curs_lib.c:151
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:122
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:213
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:211
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:212
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:808
#define MUTT_RL_CONT
-continuation
Definition: file.h:41
#define mutt_file_fclose(FP)
Definition: file.h:149
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:148
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: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: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:408
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:1178
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:1608
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:1377
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:423
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:188
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:424
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:1140
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:1521
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:171
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:1568
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:1357
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:523
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:1071
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:1443
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:1475
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:1193
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:1319
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:354
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:568
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:1231
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:739
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:1277
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:584
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:384
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:835
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:1542
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:918
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:1100
#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:910
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:1223
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:46
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:123
@ 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:484
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Definition: monitor.c:528
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:831
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Definition: charset.h:73
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:220
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:333
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:566
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:450
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:672
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:660
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:726
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:496
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:581
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:453
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:280
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:1172
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1147
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:123
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:878
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:328
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:736
Some miscellaneous functions.
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1543
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1723
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1519
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1471
API for mailboxes.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:168
bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
Add an Account to the global list.
Definition: neomutt.c:110
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:191
@ 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:220
An Event that happened to a Mailbox.
Definition: mailbox.h:199
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:200
A List node for strings.
Definition: list.h:36
char * data
String.
Definition: list.h:37
List of Mailboxes.
Definition: mailbox.h:166
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:167
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:42
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:47
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
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:552
Display version and copyright about NeoMutt.