NeoMutt  2024-12-12-14-g7b49f7
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 117 of file dlg_alias.c.

118{
119 const struct AliasMenuData *mdata = menu->mdata;
120 const struct AliasViewArray *ava = &mdata->ava;
121 struct AliasView *av = ARRAY_GET(ava, line);
122
123 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
124 if (c_arrow_cursor)
125 {
126 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
127 if (max_cols > 0)
128 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
129 }
130
131 const struct Expando *c_alias_format = cs_subset_expando(mdata->sub, "alias_format");
132 return expando_filter(c_alias_format, AliasRenderCallbacks, av,
133 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
134}
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.
Definition: config_type.c:357
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:443
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
Definition: filter.c:138
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: render.h:37
AliasView array wrapper with Pattern information -.
Definition: gui.h:54
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:55
struct Menu * menu
Menu.
Definition: gui.h:58
struct ConfigSubset * sub
Config items.
Definition: gui.h:57
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:87
void * mdata
Private data.
Definition: lib.h:147
+ 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 146 of file dlg_query.c.

147{
148 const struct AliasMenuData *mdata = menu->mdata;
149 const struct AliasViewArray *ava = &mdata->ava;
150 struct AliasView *av = ARRAY_GET(ava, line);
151
152 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
153 if (c_arrow_cursor)
154 {
155 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
156 if (max_cols > 0)
157 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
158 }
159
160 const struct Expando *c_query_format = cs_subset_expando(mdata->sub, "query_format");
161 return expando_filter(c_query_format, QueryRenderCallbacks, av,
162 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
163}
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, buf);
149}
const struct ExpandoRenderCallback AttachRenderCallbacks[]
Callbacks for Attachment Expandos.
Definition: expando.c:378
A set of attachments.
Definition: attach.h:63
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:67
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:71
Private state data for Attachments.
Definition: private_data.h:36
struct Menu * menu
Current Menu.
Definition: private_data.h:37
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:38
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
+ 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 119 of file dlg_autocrypt.c.

