NeoMutt  2024-04-25-102-g19653a
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 struct Buffer *path = buf_pool_get();
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 buf_pool_release(&path);
1082 return MUTT_CMD_ERROR;
1083 }
1084 buf_copy(path, buf);
1085 buf_expand_path(path);
1086
1087 if (source_rc(buf_string(path), err) < 0)
1088 {
1089 buf_printf(err, _("source: file %s could not be sourced"), buf_string(path));
1090 buf_pool_release(&path);
1091 return MUTT_CMD_ERROR;
1092 }
1093
1094 } while (MoreArgs(s));
1095
1096 buf_pool_release(&path);
1097
1098 return MUTT_CMD_SUCCESS;
1099}
1100
1104static enum CommandResult parse_nospam(struct Buffer *buf, struct Buffer *s,
1105 intptr_t data, struct Buffer *err)
1106{
1107 if (!MoreArgs(s))
1108 {
1109 buf_printf(err, _("%s: too few arguments"), "nospam");
1110 return MUTT_CMD_ERROR;
1111 }
1112
1113 // Extract the first token, a regex or "*"
1115
1116 if (MoreArgs(s))
1117 {
1118 buf_printf(err, _("%s: too many arguments"), "finish");
1119 return MUTT_CMD_ERROR;
1120 }
1121
1122 // "*" is special - clear both spam and nospam lists
1123 if (mutt_str_equal(buf_string(buf), "*"))
1124 {
1127 return MUTT_CMD_SUCCESS;
1128 }
1129
1130 // If it's on the spam list, just remove it
1132 return MUTT_CMD_SUCCESS;
1133
1134 // Otherwise, add it to the nospam list
1135 if (mutt_regexlist_add(&NoSpamList, buf_string(buf), REG_ICASE, err) != 0)
1136 return MUTT_CMD_ERROR;
1137
1138 return MUTT_CMD_SUCCESS;
1139}
1140
1144static enum CommandResult parse_spam(struct Buffer *buf, struct Buffer *s,
1145 intptr_t data, struct Buffer *err)
1146{
1147 if (!MoreArgs(s))
1148 {
1149 buf_printf(err, _("%s: too few arguments"), "spam");
1150 return MUTT_CMD_ERROR;
1151 }
1152
1153 // Extract the first token, a regex
1155
1156 // If there's a second parameter, it's a template for the spam tag
1157 if (MoreArgs(s))
1158 {
1159 struct Buffer *templ = buf_pool_get();
1161
1162 // Add to the spam list
1163 int rc = mutt_replacelist_add(&SpamList, buf_string(buf), buf_string(templ), err);
1164 buf_pool_release(&templ);
1165 if (rc != 0)
1166 return MUTT_CMD_ERROR;
1167 }
1168 else
1169 {
1170 // If not, try to remove from the nospam list
1172 }
1173
1174 return MUTT_CMD_SUCCESS;
1175}
1176
1182static enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s,
1183 intptr_t data, struct Buffer *err)
1184{
1185 do
1186 {
1188 add_to_stailq((struct ListHead *) data, buf->data);
1189 } while (MoreArgs(s));
1190
1191 return MUTT_CMD_SUCCESS;
1192}
1193
1197static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
1198 intptr_t data, struct Buffer *err)
1199{
1200 struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
1201
1202 do
1203 {
1205
1206 if (parse_grouplist(&gl, buf, s, err) == -1)
1207 goto bail;
1208
1211
1212 if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
1213 goto bail;
1214 if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
1215 goto bail;
1216 if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
1217 goto bail;
1218 } while (MoreArgs(s));
1219
1221 return MUTT_CMD_SUCCESS;
1222
1223bail:
1225 return MUTT_CMD_ERROR;
1226}
1227
1235enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s,
1236 intptr_t data, struct Buffer *err)
1237{
1238 if (!buf || !s || !err)
1239 return MUTT_CMD_ERROR;
1240
1241 buf_reset(err);
1242
1243 if (MoreArgs(s))
1244 {
1246
1247 if (MoreArgs(s))
1248 {
1249 buf_printf(err, _("%s: too many arguments"), "subscribe-to");
1250 return MUTT_CMD_WARNING;
1251 }
1252
1253 if (!buf_is_empty(buf))
1254 {
1255 /* Expand and subscribe */
1256 buf_expand_path(buf);
1257 if (imap_subscribe(buf_string(buf), true) == 0)
1258 {
1259 mutt_message(_("Subscribed to %s"), buf->data);
1260 return MUTT_CMD_SUCCESS;
1261 }
1262
1263 buf_printf(err, _("Could not subscribe to %s"), buf->data);
1264 return MUTT_CMD_ERROR;
1265 }
1266
1267 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1268 return MUTT_CMD_ERROR;
1269 }
1270
1271 buf_addstr(err, _("No folder specified"));
1272 return MUTT_CMD_WARNING;
1273}
1274
1282static enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s,
1283 intptr_t data, struct Buffer *err)
1284{
1285 if (!s)
1286 return MUTT_CMD_ERROR;
1287
1288 struct Buffer *tagbuf = buf_pool_get();
1289 struct Buffer *fmtbuf = buf_pool_get();
1290
1291 while (MoreArgs(s))
1292 {
1294 const char *tag = buf_string(tagbuf);
1295 if (*tag == '\0')
1296 continue;
1297
1299 const char *fmt = buf_string(fmtbuf);
1300
1301 /* avoid duplicates */
1302 const char *tmp = mutt_hash_find(TagFormats, fmt);
1303 if (tmp)
1304 {
1305 mutt_warning(_("tag format '%s' already registered as '%s'"), fmt, tmp);
1306 continue;
1307 }
1308
1310 }
1311
1312 buf_pool_release(&tagbuf);
1313 buf_pool_release(&fmtbuf);
1314 return MUTT_CMD_SUCCESS;
1315}
1316
1324static enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s,
1325 intptr_t data, struct Buffer *err)
1326{
1327 if (!s)
1328 return MUTT_CMD_ERROR;
1329
1330 struct Buffer *tagbuf = buf_pool_get();
1331 struct Buffer *trnbuf = buf_pool_get();
1332
1333 while (MoreArgs(s))
1334 {
1336 const char *tag = buf_string(tagbuf);
1337 if (*tag == '\0')
1338 continue;
1339
1341 const char *trn = buf_string(trnbuf);
1342
1343 /* avoid duplicates */
1344 const char *tmp = mutt_hash_find(TagTransforms, tag);
1345 if (tmp)
1346 {
1347 mutt_warning(_("tag transform '%s' already registered as '%s'"), tag, tmp);
1348 continue;
1349 }
1350
1352 }
1353
1354 buf_pool_release(&tagbuf);
1355 buf_pool_release(&trnbuf);
1356 return MUTT_CMD_SUCCESS;
1357}
1358
1362static enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s,
1363 intptr_t data, struct Buffer *err)
1364{
1365 do
1366 {
1368
1369 /* don't add "*" to the unignore list */
1370 if (!mutt_str_equal(buf->data, "*"))
1371 add_to_stailq(&UnIgnore, buf->data);
1372
1374 } while (MoreArgs(s));
1375
1376 return MUTT_CMD_SUCCESS;
1377}
1378
1382static enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s,
1383 intptr_t data, struct Buffer *err)
1384{
1386 do
1387 {
1391
1392 if (!mutt_str_equal(buf->data, "*") &&
1393 (mutt_regexlist_add(&UnMailLists, buf->data, REG_ICASE, err) != 0))
1394 {
1395 return MUTT_CMD_ERROR;
1396 }
1397 } while (MoreArgs(s));
1398
1399 return MUTT_CMD_SUCCESS;
1400}
1401
1406static void do_unmailboxes(struct Mailbox *m)
1407{
1408#ifdef USE_INOTIFY
1409 if (m->poll_new_mail)
1411#endif
1412 m->visible = false;
1413 m->gen = -1;
1414 if (m->opened)
1415 {
1416 struct EventMailbox ev_m = { NULL };
1417 mutt_debug(LL_NOTIFY, "NT_MAILBOX_CHANGE: NULL\n");
1419 }
1420 else
1421 {
1423 mailbox_free(&m);
1424 }
1425}
1426
1430static void do_unmailboxes_star(void)
1431{
1432 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
1434 struct MailboxNode *np = NULL;
1435 struct MailboxNode *nptmp = NULL;
1436 STAILQ_FOREACH_SAFE(np, &ml, entries, nptmp)
1437 {
1439 }
1441}
1442
1448enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s,
1449 intptr_t data, struct Buffer *err)
1450{
1451 while (MoreArgs(s))
1452 {
1454
1455 if (mutt_str_equal(buf->data, "*"))
1456 {
1458 return MUTT_CMD_SUCCESS;
1459 }
1460
1461 buf_expand_path(buf);
1462
1463 struct Account *a = NULL;
1464 TAILQ_FOREACH(a, &NeoMutt->accounts, entries)
1465 {
1466 struct Mailbox *m = mx_mbox_find(a, buf_string(buf));
1467 if (m)
1468 {
1469 do_unmailboxes(m);
1470 break;
1471 }
1472 }
1473 }
1474 return MUTT_CMD_SUCCESS;
1475}
1476
1480static enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s,
1481 intptr_t data, struct Buffer *err)
1482{
1483 struct ListNode *np = NULL, *tmp = NULL;
1484 size_t l;
1485
1486 do
1487 {
1489 if (mutt_str_equal("*", buf->data))
1490 {
1491 /* Clear all headers, send a notification for each header */
1492 STAILQ_FOREACH(np, &UserHeader, entries)
1493 {
1494 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1495 struct EventHeader ev_h = { np->data };
1497 }
1499 continue;
1500 }
1501
1502 l = mutt_str_len(buf->data);
1503 if (buf->data[l - 1] == ':')
1504 l--;
1505
1506 STAILQ_FOREACH_SAFE(np, &UserHeader, entries, tmp)
1507 {
1508 if (mutt_istrn_equal(buf->data, np->data, l) && (np->data[l] == ':'))
1509 {
1510 mutt_debug(LL_NOTIFY, "NT_HEADER_DELETE: %s\n", np->data);
1511 struct EventHeader ev_h = { np->data };
1513
1514 header_free(&UserHeader, np);
1515 }
1516 }
1517 } while (MoreArgs(s));
1518 return MUTT_CMD_SUCCESS;
1519}
1520
1526static enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s,
1527 intptr_t data, struct Buffer *err)
1528{
1529 do
1530 {
1532 /* Check for deletion of entire list */
1533 if (mutt_str_equal(buf->data, "*"))
1534 {
1535 mutt_list_free((struct ListHead *) data);
1536 break;
1537 }
1538 remove_from_stailq((struct ListHead *) data, buf->data);
1539 } while (MoreArgs(s));
1540
1541 return MUTT_CMD_SUCCESS;
1542}
1543
1547static enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s,
1548 intptr_t data, struct Buffer *err)
1549{
1551 do
1552 {
1555
1556 if (!mutt_str_equal(buf->data, "*") &&
1557 (mutt_regexlist_add(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0))
1558 {
1559 return MUTT_CMD_ERROR;
1560 }
1561 } while (MoreArgs(s));
1562
1563 return MUTT_CMD_SUCCESS;
1564}
1565
1574 intptr_t data, struct Buffer *err)
1575{
1576 if (!buf || !s || !err)
1577 return MUTT_CMD_ERROR;
1578
1579 if (MoreArgs(s))
1580 {
1582
1583 if (MoreArgs(s))
1584 {
1585 buf_printf(err, _("%s: too many arguments"), "unsubscribe-from");
1586 return MUTT_CMD_WARNING;
1587 }
1588
1589 if (buf->data && (*buf->data != '\0'))
1590 {
1591 /* Expand and subscribe */
1592 buf_expand_path(buf);
1593 if (imap_subscribe(buf_string(buf), false) == 0)
1594 {
1595 mutt_message(_("Unsubscribed from %s"), buf->data);
1596 return MUTT_CMD_SUCCESS;
1597 }
1598
1599 buf_printf(err, _("Could not unsubscribe from %s"), buf->data);
1600 return MUTT_CMD_ERROR;
1601 }
1602
1603 mutt_debug(LL_DEBUG1, "Corrupted buffer");
1604 return MUTT_CMD_ERROR;
1605 }
1606
1607 buf_addstr(err, _("No folder specified"));
1608 return MUTT_CMD_WARNING;
1609}
1610
1614static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s,
1615 intptr_t data, struct Buffer *err)
1616{
1617 // silently ignore 'version' if it's in a config file
1618 if (!StartupComplete)
1619 return MUTT_CMD_SUCCESS;
1620
1621 struct Buffer *tempfile = buf_pool_get();
1622 buf_mktemp(tempfile);
1623
1624 FILE *fp_out = mutt_file_fopen(buf_string(tempfile), "w");
1625 if (!fp_out)
1626 {
1627 // L10N: '%s' is the file name of the temporary file
1628 buf_printf(err, _("Could not create temporary file %s"), buf_string(tempfile));
1629 buf_pool_release(&tempfile);
1630 return MUTT_CMD_ERROR;
1631 }
1632
1633 print_version(fp_out);
1634 mutt_file_fclose(&fp_out);
1635
1636 struct PagerData pdata = { 0 };
1637 struct PagerView pview = { &pdata };
1638
1639 pdata.fname = buf_string(tempfile);
1640
1641 pview.banner = "version";
1642 pview.flags = MUTT_PAGER_NO_FLAGS;
1643 pview.mode = PAGER_MODE_OTHER;
1644
1645 mutt_do_pager(&pview, NULL);
1646 buf_pool_release(&tempfile);
1647
1648 return MUTT_CMD_SUCCESS;
1649}
1650
1655{
1657}
1658
1662static const struct Command MuttCommands[] = {
1663 // clang-format off
1664 { "alias", parse_alias, 0 },
1665 { "alternates", parse_alternates, 0 },
1666 { "alternative_order", parse_stailq, IP &AlternativeOrderList },
1667 { "attachments", parse_attachments, 0 },
1668 { "auto_view", parse_stailq, IP &AutoViewList },
1669 { "bind", mutt_parse_bind, 0 },
1670 { "cd", parse_cd, 0 },
1671 { "color", mutt_parse_color, 0 },
1672 { "echo", parse_echo, 0 },
1673 { "exec", mutt_parse_exec, 0 },
1674 { "finish", parse_finish, 0 },
1675 { "group", parse_group, MUTT_GROUP },
1676 { "hdr_order", parse_stailq, IP &HeaderOrderList },
1677 { "ifdef", parse_ifdef, 0 },
1678 { "ifndef", parse_ifdef, 1 },
1679 { "ignore", parse_ignore, 0 },
1680 { "lists", parse_lists, 0 },
1681 { "macro", mutt_parse_macro, 1 },
1682 { "mailboxes", parse_mailboxes, 0 },
1683 { "mailto_allow", parse_stailq, IP &MailToAllow },
1684 { "mime_lookup", parse_stailq, IP &MimeLookupList },
1685 { "mono", mutt_parse_mono, 0 },
1686 { "my_hdr", parse_my_hdr, 0 },
1687 { "named-mailboxes", parse_mailboxes, MUTT_NAMED },
1688 { "nospam", parse_nospam, 0 },
1689 { "push", mutt_parse_push, 0 },
1690 { "reset", parse_set, MUTT_SET_RESET },
1691 { "score", mutt_parse_score, 0 },
1692 { "set", parse_set, MUTT_SET_SET },
1693 { "setenv", parse_setenv, MUTT_SET_SET },
1694 { "source", parse_source, 0 },
1695 { "spam", parse_spam, 0 },
1696 { "subjectrx", parse_subjectrx_list, 0 },
1697 { "subscribe", parse_subscribe, 0 },
1698 { "tag-formats", parse_tag_formats, 0 },
1699 { "tag-transforms", parse_tag_transforms, 0 },
1700 { "toggle", parse_set, MUTT_SET_INV },
1701 { "unalias", parse_unalias, 0 },
1702 { "unalternates", parse_unalternates, 0 },
1703 { "unalternative_order", parse_unstailq, IP &AlternativeOrderList },
1704 { "unattachments", parse_unattachments, 0 },
1705 { "unauto_view", parse_unstailq, IP &AutoViewList },
1706 { "unbind", mutt_parse_unbind, MUTT_UNBIND },
1707 { "uncolor", mutt_parse_uncolor, 0 },
1708 { "ungroup", parse_group, MUTT_UNGROUP },
1709 { "unhdr_order", parse_unstailq, IP &HeaderOrderList },
1710 { "unignore", parse_unignore, 0 },
1711 { "unlists", parse_unlists, 0 },
1712 { "unmacro", mutt_parse_unbind, MUTT_UNMACRO },
1713 { "unmailboxes", parse_unmailboxes, 0 },
1714 { "unmailto_allow", parse_unstailq, IP &MailToAllow },
1715 { "unmime_lookup", parse_unstailq, IP &MimeLookupList },
1716 { "unmono", mutt_parse_unmono, 0 },
1717 { "unmy_hdr", parse_unmy_hdr, 0 },
1718 { "unscore", mutt_parse_unscore, 0 },
1719 { "unset", parse_set, MUTT_SET_UNSET },
1720 { "unsetenv", parse_setenv, MUTT_SET_UNSET },
1721 { "unsubjectrx", parse_unsubjectrx_list, 0 },
1722 { "unsubscribe", parse_unsubscribe, 0 },
1723 { "version", parse_version, 0 },
1724 // clang-format on
1725};
1726
1731{
1733}
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:1662
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:1730
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:1654
static void do_unmailboxes_star(void)
Remove all Mailboxes from the Sidebar/notifications.
Definition: commands.c:1430
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:1406
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:202
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:160
struct ListNode * header_update(struct ListNode *hdr, const char *header)
Update an existing header.
Definition: email.c:174
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:137
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:210
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:208
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:209
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:63
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:76
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:1182
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:1614
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:1382
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:1144
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:1526
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:1573
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:1362
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:1448
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:1480
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:1197
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:1324
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:1235
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:1282
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:1547
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:1104
#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(const 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:525
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:1137
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1112
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:843
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:315
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:701
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
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:217
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:37
char * data
String.
Definition: list.h:38
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:388
bool feature_enabled(const char *name)
Test if a compile-time feature is enabled.
Definition: version.c:544
Display version and copyright about NeoMutt.