82#define MAX_ADDR_ROWS 5
85#define MAX_USER_HDR_ROWS 5
125 N_(
"X-Comment-To: "),
182 static bool done =
false;
217static int calc_address(
struct AddressList *al,
short cols,
short *srows)
224 int width_left = cols;
235 if (addr_len >= width_left)
237 if (width_left == cols)
245 if (addr_len < width_left)
246 width_left -= addr_len;
326 const bool c_compose_show_user_headers =
cs_subset_bool(wdata->
sub,
"compose_show_user_headers");
327 if (c_compose_show_user_headers)
433 const bool c_crypt_opportunistic_encrypt =
cs_subset_bool(wdata->
sub,
"crypt_opportunistic_encrypt");
455 const char *
const c_smime_encrypt_with =
cs_subset_string(wdata->
sub,
"smime_encrypt_with");
501 struct MuttWindow *win,
int row,
size_t max_lines)
510 char more[32] = { 0 };
514 bool in_group =
false;
528 size_t addr_len =
buf_len(buf);
549 more_len = snprintf(more,
sizeof(more),
550 ngettext(
"(+%d more)",
"(+%d more)", count), count);
553 int reserve = ((count > 0) && (lines_used == max_lines)) ? more_len : 0;
555 buf_string(buf), addr_len, width_left, reserve, lines_used);
556 if (addr_len >= (width_left - reserve))
559 if (lines_used == max_lines)
583 if (addr_len < width_left)
588 width_left -= addr_len;
609 for (
int i = lines_used; i < max_lines; i++)
629 const char *overflow_text =
"...";
710 const bool c_compose_show_user_headers =
cs_subset_bool(wdata->
sub,
"compose_show_user_headers");
711 if (c_compose_show_user_headers)
727 if (new_rows != cur_rows)
802 switch (ev_c->
name[0])
914 if (ev_w->
win != win_env)
964 win_env->
wdata = wdata;
size_t mutt_addrlist_write_list(const struct AddressList *al, struct ListHead *list)
Write Addresses to a List.
size_t mutt_addr_write(struct Buffer *buf, struct Address *addr, bool display)
Write a single Address to a buffer.
int mutt_addrlist_count_recips(const struct AddressList *al)
Count the number of Addresses with valid recipients.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Color and attribute parsing.
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
ColorId
List of all coloured objects.
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
@ MT_COLOR_STATUS
Status bar (takes a pattern)
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
@ MT_COLOR_BOLD
Bold text.
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void mutt_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Structs that make up an email.
@ NT_HEADER_CHANGE
An existing header has been changed.
@ NT_HEADER_ADD
Header has been added.
@ NT_HEADER_DELETE
Header has been removed.
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
HeaderField
Ordered list of headers for the compose screen.
@ HDR_SUBJECT
"Subject:" field
@ HDR_REPLYTO
"Reply-To:" field
@ HDR_AUTOCRYPT
"Autocrypt:" and "Recommendation:" fields
@ HDR_FCC
"Fcc:" (save folder) field
@ HDR_ATTACH_TITLE
The "-- Attachments" line.
@ HDR_CRYPT
"Security:" field (encryption/signing info)
@ HDR_CUSTOM_HEADERS
"Headers:" field
@ HDR_FOLLOWUPTO
"Followup-To:" field
@ HDR_XCOMMENTTO
"X-Comment-To:" field
@ HDR_NEWSGROUPS
"Newsgroups:" field
@ HDR_CRYPTINFO
"Sign as:" field (encryption/signing info)
struct EnvelopeWindowData * env_wdata_new(void)
Create new Envelope Data.
static int draw_envelope_addr(int field, struct AddressList *al, struct MuttWindow *win, int row, size_t max_lines)
Write addresses to the compose window.
static const char *const AutocryptRecUiFlags[]
Autocrypt "recommendation" strings.
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
static int HeaderPadding[HDR_ATTACH_TITLE]
Number of padding spaces needed after each of the strings in Prompts after translation.
static void draw_envelope(struct MuttWindow *win, struct EnvelopeWindowData *wdata)
Write the email headers to the compose window.
static void draw_floating(struct MuttWindow *win, int col, int row, const char *text)
Draw a floating label.
const char *const Prompts[]
Names of header fields used in the envelope, e.g. From:, To:
#define MAX_USER_HDR_ROWS
Maximum number of rows to use for the Headers: field.
static int draw_envelope_user_hdrs(struct MuttWindow *win, struct EnvelopeWindowData *wdata, int row)
Write user-defined headers to the compose window.
static int calc_address(struct AddressList *al, short cols, short *srows)
Calculate how many rows an AddressList will need.
struct MuttWindow * env_window_new(struct Email *e, struct Buffer *fcc, struct ConfigSubset *sub)
Create the Envelope Window.
static int MaxHeaderWidth
Widest of the Prompts strings after translation.
static int calc_envelope(struct MuttWindow *win, struct EnvelopeWindowData *wdata)
Calculate how many rows the envelope will need.
static void draw_header_content(struct MuttWindow *win, int row, enum HeaderField field, const char *content)
Draw content on a separate line aligned to header prompt.
static int calc_user_hdrs(const struct ListHead *hdrs)
Calculate how many rows are needed for user-defined headers.
static int calc_security(struct Email *e, short *rows, const struct ConfigSubset *sub)
Calculate how many rows the security info will need.
#define MAX_ADDR_ROWS
Maximum number of rows to use for the To:, Cc:, Bcc: fields.
static void calc_header_width_padding(int idx, const char *header, bool calc_max)
Calculate the width needed for the compose labels.
static int draw_crypt_lines(struct MuttWindow *win, struct EnvelopeWindowData *wdata, int row)
Update the encryption info in the compose window.
static void init_header_padding(void)
Calculate how much padding the compose table will need.
bool OptNewsSend
(pseudo) used to change behavior when posting
#define mutt_debug(LEVEL,...)
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
static int env_recalc(struct MuttWindow *win)
Recalculate the Window data - Implements MuttWindow::recalc() -.
static int env_repaint(struct MuttWindow *win)
Repaint the Window - Implements MuttWindow::repaint() -.
void env_wdata_free(struct MuttWindow *win, void **ptr)
Free the Envelope Data - Implements MuttWindow::wdata_free() -.
Convenience wrapper for the gui headers.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ LL_DEBUG3
Log at debug level 3.
@ LL_DEBUG5
Log at debug level 5.
Convenience wrapper for the library headers.
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
const struct AttrColor * mutt_curses_set_normal_backed_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
#define WA_RECALC
Recalculate the contents of the Window.
@ WT_CUSTOM
Window with a custom drawing function.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
@ NT_WINDOW_DELETE
Window is about to be deleted.
#define WA_REPAINT
Redraw the contents of the Window.
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
API for encryption/signing of emails.
#define SEC_INLINE
Email has an inline signature.
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_SIGN
Email is signed.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
@ NT_ENVELOPE
Envelope has changed, NotifyEnvelope.
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
@ NT_ALL
Register for all notifications.
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.
Progress Bar Window Data.
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FIRST(head)
#define STAILQ_FOREACH(var, head, field)
#define TAILQ_NEXT(elm, field)
#define STAILQ_NEXT(elm, field)
#define STAILQ_FOREACH_FROM(var, head, field)
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
String manipulation buffer.
A set of inherited config items.
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
The envelope/body of an email.
struct Envelope * env
Envelope information.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Data to fill the Envelope Window.
bool is_news
Email is a news article.
struct Buffer * fcc
Where the outgoing Email will be saved.
struct Email * email
Email being composed.
short sec_rows
Number of rows used by the security fields.
short cc_rows
Number of rows used by the 'Cc:' field.
struct ConfigSubset * sub
Inherited config items.
enum AutocryptRec autocrypt_rec
Autocrypt recommendation.
short to_rows
Number of rows used by the 'To:' field.
short bcc_rows
Number of rows used by the 'Bcc:' field.
struct ListHead userhdrs
user defined headers
char *const subject
Email's subject.
struct AddressList to
Email's 'To' list.
char * followup_to
List of 'followup-to' fields.
struct AddressList reply_to
Email's 'reply-to'.
char * x_comment_to
List of 'X-comment-to' fields.
char * newsgroups
List of newsgroups.
struct AddressList cc
Email's 'Cc' list.
struct AddressList bcc
Email's 'Bcc' list.
struct AddressList from
Email's 'From' list.
An Event that happened to a Colour.
enum ColorId cid
Colour ID that has changed.
const char * name
Name of config item that changed.
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
int(* repaint)(struct MuttWindow *win)
struct WindowState state
Current state of the Window.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
short req_rows
Number of rows required.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
struct MuttWindow * parent
Parent Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Container for Accounts, Notifications.
struct Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.
Data passed to a notification function.
void * event_data
Data from notify_send()
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
void * global_data
Data from notify_observer_add()
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.