46 static char Counter =
'A';
49 Counter = (Counter ==
'Z') ?
'A' : Counter + 1;
59 return mid->
tm.tm_mday;
80 return mid->
tm.tm_hour;
90 return mid->
tm.tm_min;
100 return mid->
tm.tm_mon + 1;
121 buf_printf(buf,
"%02x", (
unsigned char) raw[0]);
145 char raw[12] = { 0 };
146 char enc[20] = { 0 };
152 for (
int i = 0; i < 4; i++)
153 raw[i] = (uint8_t) (mid->
now >> (3 - i) * 8u);
168 return mid->
tm.tm_sec;
178 return mid->
tm.tm_year + 1900;
200 { -1, -1, NULL, NULL },
229 const int ID_LEFT_LEN = 50;
230 const int ID_RIGHT_LEN = 12;
231 char rnd_id_left[ID_LEFT_LEN + 1];
232 char rnd_id_right[ID_RIGHT_LEN + 1];
233 char buf[128] = { 0 };
237 rnd_id_left[ID_LEFT_LEN] = 0;
238 rnd_id_right[ID_RIGHT_LEN] = 0;
240 snprintf(buf,
sizeof(buf),
"<%s@%s>", rnd_id_left, rnd_id_right);
253 if (!c_message_id_format)
258 mid.
now = time(NULL);
275 if (
buf_at(buf, 0) !=
'<')
278 const int last =
buf_len(buf) - 1;
279 if (
buf_at(buf, last) !=
'>')
size_t mutt_b64_encode_urlsafe(const char *in, size_t inlen, char *out, size_t outlen)
Convert raw bytes to a URL-safe base64 string.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_insert(struct Buffer *buf, size_t offset, const char *s)
Add a string in the middle of a buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
@ ED_MSG_ID
Message Id ED_MSG_ ExpandoDataMsgId.
Structs that make up an email.
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, char **env_list, struct Buffer *buf)
Render an Expando and run the result through a filter.
static char * msgid_gen_random(void)
Generate a random Message ID.
const struct ExpandoRenderCallback MsgIdRenderCallbacks[]
Callbacks for Message Id Expandos.
char * msgid_generate(void)
Generate a Message-Id.
Message Id Expando definitions.
@ ED_MSG_COUNTER
Step counter looping from 'A' to 'Z'.
@ ED_MSG_SECOND
Current year using 4 digits (GMT)
@ ED_MSG_YEAR
4 byte timestamp + 8 bytes of pseudo-random data encoded in Base64
@ ED_MSG_HOUR
Current hour using a 24-hour clock (GMT)
@ ED_MSG_PID
PID of the running mutt process.
@ ED_MSG_RANDOM_1
3 bytes of pseudo-random data encoded in Base64
@ ED_MSG_MINUTE
Current month number (GMT)
@ ED_MSG_RANDOM_3
Current second of the minute (GMT)
@ ED_MSG_DAY
Current day of the month (GMT)
@ ED_MSG_HOSTNAME
$hostname
@ ED_MSG_MONTH
Current minute of the hour (GMT)
@ ED_MSG_RANDOM_12
1 byte of pseudo-random data hex encoded (example: '1b')
char * ShortHostname
Short version of the hostname.
static long msgid_minute_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Minute - Implements get_number_t -.
static long msgid_second_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Second - Implements get_number_t -.
static long msgid_year_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Year (4 digit) - Implements get_number_t -.
static long msgid_day_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Day - Implements get_number_t -.
static long msgid_pid_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Process Id - Implements get_number_t -.
static long msgid_hour_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Hour - Implements get_number_t -.
static long msgid_month_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Message Id: Month - Implements get_number_t -.
static void msgid_random_3(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Message Id: 3 Random Bytes of Base64 - Implements get_string_t -.
static void msgid_hostname(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Message Id: Hostname - Implements get_string_t -.
static void msgid_random_1(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Message Id: 1 Random Hex Byte - Implements get_string_t -.
static void msgid_counter(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Message Id: Step Counter - Implements get_string_t -.
static void msgid_random_12(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Message Id: Timestamp + 8 Random Bytes of Base64 - Implements get_string_t -.
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
int mutt_randbuf(void *buf, size_t buflen)
Fill a buffer with randomness.
void mutt_rand_base32(char *buf, size_t buflen)
Fill a buffer with a base32-encoded random string.
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
Miscellaneous functions for sending an email.
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
Data to generate a Message-Id.
struct tm tm
Time Now (tm)
time_t now
Time Now (seconds)
const char * fqdn
Fully-qualified Domain Name.
Container for Accounts, Notifications.
char ** env
Private copy of the environment variables.
struct ConfigSubset * sub
Inherited config items.