NeoMutt  2020-06-26-250-g349c94
Teaching an old dog new tricks
DOXYGEN
mutt_commands.c
Go to the documentation of this file.
1 
30 #include "config.h"
31 #include <stddef.h>
32 #include "address/lib.h"
33 #include "config/lib.h"
34 #include "email/lib.h"
35 #include "alias/lib.h"
36 #include "gui/lib.h"
37 #include "mutt.h"
38 #include "mutt_commands.h"
39 #include "command_parse.h"
40 #include "hook.h"
41 #include "keymap.h"
42 #include "mutt_globals.h"
43 #include "mutt_lua.h"
44 #include "score.h"
45 #ifdef USE_SIDEBAR
46 #include "sidebar/lib.h"
47 #endif
48 
49 // clang-format off
50 const struct Command Commands[] = {
51  { "account-hook", mutt_parse_hook, MUTT_ACCOUNT_HOOK },
52  { "alias", parse_alias, 0 },
53  { "alternates", parse_alternates, 0 },
54  { "alternative_order", parse_stailq, IP &AlternativeOrderList },
55 #ifdef USE_COMP_MBOX
56  { "append-hook", mutt_parse_hook, MUTT_APPEND_HOOK },
57 #endif
58  { "attachments", parse_attachments, 0 },
59  { "auto_view", parse_stailq, IP &AutoViewList },
60  { "bind", mutt_parse_bind, 0 },
61  { "cd", parse_cd, 0 },
62  { "charset-hook", mutt_parse_hook, MUTT_CHARSET_HOOK },
63 #ifdef USE_COMP_MBOX
64  { "close-hook", mutt_parse_hook, MUTT_CLOSE_HOOK },
65 #endif
66 #ifdef HAVE_COLOR
67  { "color", mutt_parse_color, 0 },
68 #endif
69  { "crypt-hook", mutt_parse_hook, MUTT_CRYPT_HOOK },
70  { "echo", parse_echo, 0 },
71  { "exec", mutt_parse_exec, 0 },
72  { "fcc-hook", mutt_parse_hook, MUTT_FCC_HOOK },
73  { "fcc-save-hook", mutt_parse_hook, MUTT_FCC_HOOK | MUTT_SAVE_HOOK },
74  { "finish", parse_finish, 0 },
75  { "folder-hook", mutt_parse_hook, MUTT_FOLDER_HOOK },
76  { "group", parse_group, MUTT_GROUP },
77  { "hdr_order", parse_stailq, IP &HeaderOrderList },
78  { "iconv-hook", mutt_parse_hook, MUTT_ICONV_HOOK },
79  { "ifdef", parse_ifdef, 0 },
80  { "ifndef", parse_ifdef, 1 },
81  { "ignore", parse_ignore, 0 },
82  { "index-format-hook", mutt_parse_idxfmt_hook, 0 },
83  { "lists", parse_lists, 0 },
84 #ifdef USE_LUA
85  { "lua", mutt_lua_parse, 0 },
86  { "lua-source", mutt_lua_source_file, 0 },
87 #endif
88  { "macro", mutt_parse_macro, 0 },
89  { "mailboxes", parse_mailboxes, 0 },
90  { "mailto_allow", parse_stailq, IP &MailToAllow },
91  { "mbox-hook", mutt_parse_hook, MUTT_MBOX_HOOK },
92  { "message-hook", mutt_parse_hook, MUTT_MESSAGE_HOOK },
93  { "mime_lookup", parse_stailq, IP &MimeLookupList },
94  { "mono", mutt_parse_mono, 0 },
95  { "my_hdr", parse_my_hdr, 0 },
96  { "named-mailboxes", parse_mailboxes, MUTT_NAMED },
97  { "nospam", parse_spam_list, MUTT_NOSPAM },
98 #ifdef USE_COMP_MBOX
99  { "open-hook", mutt_parse_hook, MUTT_OPEN_HOOK },
100 #endif
101  { "pgp-hook", mutt_parse_hook, MUTT_CRYPT_HOOK },
102  { "push", mutt_parse_push, 0 },
103  { "reply-hook", mutt_parse_hook, MUTT_REPLY_HOOK },
104  { "reset", parse_set, MUTT_SET_RESET },
105  { "save-hook", mutt_parse_hook, MUTT_SAVE_HOOK },
106  { "score", mutt_parse_score, 0 },
107  { "send-hook", mutt_parse_hook, MUTT_SEND_HOOK },
108  { "send2-hook", mutt_parse_hook, MUTT_SEND2_HOOK },
109  { "set", parse_set, MUTT_SET_SET },
110  { "setenv", parse_setenv, MUTT_SET_SET },
111  { "shutdown-hook", mutt_parse_hook, MUTT_SHUTDOWN_HOOK | MUTT_GLOBAL_HOOK },
112 #ifdef USE_SIDEBAR
113  { "sidebar_whitelist", sb_parse_whitelist, 0 },
114 #endif
115  { "source", parse_source, 0 },
116  { "spam", parse_spam_list, MUTT_SPAM },
117  { "startup-hook", mutt_parse_hook, MUTT_STARTUP_HOOK | MUTT_GLOBAL_HOOK },
118  { "subjectrx", parse_subjectrx_list, 0 },
119  { "subscribe", parse_subscribe, 0 },
120 #ifdef USE_IMAP
121  { "subscribe-to", parse_subscribe_to, 0 },
122 #endif
123  { "tag-formats", parse_tag_formats, 0 },
124  { "tag-transforms", parse_tag_transforms, 0 },
125  { "timeout-hook", mutt_parse_hook, MUTT_TIMEOUT_HOOK | MUTT_GLOBAL_HOOK },
126  { "toggle", parse_set, MUTT_SET_INV },
127  { "unalias", parse_unalias, 0 },
128  { "unalternates", parse_unalternates, 0 },
129  { "unalternative_order", parse_unstailq, IP &AlternativeOrderList },
130  { "unattachments", parse_unattachments, 0 },
131  { "unauto_view", parse_unstailq, IP &AutoViewList },
132  { "unbind", mutt_parse_unbind, MUTT_UNBIND },
133 #ifdef HAVE_COLOR
134  { "uncolor", mutt_parse_uncolor, 0 },
135 #endif
136  { "ungroup", parse_group, MUTT_UNGROUP },
137  { "unhdr_order", parse_unstailq, IP &HeaderOrderList },
138  { "unhook", mutt_parse_unhook, 0 },
139  { "unignore", parse_unignore, 0 },
140  { "unlists", parse_unlists, 0 },
141  { "unmacro", mutt_parse_unbind, MUTT_UNMACRO },
142  { "unmailboxes", parse_unmailboxes, 0 },
143  { "unmailto_allow", parse_unstailq, IP &MailToAllow },
144  { "unmime_lookup", parse_unstailq, IP &MimeLookupList },
145  { "unmono", mutt_parse_unmono, 0 },
146  { "unmy_hdr", parse_unmy_hdr, 0 },
147  { "unscore", mutt_parse_unscore, 0 },
148  { "unset", parse_set, MUTT_SET_UNSET },
149  { "unsetenv", parse_setenv, MUTT_SET_UNSET },
150 #ifdef USE_SIDEBAR
151  { "unsidebar_whitelist", sb_parse_unwhitelist, 0 },
152 #endif
153  { "unsubjectrx", parse_unsubjectrx_list, 0 },
154  { "unsubscribe", parse_unsubscribe, 0 },
155 #ifdef USE_IMAP
156  { "unsubscribe-from", parse_unsubscribe_from, 0 },
157 #endif
158 #ifdef USE_NOTMUCH
159  { "unvirtual-mailboxes", parse_unmailboxes, 0 },
160  { "virtual-mailboxes", parse_mailboxes, MUTT_NAMED },
161 #endif
162  { NULL, NULL, 0 },
163 };
164 // clang-format on
#define MUTT_SEND_HOOK
send-hook: when composing a new email
Definition: hook.h:47
Convenience wrapper for the gui headers.
Manage keymappings.
#define MUTT_UNGROUP
&#39;ungroup&#39; config command
Definition: group.h:33
#define MUTT_SHUTDOWN_HOOK
shutdown-hook: run when leaving NeoMutt
Definition: hook.h:65
Structs that make up an email.
enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;alternates&#39; command - Implements Command::parse()
enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;lists&#39; command - Implements Command::parse()
#define MUTT_NOSPAM
Definition: mutt.h:115
enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;finish&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;hook&#39; family of commands - Implements Command::parse()
Definition: hook.c:85
enum CommandResult parse_unsubscribe(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unsubscribe&#39; command - Implements Command::parse()
enum CommandResult parse_subjectrx_list(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;subjectrx&#39; command - Implements Command::parse()
enum CommandResult parse_unattachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unattachments&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_exec(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;exec&#39; command - Implements Command::parse()
Definition: keymap.c:1614
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;mono&#39; command - Implements Command::parse()
Definition: color.c:1360
#define MUTT_CHARSET_HOOK
charset-hook: create a charset alias for malformed emails
Definition: hook.h:50
#define MUTT_NAMED
Definition: mutt_commands.h:73
A user-callable command.
Definition: mutt_commands.h:44
enum CommandResult mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unhook&#39; command - Implements Command::parse()
Definition: hook.c:453
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
Definition: hook.h:52
enum CommandResult parse_unignore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unignore&#39; command - Implements Command::parse()
#define MUTT_UNMACRO
Definition: keymap.h:33
enum CommandResult parse_unmy_hdr(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unmy_hdr&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_push(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;push&#39; command - Implements Command::parse()
Definition: keymap.c:1152
#define MUTT_CRYPT_HOOK
crypt-hook: automatically select a PGP/SMIME key
Definition: hook.h:53
enum CommandResult parse_set(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;set&#39; family of commands - Implements Command::parse()
enum CommandResult parse_source(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;source&#39; command - Implements Command::parse()
Integrated Lua scripting.
enum CommandResult parse_ifdef(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;ifdef&#39; and &#39;ifndef&#39; commands - Implements Command::parse()
Convenience wrapper for the config headers.
enum CommandResult mutt_parse_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;bind&#39; command - Implements Command::parse()
Definition: keymap.c:1315
Email Address Handling.
default is to reset all vars to default
Definition: mutt_commands.h:69
enum CommandResult mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unscore&#39; command - Implements Command::parse()
Definition: score.c:205
enum CommandResult parse_unlists(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unlists&#39; command - Implements Command::parse()
enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;group&#39; and &#39;ungroup&#39; commands - Implements Command::parse()
Parse and execute user-defined hooks.
Many unsorted constants and some structs.
#define MUTT_ICONV_HOOK
iconv-hook: create a system charset alias
Definition: hook.h:51
enum CommandResult parse_spam_list(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;spam&#39; and &#39;nospam&#39; commands - Implements Command::parse()
#define MUTT_SPAM
Definition: mutt.h:114
enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;mailboxes&#39; command - Implements Command::parse()
enum CommandResult parse_echo(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;echo&#39; command - Implements Command::parse()
enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;ignore&#39; command - Implements Command::parse()
Email Aliases.
#define MUTT_MBOX_HOOK
mbox-hook: move messages after reading them
Definition: hook.h:46
#define MUTT_APPEND_HOOK
append-hook: append to a compressed mailbox
Definition: hook.h:59
#define MUTT_GLOBAL_HOOK
Hooks which don&#39;t take a regex.
Definition: hook.h:66
enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;alias&#39; command - Implements Command::parse()
Definition: commands.c:49
enum CommandResult parse_unsubscribe_from(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unsubscribe-from&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_score(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;score&#39; command - Implements Command::parse()
Definition: score.c:102
#define MUTT_SAVE_HOOK
save-hook: set a default folder when saving an email
Definition: hook.h:49
enum CommandResult parse_cd(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;cd&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_unbind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unbind&#39; command - Implements Command::parse()
Definition: keymap.c:1475
Functions to parse commands in a config file.
enum CommandResult parse_unstailq(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse an unlist command - Implements Command::parse()
#define MUTT_CLOSE_HOOK
close-hook: write to a compressed mailbox
Definition: hook.h:60
struct ListHead MailToAllow
List of permitted fields in a mailto: url.
Definition: globals.c:47
enum CommandResult parse_tag_formats(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;tag-formats&#39; command - Implements Command::parse()
Definitions of NeoMutt commands.
enum CommandResult mutt_lua_parse(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;lua&#39; command - Implements Command::parse()
Definition: mutt_lua.c:445
default is to unset all vars
Definition: mutt_commands.h:68
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;uncolor&#39; command - Implements Command::parse()
Definition: color.c:920
#define MUTT_OPEN_HOOK
open-hook: to read a compressed mailbox
Definition: hook.h:58
Routines for adding user scores to emails.
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unmono&#39; command - Implements Command::parse()
Definition: color.c:930
#define MUTT_TIMEOUT_HOOK
timeout-hook: run a command periodically
Definition: hook.h:63
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;color&#39; command - Implements Command::parse()
Definition: color.c:1345
enum CommandResult parse_tag_transforms(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;tag-transforms&#39; command - Implements Command::parse()
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:56
enum CommandResult parse_unalias(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unalias&#39; command - Implements Command::parse()
Definition: commands.c:144
enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;subscribe&#39; command - Implements Command::parse()
#define MUTT_REPLY_HOOK
reply-hook: when replying to an email
Definition: hook.h:55
#define IP
Definition: set.h:54
enum CommandResult parse_my_hdr(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;my_hdr&#39; command - Implements Command::parse()
enum CommandResult parse_unsubjectrx_list(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unsubjectrx&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;index-format-hook&#39; command - Implements Command::parse()
Definition: hook.c:351
#define MUTT_UNBIND
Definition: keymap.h:32
Hundreds of global variables to back the user variables.
default is to set all vars
Definition: mutt_commands.h:66
enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unmailboxes&#39; command - Implements Command::parse()
enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;subscribe-to&#39; command - Implements Command::parse()
enum CommandResult parse_attachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;attachments&#39; command - Implements Command::parse()
enum CommandResult parse_unalternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unalternates&#39; command - Implements Command::parse()
enum CommandResult mutt_parse_macro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;macro&#39; command - Implements Command::parse()
Definition: keymap.c:1549
enum CommandResult mutt_lua_source_file(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;lua-source&#39; command - Implements Command::parse()
Definition: mutt_lua.c:467
enum CommandResult parse_setenv(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;setenv&#39; and &#39;unsetenv&#39; commands - Implements Command::parse()
#define MUTT_STARTUP_HOOK
startup-hook: run when starting NeoMutt
Definition: hook.h:64
enum CommandResult parse_stailq(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse a list command - Implements Command::parse()
default is to invert all vars
Definition: mutt_commands.h:67
#define MUTT_FCC_HOOK
fcc-hook: to save outgoing email
Definition: hook.h:48
#define MUTT_ACCOUNT_HOOK
account-hook: when changing between accounts
Definition: hook.h:54
#define MUTT_GROUP
&#39;group&#39; config command
Definition: group.h:32
#define MUTT_FOLDER_HOOK
folder-hook: when entering a mailbox
Definition: hook.h:45