NeoMutt  2025-12-11-872-g385a04
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
make_entry()

Format a item for a menu. More...

+ Collaboration diagram for make_entry():

Functions

static int alias_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Alias for the Menu - Implements Menu::make_entry() -.
 
static int query_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Alias for the Menu - Implements Menu::make_entry() -.
 
static int attach_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Attachment for the Menu - Implements Menu::make_entry() -.
 
static int autocrypt_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Autocrypt Account for the Menu - Implements Menu::make_entry() -.
 
static int folder_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format a Folder for the Menu - Implements Menu::make_entry() -.
 
static int compose_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Attachment for the Menu - Implements Menu::make_entry() -.
 
static int cert_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Create a Certificate for the Menu - Implements Menu::make_entry() -.
 
static int history_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format a History Item for the Menu - Implements Menu::make_entry() -.
 
int index_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Email for the Menu - Implements Menu::make_entry() -.
 
static int crypt_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format a PGP Key for the Menu - Implements Menu::make_entry() -.
 
static int pgp_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format a PGP Key for the Menu - Implements Menu::make_entry() -.
 
static int smime_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an S/MIME Key for the Menu - Implements Menu::make_entry() -.
 
static int pattern_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Create a Pattern for the Menu - Implements Menu::make_entry() -.
 
static int post_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Email for the Menu - Implements Menu::make_entry() -.
 

Detailed Description

Format a item for a menu.

Parameters
[in]menuMenu containing items
[in]lineMenu line number
[in]max_colsMaximum number of screen columns to use
[out]bufBuffer for the result
Return values
numNumber of screen columns used

Function Documentation

◆ alias_make_entry()

static int alias_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Alias for the Menu - Implements Menu::make_entry() -.

See also
$alias_format

Definition at line 118 of file dlg_alias.c.

119{
120 const struct AliasMenuData *mdata = menu->mdata;
121 const struct AliasViewArray *ava = &mdata->ava;
122 struct AliasView *av = ARRAY_GET(ava, line);
123
124 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
125 if (c_arrow_cursor)
126 {
127 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
128 if (max_cols > 0)
129 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
130 }
131
132 const struct Expando *c_alias_format = cs_subset_expando(mdata->sub, "alias_format");
133 return expando_filter(c_alias_format, AliasRenderCallbacks, av,
134 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
135}
const struct ExpandoRenderCallback AliasRenderCallbacks[]
Callbacks for Alias Expandos.
Definition expando.c:187
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:446
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.
Definition filter.c:139
@ MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition render.h:41
AliasView array wrapper with Pattern information -.
Definition gui.h:55
struct AliasViewArray ava
All Aliases/Queries.
Definition gui.h:56
struct Menu * menu
Menu.
Definition gui.h:59
struct ConfigSubset * sub
Config items.
Definition gui.h:58
GUI data wrapping an Alias.
Definition gui.h:38
Parsed Expando trees.
Definition expando.h:41
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:95
void * mdata
Private data.
Definition lib.h:155
Container for Accounts, Notifications.
Definition neomutt.h:41
char ** env
Private copy of the environment variables.
Definition neomutt.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_make_entry()

static int query_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Alias for the Menu - Implements Menu::make_entry() -.

See also
$query_format

Definition at line 145 of file dlg_query.c.

146{
147 const struct AliasMenuData *mdata = menu->mdata;
148 const struct AliasViewArray *ava = &mdata->ava;
149 struct AliasView *av = ARRAY_GET(ava, line);
150
151 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
152 if (c_arrow_cursor)
153 {
154 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
155 if (max_cols > 0)
156 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
157 }
158
159 const struct Expando *c_query_format = cs_subset_expando(mdata->sub, "query_format");
160 return expando_filter(c_query_format, QueryRenderCallbacks, av,
161 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
162}
const struct ExpandoRenderCallback QueryRenderCallbacks[]
Callbacks for Query Expandos.
Definition expando.c:207
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_make_entry()

static int attach_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Attachment for the Menu - Implements Menu::make_entry() -.

See also
$attach_format

Definition at line 132 of file dlg_attach.c.

133{
134 struct AttachPrivateData *priv = menu->mdata;
135 struct AttachCtx *actx = priv->actx;
136
137 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
138 if (c_arrow_cursor)
139 {
140 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
141 if (max_cols > 0)
142 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
143 }
144
145 const struct Expando *c_attach_format = cs_subset_expando(NeoMutt->sub, "attach_format");
146 return expando_filter(c_attach_format, AttachRenderCallbacks,
147 (actx->idx[actx->v2r[line]]), MUTT_FORMAT_ARROWCURSOR,
148 max_cols, NeoMutt->env, buf);
149}
const struct ExpandoRenderCallback AttachRenderCallbacks[]
Callbacks for Attachment Expandos.
Definition expando.c:375
A set of attachments.
Definition attach.h:65
struct AttachPtr ** idx
Array of attachments.
Definition attach.h:69
short * v2r
Mapping from virtual to real attachment.
Definition attach.h:73
Private state data for Attachments.
struct Menu * menu
Current Menu.
struct AttachCtx * actx
List of all Attachments.
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_make_entry()

static int autocrypt_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Autocrypt Account for the Menu - Implements Menu::make_entry() -.

See also
$autocrypt_acct_format

Definition at line 120 of file dlg_autocrypt.c.

121{
122 struct AutocryptData *ad = menu->mdata;
123 struct AccountEntry **pentry = ARRAY_GET(&ad->entries, line);
124 if (!pentry)
125 return 0;
126
127 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
128 if (c_arrow_cursor)
129 {
130 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
131 if (max_cols > 0)
132 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
133 }
134
135 const struct Expando *c_autocrypt_acct_format = cs_subset_expando(NeoMutt->sub, "autocrypt_acct_format");
136 return expando_filter(c_autocrypt_acct_format, AutocryptRenderCallbacks, *pentry,
137 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
138}
const struct ExpandoRenderCallback AutocryptRenderCallbacks[]
Callbacks for Autocrypt Expandos.
Definition expando.c:121
An entry in the Autocrypt account Menu.
Definition private.h:45
Data to pass to the Autocrypt Functions.
struct Menu * menu
Autocrypt Menu.
struct AccountEntryArray entries
Account Entries.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ folder_make_entry()

static int folder_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format a Folder for the Menu - Implements Menu::make_entry() -.

See also
$folder_format, $group_index_format, $mailbox_folder_format

Definition at line 488 of file dlg_browser.c.

489{
490 struct BrowserPrivateData *priv = menu->mdata;
491 struct BrowserState *bstate = &priv->state;
492 struct BrowserEntryArray *entry = &bstate->entry;
493 struct Folder folder = {
494 .ff = ARRAY_GET(entry, line),
495 .num = line,
496 };
497
498 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
499 if (c_arrow_cursor)
500 {
501 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
502 if (max_cols > 0)
503 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
504 }
505
506 if (OptNews)
507 {
508 const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
509 return expando_filter(c_group_index_format, GroupIndexRenderCallbacks, &folder,
510 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
511 }
512
513 if (bstate->is_mailbox_list)
514 {
515 const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
516 return expando_filter(c_mailbox_folder_format, FolderRenderCallbacks, &folder,
517 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
518 }
519
520 const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
521 return expando_filter(c_folder_format, FolderRenderCallbacks, &folder,
522 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
523}
const struct ExpandoRenderCallback FolderRenderCallbacks[]
Callbacks for Browser Expandos.
Definition expando.c:478
const struct ExpandoRenderCallback GroupIndexRenderCallbacks[]
Callbacks for Nntp Browser Expandos.
bool OptNews
(pseudo) used to change reader mode
Definition globals.c:53
Private state data for the Browser.
struct Menu * menu
Menu.
struct BrowserState state
State containing list of files/dir/mailboxes.
State of the file/mailbox browser.
Definition lib.h:148
bool is_mailbox_list
Viewing mailboxes.
Definition lib.h:152
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition lib.h:149
A folder/dir in the browser.
Definition lib.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_make_entry()

static int compose_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Attachment for the Menu - Implements Menu::make_entry() -.

See also
$attach_format

Definition at line 219 of file attach.c.

220{
221 struct ComposeAttachData *adata = menu->mdata;
222 struct AttachCtx *actx = adata->actx;
223 struct ComposeSharedData *shared = menu->win->parent->wdata;
224 struct ConfigSubset *sub = shared->sub;
225
226 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
227 if (c_arrow_cursor)
228 {
229 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
230 if (max_cols > 0)
231 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
232 }
233
234 const struct Expando *c_attach_format = cs_subset_expando(sub, "attach_format");
235 return expando_filter(c_attach_format, AttachRenderCallbacks,
236 (actx->idx[actx->v2r[line]]),
238 max_cols, NeoMutt->env, buf);
239}
@ MUTT_FORMAT_STAT_FILE
Used by attach_format_str.
Definition render.h:40
Data to fill the Compose Attach Window.
Definition attach_data.h:33
struct Menu * menu
Menu displaying the attachments.
Definition attach_data.h:35
struct AttachCtx * actx
Set of attachments.
Definition attach_data.h:34
Shared Compose Data.
Definition shared_data.h:35
struct ConfigSubset * sub
Config set to use.
Definition shared_data.h:36
A set of inherited config items.
Definition subset.h:46
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
void * wdata
Private data.
struct MuttWindow * parent
Parent Window.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cert_make_entry()

static int cert_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Create a Certificate for the Menu - Implements Menu::make_entry() -.

Definition at line 132 of file dlg_verifycert.c.

133{
134 struct CertMenuData *mdata = menu->mdata;
135
136 int total_cols = 0;
137
138 const char **line_ptr = ARRAY_GET(mdata->carr, line);
139 if (line_ptr)
140 {
141 const int bytes = buf_addstr(buf, *line_ptr);
142 total_cols = mutt_strnwidth(buf_string(buf), bytes);
143 }
144
145 return total_cols;
146}
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
size_t mutt_strnwidth(const char *s, size_t n)
Measure a string's width in screen cells.
Definition curs_lib.c:459
Certificate data to use in the Menu.
Definition ssl.h:37
struct StringArray * carr
Lines of the Certificate.
Definition ssl.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ history_make_entry()

static int history_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format a History Item for the Menu - Implements Menu::make_entry() -.

Definition at line 88 of file dlg_history.c.

89{
90 struct HistoryData *hd = menu->mdata;
91
92 const char **pentry = ARRAY_GET(hd->matches, line);
93 if (!pentry)
94 return 0;
95
96 struct HistoryEntry h = { line, *pentry };
97
98 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
99 if (c_arrow_cursor)
100 {
101 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
102 if (max_cols > 0)
103 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
104 }
105
106 const struct Expando *c_history_format = cs_subset_expando(NeoMutt->sub, "history_format");
107 return expando_filter(c_history_format, HistoryRenderCallbacks, &h,
108 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
109}
const struct ExpandoRenderCallback HistoryRenderCallbacks[]
Callbacks for History Expandos.
Definition expando.c:63
Data to pass to the History Functions.
Definition functions.h:35
struct Menu * menu
History Menu.
Definition functions.h:39
struct StringArray * matches
History entries.
Definition functions.h:40
A line in the History menu.
Definition lib.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_make_entry()

int index_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )

Format an Email for the Menu - Implements Menu::make_entry() -.

See also
$index_format

Definition at line 847 of file dlg_index.c.

848{
849 if (!menu || !menu->mdata)
850 return 0;
851
852 struct IndexPrivateData *priv = menu->mdata;
853 struct IndexSharedData *shared = priv->shared;
854 struct Mailbox *m = shared->mailbox;
855 if (!shared->mailbox_view)
856 menu->current = -1;
857
858 if (!m || (line < 0) || (line >= m->email_max))
859 return 0;
860
861 struct Email *e = mutt_get_virt_email(m, line);
862 if (!e)
863 return 0;
864
866 struct MuttThread *tmp = NULL;
867
868 const enum UseThreads c_threads = mutt_thread_style();
869 if ((c_threads > UT_FLAT) && e->tree && e->thread)
870 {
871 flags |= MUTT_FORMAT_TREE; /* display the thread tree */
872 if (e->display_subject)
873 {
874 flags |= MUTT_FORMAT_FORCESUBJ;
875 }
876 else
877 {
878 const bool reverse = c_threads == UT_REVERSE;
879 int edgemsgno;
880 if (reverse)
881 {
882 if (menu->top + menu->page_len > menu->max)
883 edgemsgno = m->v2r[menu->max - 1];
884 else
885 edgemsgno = m->v2r[menu->top + menu->page_len - 1];
886 }
887 else
888 {
889 edgemsgno = m->v2r[menu->top];
890 }
891
892 for (tmp = e->thread->parent; tmp; tmp = tmp->parent)
893 {
894 if (!tmp->message)
895 continue;
896
897 /* if no ancestor is visible on current screen, provisionally force
898 * subject... */
899 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
900 {
901 flags |= MUTT_FORMAT_FORCESUBJ;
902 break;
903 }
904 else if (tmp->message->vnum >= 0)
905 {
906 break;
907 }
908 }
909 if (flags & MUTT_FORMAT_FORCESUBJ)
910 {
911 for (tmp = e->thread->prev; tmp; tmp = tmp->prev)
912 {
913 if (!tmp->message)
914 continue;
915
916 /* ...but if a previous sibling is available, don't force it */
917 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
918 {
919 break;
920 }
921 else if (tmp->message->vnum >= 0)
922 {
923 flags &= ~MUTT_FORMAT_FORCESUBJ;
924 break;
925 }
926 }
927 }
928 }
929 }
930
931 const struct Expando *c_index_format = cs_subset_expando(shared->sub, "index_format");
932 int msg_in_pager = shared->mailbox_view ? shared->mailbox_view->msg_in_pager : 0;
933
934 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
935 if (c_arrow_cursor)
936 {
937 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
938 if (max_cols > 0)
939 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
940 }
941
942 return mutt_make_string(buf, max_cols, c_index_format, m, msg_in_pager, e, flags, NULL);
943}
int mutt_make_string(struct Buffer *buf, size_t max_cols, const struct Expando *exp, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
Definition dlg_index.c:824
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition thread.c:79
UseThreads
Which threading style is active, $use_threads.
Definition thread.h:102
@ UT_FLAT
Unthreaded.
Definition thread.h:104
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition thread.h:106
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:376
@ MUTT_FORMAT_INDEX
This is a main index entry.
Definition render.h:42
@ MUTT_FORMAT_TREE
Draw the thread tree.
Definition render.h:39
@ MUTT_FORMAT_FORCESUBJ
Print the subject even if unchanged.
Definition render.h:38
uint8_t MuttFormatFlags
Definition render.h:45
The envelope/body of an email.
Definition email.h:39
bool display_subject
Used for threading.
Definition email.h:101
char * tree
Character string to print thread tree.
Definition email.h:125
int vnum
Virtual message number.
Definition email.h:114
int msgno
Number displayed to the user.
Definition email.h:111
struct MuttThread * thread
Thread of Emails.
Definition email.h:119
Private state data for the Index.
struct IndexSharedData * shared
Shared Index data.
struct Menu * menu
Menu controlling the index.
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
struct ConfigSubset * sub
Config set to use.
Definition shared_data.h:38
struct MailboxView * mailbox_view
Current Mailbox view.
Definition shared_data.h:40
int msg_in_pager
Message currently shown in the pager.
Definition mview.h:45
A mailbox.
Definition mailbox.h:81
int * v2r
Mapping from virtual to real msgno.
Definition mailbox.h:100
int email_max
Size of emails array.
Definition mailbox.h:99
int current
Current entry.
Definition lib.h:87
int top
Entry that is the top of the current page.
Definition lib.h:98
int max
Number of entries in the menu.
Definition lib.h:88
int page_len
Number of entries per screen.
Definition lib.h:91
An Email conversation.
Definition thread.h:34
struct MuttThread * parent
Parent of this Thread.
Definition thread.h:44
struct MuttThread * prev
Previous sibling Thread.
Definition thread.h:47
struct Email * message
Email this Thread refers to.
Definition thread.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_make_entry()

static int crypt_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format a PGP Key for the Menu - Implements Menu::make_entry() -.

See also
$pgp_entry_format

Definition at line 107 of file dlg_gpgme.c.

108{
109 struct GpgmeData *gd = menu->mdata;
110 struct CryptKeyInfo **pinfo = ARRAY_GET(gd->key_table, line);
111 if (!pinfo)
112 return 0;
113
114 struct CryptEntry entry = { line + 1, *pinfo };
115
116 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
117 if (c_arrow_cursor)
118 {
119 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
120 if (max_cols > 0)
121 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
122 }
123
124 const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
125 return expando_filter(c_pgp_entry_format, PgpEntryGpgmeRenderCallbacks, &entry,
126 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
127}
const struct ExpandoRenderCallback PgpEntryGpgmeRenderCallbacks[]
Callbacks for GPGME Key Expandos.
An entry in the Select-Key menu.
Definition crypt_gpgme.h:86
A stored PGP key.
Definition crypt_gpgme.h:44
Data to pass to the Gpgme Functions.
struct CryptKeyInfoArray * key_table
Array of Keys.
struct Menu * menu
Gpgme Menu.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_make_entry()

static int pgp_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format a PGP Key for the Menu - Implements Menu::make_entry() -.

See also
$pgp_entry_format

Definition at line 106 of file dlg_pgp.c.

107{
108 struct PgpData *pd = menu->mdata;
109 struct PgpUid **puid = ARRAY_GET(pd->key_table, line);
110 if (!*puid)
111 return 0;
112
113 struct PgpEntry entry = { line + 1, *puid };
114
115 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
116 if (c_arrow_cursor)
117 {
118 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
119 if (max_cols > 0)
120 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
121 }
122
123 const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
124 return expando_filter(c_pgp_entry_format, PgpEntryRenderCallbacks, &entry,
125 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
126}
const struct ExpandoRenderCallback PgpEntryRenderCallbacks[]
PgpEntryRenderCallbacks- Callbacks for PGP Key Expandos.
Data to pass to the Pgp Functions.
struct Menu * menu
Pgp Menu.
struct PgpUidArray * key_table
Array of Keys.
An entry in a PGP key menu.
Definition private.h:38
PGP User ID.
Definition pgplib.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ smime_make_entry()

static int smime_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an S/MIME Key for the Menu - Implements Menu::make_entry() -.

Definition at line 111 of file dlg_smime.c.

112{
113 struct SmimeData *sd = menu->mdata;
114 struct SmimeKey **pkey = ARRAY_GET(sd->ska, line);
115 if (!pkey)
116 return 0;
117
118 char *truststate = NULL;
119 switch ((*pkey)->trust)
120 {
121 case 'e':
122 /* L10N: Describes the trust state of a S/MIME key.
123 This translation must be padded with spaces to the right such that it
124 has the same length as the other translations.
125 The translation strings which need to be padded are:
126 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
127 truststate = _("Expired ");
128 break;
129 case 'i':
130 /* L10N: Describes the trust state of a S/MIME key.
131 This translation must be padded with spaces to the right such that it
132 has the same length as the other translations.
133 The translation strings which need to be padded are:
134 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
135 truststate = _("Invalid ");
136 break;
137 case 'r':
138 /* L10N: Describes the trust state of a S/MIME key.
139 This translation must be padded with spaces to the right such that it
140 has the same length as the other translations.
141 The translation strings which need to be padded are:
142 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
143 truststate = _("Revoked ");
144 break;
145 case 't':
146 /* L10N: Describes the trust state of a S/MIME key.
147 This translation must be padded with spaces to the right such that it
148 has the same length as the other translations.
149 The translation strings which need to be padded are:
150 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
151 truststate = _("Trusted ");
152 break;
153 case 'u':
154 /* L10N: Describes the trust state of a S/MIME key.
155 This translation must be padded with spaces to the right such that it
156 has the same length as the other translations.
157 The translation strings which need to be padded are:
158 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
159 truststate = _("Unverified");
160 break;
161 case 'v':
162 /* L10N: Describes the trust state of a S/MIME key.
163 This translation must be padded with spaces to the right such that it
164 has the same length as the other translations.
165 The translation strings which need to be padded are:
166 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
167 truststate = _("Verified ");
168 break;
169 default:
170 /* L10N: Describes the trust state of a S/MIME key.
171 This translation must be padded with spaces to the right such that it
172 has the same length as the other translations.
173 The translation strings which need to be padded are:
174 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
175 truststate = _("Unknown ");
176 }
177
178 int bytes = buf_printf(buf, " 0x%s %s %s %-35.35s %s", (*pkey)->hash,
179 smime_key_flags((*pkey)->flags), truststate,
180 (*pkey)->email, (*pkey)->label);
181 if (bytes < 0)
182 bytes = 0;
183
184 return mutt_strnwidth(buf_string(buf), bytes);
185}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
static char * smime_key_flags(KeyFlags flags)
Turn SMIME key flags into a string.
Definition dlg_smime.c:89
#define _(a)
Definition message.h:28
Data to pass to the Smime Functions.
struct Menu * menu
Smime Menu.
struct SmimeKeyArray * ska
Array of Keys.
An SIME key.
Definition smime.h:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_make_entry()

static int pattern_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Create a Pattern for the Menu - Implements Menu::make_entry() -.

See also
$pattern_format

Definition at line 102 of file dlg_pattern.c.

103{
104 struct PatternData *pd = menu->mdata;
105
106 struct PatternEntry *entry = ARRAY_GET(&pd->entries, line);
107
108 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
109 if (c_arrow_cursor)
110 {
111 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
112 if (max_cols > 0)
113 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
114 }
115
116 const struct Expando *c_pattern_format = cs_subset_expando(NeoMutt->sub, "pattern_format");
117 return expando_filter(c_pattern_format, PatternRenderCallbacks, entry,
118 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
119}
const struct ExpandoRenderCallback PatternRenderCallbacks[]
Callbacks for Pattern Expandos.
Definition expando.c:75
Data to pass to the Pattern Functions.
struct Menu * menu
Pattern Menu.
struct PatternEntryArray entries
Patterns for the Menu.
A line in the Pattern Completion menu.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ post_make_entry()

static int post_make_entry ( struct Menu * menu,
int line,
int max_cols,
struct Buffer * buf )
static

Format an Email for the Menu - Implements Menu::make_entry() -.

See also
$index_format

Definition at line 103 of file dlg_postpone.c.

104{
105 struct PostponeData *pd = menu->mdata;
106 struct MailboxView *mv = pd->mailbox_view;
107 struct Mailbox *m = mv->mailbox;
108
109 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
110 if (c_arrow_cursor)
111 {
112 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
113 if (max_cols > 0)
114 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
115 }
116
117 const struct Expando *c_index_format = cs_subset_expando(NeoMutt->sub, "index_format");
118 return mutt_make_string(buf, max_cols, c_index_format, m, -1, m->emails[line],
120}
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
Data to pass to the Postpone Functions.
Definition functions.h:35
struct MailboxView * mailbox_view
Postponed Mailbox view.
Definition functions.h:36
struct Menu * menu
Postponed Menu.
Definition functions.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: