forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmutt.h
156 lines (137 loc) · 5.61 KB
/
mutt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/**
* @file
* Many unsorted constants and some structs
*
* @authors
* Copyright (C) 1996-2002,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUTT_MUTT_H
#define MUTT_MUTT_H
#include <stddef.h>
#include <limits.h>
#include <regex.h>
#include <stdbool.h>
#include <stdint.h>
#include "config/lib.h"
#include "mutt_commands.h"
struct Buffer;
struct ListHead;
struct Mapping;
/* On OS X 10.5.x, wide char functions are inlined by default breaking
* --without-wc-funcs compilation
*/
#ifdef __APPLE_CC__
#define _DONT_USE_CTYPE_INLINE_
#endif
/* PATH_MAX is undefined on the hurd */
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#ifdef HAVE_FGETS_UNLOCKED
#define fgets fgets_unlocked
#endif
#ifdef HAVE_FGETC_UNLOCKED
#define fgetc fgetc_unlocked
#endif
typedef uint16_t CompletionFlags; ///< Flags for mutt_enter_string_full(), e.g. #MUTT_ALIAS
#define MUTT_COMP_NO_FLAGS 0 ///< No flags are set
#define MUTT_ALIAS (1 << 0) ///< Do alias "completion" by calling up the alias-menu
#define MUTT_FILE (1 << 1) ///< Do file completion
#define MUTT_EFILE (1 << 2) ///< Do file completion, plus incoming folders
#define MUTT_CMD (1 << 3) ///< Do completion on previous word
#define MUTT_PASS (1 << 4) ///< Password mode (no echo)
#define MUTT_CLEAR (1 << 5) ///< Clear input if printable character is pressed
#define MUTT_COMMAND (1 << 6) ///< Do command completion
#define MUTT_PATTERN (1 << 7) ///< Pattern mode - only used for history classes
#define MUTT_LABEL (1 << 8) ///< Do label completion
#define MUTT_NM_QUERY (1 << 9) ///< Notmuch query mode.
#define MUTT_NM_TAG (1 << 10) ///< Notmuch tag +/- mode.
typedef uint16_t TokenFlags; ///< Flags for mutt_extract_token(), e.g. #MUTT_TOKEN_EQUAL
#define MUTT_TOKEN_NO_FLAGS 0 ///< No flags are set
#define MUTT_TOKEN_EQUAL (1 << 0) ///< Treat '=' as a special
#define MUTT_TOKEN_CONDENSE (1 << 1) ///< ^(char) to control chars (macros)
#define MUTT_TOKEN_SPACE (1 << 2) ///< Don't treat whitespace as a term
#define MUTT_TOKEN_QUOTE (1 << 3) ///< Don't interpret quotes
#define MUTT_TOKEN_PATTERN (1 << 4) ///< !)|~ are terms (for patterns)
#define MUTT_TOKEN_COMMENT (1 << 5) ///< Don't reap comments
#define MUTT_TOKEN_SEMICOLON (1 << 6) ///< Don't treat ; as special
#define MUTT_TOKEN_BACKTICK_VARS (1 << 7) ///< Expand variables within backticks
#define MUTT_TOKEN_NOSHELL (1 << 8) ///< Don't expand environment variables
#define MUTT_TOKEN_QUESTION (1 << 9) ///< Treat '?' as a special
/**
* enum MessageType - To set flags or match patterns
*
* @sa mutt_set_flag(), mutt_pattern_func()
*/
enum MessageType
{
MUTT_ALL = 1, ///< All messages
MUTT_NONE, ///< No messages
MUTT_NEW, ///< New messages
MUTT_OLD, ///< Old messages
MUTT_REPLIED, ///< Messages that have been replied to
MUTT_READ, ///< Messages that have been read
MUTT_UNREAD, ///< Unread messages
MUTT_DELETE, ///< Messages to be deleted
MUTT_UNDELETE, ///< Messages to be un-deleted
MUTT_PURGE, ///< Messages to be purged (bypass trash)
MUTT_DELETED, ///< Deleted messages
MUTT_FLAG, ///< Flagged messages
MUTT_TAG, ///< Tagged messages
MUTT_UNTAG, ///< Messages to be un-tagged
MUTT_LIMIT, ///< Messages in limited view
MUTT_EXPIRED, ///< Expired messages
MUTT_SUPERSEDED, ///< Superseded messages
MUTT_TRASH, ///< Trashed messages
MUTT_MT_MAX,
};
/* flags for parse_spam_list */
#define MUTT_SPAM 1
#define MUTT_NOSPAM 2
int mutt_init(bool skip_sys_rc, struct ListHead *commands);
struct ConfigSet *init_config(size_t size);
/**
* struct AttachMatch - An attachment matching a regex
*
* for attachment counter
*/
struct AttachMatch
{
const char *major;
int major_int;
const char *minor;
regex_t minor_regex;
};
#define EXECSHELL "/bin/sh"
int safe_asprintf(char **, const char *, ...);
char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items);
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags);
void mutt_free_opts(void);
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt);
int mutt_label_complete(char *buf, size_t buflen, int numtabs);
int mutt_command_complete(char *buf, size_t buflen, int pos, int numtabs);
int mutt_var_value_complete(char *buf, size_t buflen, int pos);
void myvar_set(const char *var, const char *val);
bool mutt_nm_query_complete(char *buf, size_t buflen, int pos, int numtabs);
bool mutt_nm_tag_complete(char *buf, size_t buflen, int numtabs);
int mutt_dump_variables(bool hide_sensitive);
int mutt_get_hook_type(const char *name);
enum CommandResult mutt_parse_rc_line(/* const */ char *line, struct Buffer *token, struct Buffer *err);
int mutt_query_variables(struct ListHead *queries);
void reset_value(const char *name);
#endif /* MUTT_MUTT_H */