120{
121 struct AutocryptData *ad = menu->mdata;
122 struct AccountEntry **pentry = ARRAY_GET(&ad->entries, line);
123 if (!pentry)
124 return 0;
125
126 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
127 if (c_arrow_cursor)
128 {
129 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
130 if (max_cols > 0)
131 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
132 }
133
134 const struct Expando *c_autocrypt_acct_format = cs_subset_expando(NeoMutt->sub, "autocrypt_acct_format");
135 return expando_filter(c_autocrypt_acct_format, AutocryptRenderCallbacks,
136 *pentry, MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
137}
const struct ExpandoRenderCallback AutocryptRenderCallbacks[]
Callbacks for Autocrypt Expandos.
Definition: expando.c:121
An entry in the Autocrypt account Menu.
Definition: private.h:46
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 514 of file dlg_browser.c.

515{
516 struct BrowserPrivateData *priv = menu->mdata;
517 struct BrowserState *bstate = &priv->state;
518 struct BrowserEntryArray *entry = &bstate->entry;
519 struct Folder folder = {
520 .ff = ARRAY_GET(entry, line),
521 .num = line,
522 };
523
524 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
525 if (c_arrow_cursor)
526 {
527 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
528 if (max_cols > 0)
529 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
530 }
531
532 if (OptNews)
533 {
534 const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
535 return expando_filter(c_group_index_format, GroupIndexRenderCallbacks,
536 &folder, MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
537 }
538
539 if (bstate->is_mailbox_list)
540 {
541 const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
542 return expando_filter(c_mailbox_folder_format, FolderRenderCallbacks,
543 &folder, MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
544 }
545
546 const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
547 return expando_filter(c_folder_format, FolderRenderCallbacks, &folder,
548 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
549}
const struct ExpandoRenderCallback FolderRenderCallbacks[]
Callbacks for Browser Expandos.
Definition: expando.c:482
const struct ExpandoRenderCallback GroupIndexRenderCallbacks[]
Callbacks for Nntp Browser Expandos.
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:67
Private state data for the Browser.
Definition: private_data.h:34
struct Menu * menu
Menu.
Definition: private_data.h:43
struct BrowserState state
State containing list of files/dir/mailboxes.
Definition: private_data.h:42
State of the file/mailbox browser.
Definition: lib.h:144
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:148
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:145
A folder/dir in the browser.
Definition: lib.h:69
struct FolderFile * ff
File / Dir / Mailbox.
Definition: lib.h:70
+ 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 218 of file attach.c.

219{
220 struct ComposeAttachData *adata = menu->mdata;
221 struct AttachCtx *actx = adata->actx;
222 struct ComposeSharedData *shared = menu->win->parent->wdata;
223 struct ConfigSubset *sub = shared->sub;
224
225 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
226 if (c_arrow_cursor)
227 {
228 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
229 if (max_cols > 0)
230 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
231 }
232
233 const struct Expando *c_attach_format = cs_subset_expando(sub, "attach_format");
234 return expando_filter(c_attach_format, AttachRenderCallbacks,
235 (actx->idx[actx->v2r[line]]),
237}
#define MUTT_FORMAT_STAT_FILE
Used by attach_format_str.
Definition: render.h:36
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:36
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:37
A set of inherited config items.
Definition: subset.h:47
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
+ 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 133 of file dlg_verifycert.c.

134{
135 struct CertMenuData *mdata = menu->mdata;
136
137 menu->current = -1; /* hide menubar */
138
139 int total_cols = 0;
140
141 const char **line_ptr = ARRAY_GET(mdata->carr, line);
142 if (line_ptr)
143 {
144 const int bytes = buf_addstr(buf, *line_ptr);
145 total_cols = mutt_strnwidth(buf_string(buf), bytes);
146 }
147
148 return total_cols;
149}
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:456
Certificate data to use in the Menu.
Definition: ssl.h:42
struct CertArray * carr
Lines of the Certificate.
Definition: ssl.h:43
int current
Current entry.
Definition: lib.h:80
+ 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, buf);
109}
const struct ExpandoRenderCallback HistoryRenderCallbacks[]
Callbacks for History Expandos.
Definition: expando.c:63
Data to pass to the History Functions.
Definition: functions.h:37
struct Menu * menu
History Menu.
Definition: functions.h:41
struct HistoryArray * matches
History entries.
Definition: functions.h:42
A line in the History menu.
Definition: lib.h:67
+ 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 825 of file dlg_index.c.

826{
827 if (!menu || !menu->mdata)
828 return 0;
829
830 struct IndexPrivateData *priv = menu->mdata;
831 struct IndexSharedData *shared = priv->shared;
832 struct Mailbox *m = shared->mailbox;
833 if (!shared->mailbox_view)
834 menu->current = -1;
835
836 if (!m || (line < 0) || (line >= m->email_max))
837 return 0;
838
839 struct Email *e = mutt_get_virt_email(m, line);
840 if (!e)
841 return 0;
842
844 struct MuttThread *tmp = NULL;
845
846 const enum UseThreads c_threads = mutt_thread_style();
847 if ((c_threads > UT_FLAT) && e->tree && e->thread)
848 {
849 flags |= MUTT_FORMAT_TREE; /* display the thread tree */
850 if (e->display_subject)
851 {
852 flags |= MUTT_FORMAT_FORCESUBJ;
853 }
854 else
855 {
856 const bool reverse = c_threads == UT_REVERSE;
857 int edgemsgno;
858 if (reverse)
859 {
860 if (menu->top + menu->page_len > menu->max)
861 edgemsgno = m->v2r[menu->max - 1];
862 else
863 edgemsgno = m->v2r[menu->top + menu->page_len - 1];
864 }
865 else
866 {
867 edgemsgno = m->v2r[menu->top];
868 }
869
870 for (tmp = e->thread->parent; tmp; tmp = tmp->parent)
871 {
872 if (!tmp->message)
873 continue;
874
875 /* if no ancestor is visible on current screen, provisionally force
876 * subject... */
877 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
878 {
879 flags |= MUTT_FORMAT_FORCESUBJ;
880 break;
881 }
882 else if (tmp->message->vnum >= 0)
883 {
884 break;
885 }
886 }
887 if (flags & MUTT_FORMAT_FORCESUBJ)
888 {
889 for (tmp = e->thread->prev; tmp; tmp = tmp->prev)
890 {
891 if (!tmp->message)
892 continue;
893
894 /* ...but if a previous sibling is available, don't force it */
895 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
896 {
897 break;
898 }
899 else if (tmp->message->vnum >= 0)
900 {
901 flags &= ~MUTT_FORMAT_FORCESUBJ;
902 break;
903 }
904 }
905 }
906 }
907 }
908
909 const struct Expando *c_index_format = cs_subset_expando(shared->sub, "index_format");
910 int msg_in_pager = shared->mailbox_view ? shared->mailbox_view->msg_in_pager : 0;
911
912 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
913 if (c_arrow_cursor)
914 {
915 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
916 if (max_cols > 0)
917 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
918 }
919
920 return mutt_make_string(buf, max_cols, c_index_format, m, msg_in_pager, e, flags, NULL);
921}
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:803
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:81
UseThreads
Which threading style is active, $use_threads.
Definition: mutt_thread.h:97
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:99
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:101
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:417
#define MUTT_FORMAT_FORCESUBJ
Print the subject even if unchanged.
Definition: render.h:34
#define MUTT_FORMAT_INDEX
This is a main index entry.
Definition: render.h:38
#define MUTT_FORMAT_TREE
Draw the thread tree.
Definition: render.h:35
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: render.h:32
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.
Definition: private_data.h:35
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:40
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:41
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:79
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:98
int email_max
Size of emails array.
Definition: mailbox.h:97
int top
Entry that is the top of the current page.
Definition: lib.h:90
int max
Number of entries in the menu.
Definition: lib.h:81
int page_len
Number of entries per screen.
Definition: lib.h:84
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,
126 &entry, MUTT_FORMAT_ARROWCURSOR, max_cols, 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, buf);
126}
const struct ExpandoRenderCallback PgpEntryRenderCallbacks[]
PgpEntryRenderCallbacks- Callbacks for PGP Key Expandos.
Definition: expando_pgp.c:331
Data to pass to the Pgp Functions.
Definition: pgp_functions.h:34
struct Menu * menu
Pgp Menu.
Definition: pgp_functions.h:36
struct PgpUidArray * key_table
Array of Keys.
Definition: pgp_functions.h:37
An entry in a PGP key menu.
Definition: private.h:39
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 110 of file dlg_smime.c.

111{
112 struct SmimeData *sd = menu->mdata;
113 struct SmimeKey **pkey = ARRAY_GET(sd->ska, line);
114 if (!pkey)
115 return 0;
116
117 char *truststate = NULL;
118 switch ((*pkey)->trust)
119 {
120 case 'e':
121 /* L10N: Describes the trust state of a S/MIME key.
122 This translation must be padded with spaces to the right such that it
123 has the same length as the other translations.
124 The translation strings which need to be padded are:
125 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
126 truststate = _("Expired ");
127 break;
128 case 'i':
129 /* L10N: Describes the trust state of a S/MIME key.
130 This translation must be padded with spaces to the right such that it
131 has the same length as the other translations.
132 The translation strings which need to be padded are:
133 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
134 truststate = _("Invalid ");
135 break;
136 case 'r':
137 /* L10N: Describes the trust state of a S/MIME key.
138 This translation must be padded with spaces to the right such that it
139 has the same length as the other translations.
140 The translation strings which need to be padded are:
141 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
142 truststate = _("Revoked ");
143 break;
144 case 't':
145 /* L10N: Describes the trust state of a S/MIME key.
146 This translation must be padded with spaces to the right such that it
147 has the same length as the other translations.
148 The translation strings which need to be padded are:
149 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
150 truststate = _("Trusted ");
151 break;
152 case 'u':
153 /* L10N: Describes the trust state of a S/MIME key.
154 This translation must be padded with spaces to the right such that it
155 has the same length as the other translations.
156 The translation strings which need to be padded are:
157 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
158 truststate = _("Unverified");
159 break;
160 case 'v':
161 /* L10N: Describes the trust state of a S/MIME key.
162 This translation must be padded with spaces to the right such that it
163 has the same length as the other translations.
164 The translation strings which need to be padded are:
165 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
166 truststate = _("Verified ");
167 break;
168 default:
169 /* L10N: Describes the trust state of a S/MIME key.
170 This translation must be padded with spaces to the right such that it
171 has the same length as the other translations.
172 The translation strings which need to be padded are:
173 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
174 truststate = _("Unknown ");
175 }
176
177 int bytes = buf_printf(buf, " 0x%s %s %s %-35.35s %s", (*pkey)->hash,
178 smime_key_flags((*pkey)->flags), truststate,
179 (*pkey)->email, (*pkey)->label);
180 if (bytes < 0)
181 bytes = 0;
182
183 return mutt_strnwidth(buf_string(buf), bytes);
184}
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:88
#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, buf);
119}
const struct ExpandoRenderCallback PatternRenderCallbacks[]
Callbacks for Pattern Expandos.
Definition: expando.c:75
Data to pass to the Pattern Functions.
Definition: pattern_data.h:47
struct Menu * menu
Pattern Menu.
Definition: pattern_data.h:51
struct PatternEntryArray entries
Patterns for the Menu.
Definition: pattern_data.h:52
A line in the Pattern Completion menu.
Definition: pattern_data.h:35
+ 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 102 of file dlg_postpone.c.

103{
104 struct PostponeData *pd = menu->mdata;
105 struct MailboxView *mv = pd->mailbox_view;
106 struct Mailbox *m = mv->mailbox;
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_index_format = cs_subset_expando(NeoMutt->sub, "index_format");
117 return mutt_make_string(buf, max_cols, c_index_format, m, -1, m->emails[line],
119}
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:96
Data to pass to the Postpone Functions.
Definition: functions.h:34
struct MailboxView * mailbox_view
Postponed Mailbox view.
Definition: functions.h:35
struct Menu * menu
Postponed Menu.
Definition: functions.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function: