NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <stdio.h>
31#include "mutt/lib.h"
32#include "core/lib.h"
33#include "commands.h"
34#include "dump.h"
35#include "parse.h"
36
40const struct Command HooksCommands[] = {
41 // clang-format off
42 { "account-hook", CMD_ACCOUNT_HOOK, parse_regex_hook,
43 N_("Run a command when switching to a matching account"),
44 N_("account-hook <regex> <command>"),
45 "optionalfeatures.html#account-hook" },
46 { "charset-hook", CMD_CHARSET_HOOK, parse_charset_hook,
47 N_("Define charset alias for languages"),
48 N_("charset-hook <alias> <charset>"),
49 "configuration.html#charset-hook" },
50 { "crypt-hook", CMD_CRYPT_HOOK, parse_crypt_hook,
51 N_("Specify which keyid to use for recipients matching regex"),
52 N_("crypt-hook <regex> <keyid>"),
53 "configuration.html#crypt-hook" },
54 { "fcc-hook", CMD_FCC_HOOK, parse_mailbox_hook,
55 N_("Pattern rule to set the save location for outgoing mail"),
56 N_("fcc-hook <pattern> <mailbox>"),
57 "configuration.html#default-save-mailbox" },
58 { "fcc-save-hook", CMD_FCC_SAVE_HOOK, parse_mailbox_hook,
59 N_("Equivalent to both `fcc-hook` and `save-hook`"),
60 N_("fcc-save-hook <pattern> <mailbox>"),
61 "configuration.html#default-save-mailbox" },
62 { "folder-hook", CMD_FOLDER_HOOK, parse_folder_hook,
63 N_("Run a command upon entering a folder matching regex"),
64 N_("folder-hook [ -noregex ] <regex> <command>"),
65 "configuration.html#folder-hook" },
66 { "iconv-hook", CMD_ICONV_HOOK, parse_charset_hook,
67 N_("Define a system-specific alias for a character set"),
68 N_("iconv-hook <charset> <local-charset>"),
69 "configuration.html#charset-hook" },
70 { "index-format-hook", CMD_INDEX_FORMAT_HOOK, parse_index_hook,
71 N_("Create dynamic index format strings"),
72 N_("index-format-hook <name> [!]<pattern> <format-string>"),
73 "configuration.html#index-format-hook" },
74 { "mbox-hook", CMD_MBOX_HOOK, parse_mbox_hook,
75 N_("On leaving a mailbox, move read messages matching a regex"),
76 N_("mbox-hook [ -noregex ] <regex> <mailbox>"),
77 "configuration.html#mbox-hook" },
78 { "message-hook", CMD_MESSAGE_HOOK, parse_pattern_hook,
79 N_("Run a command when viewing a message matching patterns"),
80 N_("message-hook <pattern> <command>"),
81 "configuration.html#message-hook" },
82 { "reply-hook", CMD_REPLY_HOOK, parse_pattern_hook,
83 N_("Run a command when replying to messages matching a pattern"),
84 N_("reply-hook <pattern> <command>"),
85 "configuration.html#send-hook" },
86 { "save-hook", CMD_SAVE_HOOK, parse_mailbox_hook,
87 N_("Set default save folder for messages"),
88 N_("save-hook <pattern> <mailbox>"),
89 "configuration.html#default-save-mailbox" },
90 { "send-hook", CMD_SEND_HOOK, parse_pattern_hook,
91 N_("Run a command when sending a message, new or reply, matching a pattern"),
92 N_("send-hook <pattern> <command>"),
93 "configuration.html#send-hook" },
94 { "send2-hook", CMD_SEND2_HOOK, parse_pattern_hook,
95 N_("Run command whenever a composed message is edited"),
96 N_("send2-hook <pattern> <command>"),
97 "configuration.html#send-hook" },
98 { "shutdown-hook", CMD_SHUTDOWN_HOOK, parse_global_hook,
99 N_("Run a command before NeoMutt exits"),
100 N_("shutdown-hook <command>"),
101 "optionalfeatures.html#global-hooks" },
102 { "startup-hook", CMD_STARTUP_HOOK, parse_global_hook,
103 N_("Run a command when NeoMutt starts up"),
104 N_("startup-hook <command>"),
105 "optionalfeatures.html#global-hooks" },
106 { "timeout-hook", CMD_TIMEOUT_HOOK, parse_global_hook,
107 N_("Run a command after a specified timeout or idle period"),
108 N_("timeout-hook <command>"),
109 "optionalfeatures.html#global-hooks" },
110 { "unhook", CMD_UNHOOK, parse_unhook,
111 N_("Remove hooks of a given type"),
112 N_("unhook { * | <hook-type> }"),
113 "configuration.html#unhook" },
114
115 { "hooks", CMD_HOOKS, parse_hooks,
116 N_("Show a list of all the hooks"),
117 N_("hooks"),
118 "advancedusage.html#hooks" },
119
120 // Deprecated
121 { "pgp-hook", CMD_NONE, NULL, "crypt-hook", NULL, NULL, CF_SYNONYM },
122
123 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
124 // clang-format on
125};
#define CF_SYNONYM
Command is a synonym for another command.
Definition command.h:49
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_SEND_HOOK
:send-hook
Definition command.h:107
@ CMD_FCC_SAVE_HOOK
:fcc-save-hook
Definition command.h:76
@ CMD_ICONV_HOOK
:iconv-hook
Definition command.h:82
@ CMD_INDEX_FORMAT_HOOK
:index-format-hook
Definition command.h:86
@ CMD_SHUTDOWN_HOOK
:shutdown-hook
Definition command.h:110
@ CMD_FCC_HOOK
:fcc-hook
Definition command.h:75
@ CMD_MESSAGE_HOOK
:message-hook
Definition command.h:94
@ CMD_SEND2_HOOK
:send2-hook
Definition command.h:106
@ CMD_REPLY_HOOK
:reply-hook
Definition command.h:102
@ CMD_STARTUP_HOOK
:startup-hook
Definition command.h:115
@ CMD_CHARSET_HOOK
:charset-hook
Definition command.h:69
@ CMD_HOOKS
:hooks
Definition command.h:81
@ CMD_NONE
No Command.
Definition command.h:59
@ CMD_SAVE_HOOK
:save-hook
Definition command.h:104
@ CMD_TIMEOUT_HOOK
:timeout-hook
Definition command.h:121
@ CMD_ACCOUNT_HOOK
:account-hook
Definition command.h:60
@ CMD_CRYPT_HOOK
:crypt-hook
Definition command.h:72
@ CMD_MBOX_HOOK
:mbox-hook
Definition command.h:93
@ CMD_FOLDER_HOOK
:folder-hook
Definition command.h:78
@ CMD_UNHOOK
:unhook
Definition command.h:132
Convenience wrapper for the core headers.
enum CommandResult parse_pattern_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse pattern-based Hook commands - Implements Command::parse() -.
Definition parse.c:183
enum CommandResult parse_folder_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse folder hook command - Implements Command::parse() -.
Definition parse.c:527
enum CommandResult parse_regex_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse regex-based hook command - Implements Command::parse() -.
Definition parse.c:432
enum CommandResult parse_hooks(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'hooks' command - Implements Command::parse() -.
Definition dump.c:224
enum CommandResult parse_unhook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the unhook command - Implements Command::parse() -.
Definition parse.c:1184
enum CommandResult parse_crypt_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse crypt hook commands - Implements Command::parse() -.
Definition parse.c:666
enum CommandResult parse_mailbox_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse mailbox pattern hook commands - Implements Command::parse() -.
Definition parse.c:353
enum CommandResult parse_charset_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse charset Hook commands - Implements Command::parse() -.
Definition parse.c:64
enum CommandResult parse_mbox_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse mbox hook command - Implements Command::parse() -.
Definition parse.c:761
enum CommandResult parse_global_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse global Hook commands - Implements Command::parse() -.
Definition parse.c:118
enum CommandResult parse_index_hook(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the index format hook command - Implements Command::parse() -.
Definition parse.c:1061
const struct Command HooksCommands[]
Hook Commands.
Definition commands.c:40
Hook Commands.
Dump the Hooks to the Pager.
Parse user-defined Hooks.
Convenience wrapper for the library headers.
#define N_(a)
Definition message.h:32