NeoMutt  2024-04-25-85-g27bab4
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 mix_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format a Remailer 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 221 of file dlg_alias.c.

222{
223 const struct AliasMenuData *mdata = menu->mdata;
224 const struct AliasViewArray *ava = &mdata->ava;
225 struct AliasView *av = ARRAY_GET(ava, line);
226
227 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
228 if (c_arrow_cursor)
229 {
230 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
231 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
232 }
233
234 const struct Expando *c_alias_format = cs_subset_expando(mdata->sub, "alias_format");
235 return expando_filter(c_alias_format, AliasRenderData, av,
236 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
237}
#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
const struct ExpandoRenderData AliasRenderData[]
Callbacks for Alias Expandos.
Definition: dlg_alias.c:97
int expando_filter(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
Definition: filter.c:141
#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 231 of file dlg_query.c.

232{
233 const struct AliasMenuData *mdata = menu->mdata;
234 const struct AliasViewArray *ava = &mdata->ava;
235 struct AliasView *av = ARRAY_GET(ava, line);
236
237 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
238 if (c_arrow_cursor)
239 {
240 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
241 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
242 }
243
244 const struct Expando *c_query_format = cs_subset_expando(mdata->sub, "query_format");
245 return expando_filter(c_query_format, QueryRenderData, av,
246 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
247}
const struct ExpandoRenderData QueryRenderData[]
Callbacks for Query Expandos.
Definition: dlg_query.c:98
+ 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 465 of file dlg_attach.c.

466{
467 struct AttachPrivateData *priv = menu->mdata;
468 struct AttachCtx *actx = priv->actx;
469
470 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
471 if (c_arrow_cursor)
472 {
473 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
474 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
475 }
476
477 const struct Expando *c_attach_format = cs_subset_expando(NeoMutt->sub, "attach_format");
478 return expando_filter(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
479 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
480}
const struct ExpandoRenderData AttachRenderData[]
Callbacks for Attachment Expandos.
Definition: dlg_attach.c:621
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.
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 197 of file dlg_autocrypt.c.

198{
199 struct AccountEntry *entry = &((struct AccountEntry *) menu->mdata)[line];
200
201 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
202 if (c_arrow_cursor)
203 {
204 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
205 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
206 }
207
208 const struct Expando *c_autocrypt_acct_format = cs_subset_expando(NeoMutt->sub, "autocrypt_acct_format");
209 return expando_filter(c_autocrypt_acct_format, AutocryptRenderData, entry,
210 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
211}
const struct ExpandoRenderData AutocryptRenderData[]
Callbacks for Autocrypt Expandos.
Definition: dlg_autocrypt.c:85
An entry in the Autocrypt account Menu.
Definition: private.h:45
+ 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 959 of file dlg_browser.c.

960{
961 struct BrowserState *bstate = menu->mdata;
962 struct BrowserEntryArray *entry = &bstate->entry;
963 struct Folder folder = {
964 .ff = ARRAY_GET(entry, line),
965 .num = line,
966 };
967
968 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
969 if (c_arrow_cursor)
970 {
971 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
972 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
973 }
974
975 if (OptNews)
976 {
977 const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
978 return expando_filter(c_group_index_format, GroupIndexRenderData, &folder,
979 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
980 }
981
982 if (bstate->is_mailbox_list)
983 {
984 const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
985 return expando_filter(c_mailbox_folder_format, FolderRenderData, &folder,
986 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
987 }
988
989 const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
990 return expando_filter(c_folder_format, FolderRenderData, &folder,
991 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
992}
const struct ExpandoRenderData GroupIndexRenderData[]
Callbacks for Nntp Browser Expandos.
Definition: dlg_browser.c:110
const struct ExpandoRenderData FolderRenderData[]
Callbacks for Browser Expandos.
Definition: dlg_browser.c:109
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:70
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 217 of file attach.c.

218{
219 struct ComposeAttachData *adata = menu->mdata;
220 struct AttachCtx *actx = adata->actx;
221 struct ComposeSharedData *shared = menu->win->parent->wdata;
222 struct ConfigSubset *sub = shared->sub;
223
224 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
225 if (c_arrow_cursor)
226 {
227 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
228 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
229 }
230
231 const struct Expando *c_attach_format = cs_subset_expando(sub, "attach_format");
232 return expando_filter(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
234}
#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:35
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:36
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 111 of file dlg_history.c.

112{
113 char *entry = ((char **) menu->mdata)[line];
114
115 struct HistoryEntry h = { line, entry };
116
117 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
118 if (c_arrow_cursor)
119 {
120 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
121 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
122 }
123
124 const struct Expando *c_history_format = cs_subset_expando(NeoMutt->sub, "history_format");
125 return expando_filter(c_history_format, HistoryRenderData, &h,
126 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
127}
const struct ExpandoRenderData HistoryRenderData[]
Callbacks for History Expandos.
Definition: dlg_history.c:73
A line in the History menu.
Definition: lib.h:65
+ 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 797 of file dlg_index.c.

798{
799 if (!menu || !menu->mdata)
800 return 0;
801
802 struct IndexPrivateData *priv = menu->mdata;
803 struct IndexSharedData *shared = priv->shared;
804 struct Mailbox *m = shared->mailbox;
805 if (!shared->mailbox_view)
806 menu->current = -1;
807
808 if (!m || (line < 0) || (line >= m->email_max))
809 return 0;
810
811 struct Email *e = mutt_get_virt_email(m, line);
812 if (!e)
813 return 0;
814
816 struct MuttThread *tmp = NULL;
817
818 const enum UseThreads c_threads = mutt_thread_style();
819 if ((c_threads > UT_FLAT) && e->tree && e->thread)
820 {
821 flags |= MUTT_FORMAT_TREE; /* display the thread tree */
822 if (e->display_subject)
823 {
824 flags |= MUTT_FORMAT_FORCESUBJ;
825 }
826 else
827 {
828 const bool reverse = c_threads == UT_REVERSE;
829 int edgemsgno;
830 if (reverse)
831 {
832 if (menu->top + menu->page_len > menu->max)
833 edgemsgno = m->v2r[menu->max - 1];
834 else
835 edgemsgno = m->v2r[menu->top + menu->page_len - 1];
836 }
837 else
838 {
839 edgemsgno = m->v2r[menu->top];
840 }
841
842 for (tmp = e->thread->parent; tmp; tmp = tmp->parent)
843 {
844 if (!tmp->message)
845 continue;
846
847 /* if no ancestor is visible on current screen, provisionally force
848 * subject... */
849 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
850 {
851 flags |= MUTT_FORMAT_FORCESUBJ;
852 break;
853 }
854 else if (tmp->message->vnum >= 0)
855 {
856 break;
857 }
858 }
859 if (flags & MUTT_FORMAT_FORCESUBJ)
860 {
861 for (tmp = e->thread->prev; tmp; tmp = tmp->prev)
862 {
863 if (!tmp->message)
864 continue;
865
866 /* ...but if a previous sibling is available, don't force it */
867 if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno))
868 {
869 break;
870 }
871 else if (tmp->message->vnum >= 0)
872 {
873 flags &= ~MUTT_FORMAT_FORCESUBJ;
874 break;
875 }
876 }
877 }
878 }
879 }
880
881 const struct Expando *c_index_format = cs_subset_expando(shared->sub, "index_format");
882 int msg_in_pager = shared->mailbox_view ? shared->mailbox_view->msg_in_pager : 0;
883
884 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
885 if (c_arrow_cursor)
886 {
887 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
888 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
889 }
890
891 return mutt_make_string(buf, max_cols, c_index_format, m, msg_in_pager, e, flags, NULL);
892}
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: hdrline.c:1796
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:82
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:418
#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:104
char * tree
Character string to print thread tree.
Definition: email.h:128
int vnum
Virtual message number.
Definition: email.h:117
int msgno
Number displayed to the user.
Definition: email.h:114
struct MuttThread * thread
Thread of Emails.
Definition: email.h:122
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:

◆ mix_make_entry()

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

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

See also
$mix_entry_format

Definition at line 161 of file win_hosts.c.

162{
163 struct RemailerArray *ra = menu->mdata;
164 struct Remailer **r = ARRAY_GET(ra, line);
165 if (!r)
166 return 0;
167
168 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
169 if (c_arrow_cursor)
170 {
171 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
172 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
173 }
174
175 const struct Expando *c_mix_entry_format = cs_subset_expando(NeoMutt->sub, "mix_entry_format");
176 return expando_filter(c_mix_entry_format, MixRenderData, *r,
177 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
178}
A Mixmaster remailer.
Definition: remailer.h:40
const struct ExpandoRenderData MixRenderData[]
Callbacks for Mixmaster Expandos.
Definition: win_hosts.c:58
+ 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 540 of file dlg_gpgme.c.

541{
542 struct CryptKeyInfo **key_table = menu->mdata;
543 struct CryptEntry entry = { 0 };
544
545 entry.key = key_table[line];
546 entry.num = line + 1;
547
548 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
549 if (c_arrow_cursor)
550 {
551 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
552 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
553 }
554
555 const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
556 return expando_filter(c_pgp_entry_format, PgpEntryGpgmeRenderData, &entry,
557 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
558}
const struct ExpandoRenderData PgpEntryGpgmeRenderData[]
Callbacks for GPGME Key Expandos.
Definition: dlg_gpgme.c:93
An entry in the Select-Key menu.
Definition: crypt_gpgme.h:85
struct CryptKeyInfo * key
Key.
Definition: crypt_gpgme.h:87
size_t num
Index number.
Definition: crypt_gpgme.h:86
A stored PGP key.
Definition: crypt_gpgme.h:44
+ 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 534 of file dlg_pgp.c.

535{
536 struct PgpUid **key_table = menu->mdata;
537
538 struct PgpEntry entry = { 0 };
539 entry.uid = key_table[line];
540 entry.num = line + 1;
541
542 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
543 if (c_arrow_cursor)
544 {
545 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
546 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
547 }
548
549 const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
550 return expando_filter(c_pgp_entry_format, PgpEntryRenderData, &entry,
551 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
552}
const struct ExpandoRenderData PgpEntryRenderData[]
PgpEntryRenderData- Callbacks for PGP Key Expandos.
Definition: dlg_pgp.c:91
An entry in a PGP key menu.
Definition: private.h:39
struct PgpUid * uid
PGP Key info.
Definition: private.h:41
size_t num
Index number.
Definition: private.h:40
PGP User ID.
Definition: pgplib.h:35
+ 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 SmimeKey **table = menu->mdata;
113 struct SmimeKey *key = table[line];
114 char *truststate = NULL;
115 switch (key->trust)
116 {
117 case 'e':
118 /* L10N: Describes the trust state of a S/MIME key.
119 This translation must be padded with spaces to the right such that it
120 has the same length as the other translations.
121 The translation strings which need to be padded are:
122 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
123 truststate = _("Expired ");
124 break;
125 case 'i':
126 /* L10N: Describes the trust state of a S/MIME key.
127 This translation must be padded with spaces to the right such that it
128 has the same length as the other translations.
129 The translation strings which need to be padded are:
130 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
131 truststate = _("Invalid ");
132 break;
133 case 'r':
134 /* L10N: Describes the trust state of a S/MIME key.
135 This translation must be padded with spaces to the right such that it
136 has the same length as the other translations.
137 The translation strings which need to be padded are:
138 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
139 truststate = _("Revoked ");
140 break;
141 case 't':
142 /* L10N: Describes the trust state of a S/MIME key.
143 This translation must be padded with spaces to the right such that it
144 has the same length as the other translations.
145 The translation strings which need to be padded are:
146 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
147 truststate = _("Trusted ");
148 break;
149 case 'u':
150 /* L10N: Describes the trust state of a S/MIME key.
151 This translation must be padded with spaces to the right such that it
152 has the same length as the other translations.
153 The translation strings which need to be padded are:
154 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
155 truststate = _("Unverified");
156 break;
157 case 'v':
158 /* L10N: Describes the trust state of a S/MIME key.
159 This translation must be padded with spaces to the right such that it
160 has the same length as the other translations.
161 The translation strings which need to be padded are:
162 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
163 truststate = _("Verified ");
164 break;
165 default:
166 /* L10N: Describes the trust state of a S/MIME key.
167 This translation must be padded with spaces to the right such that it
168 has the same length as the other translations.
169 The translation strings which need to be padded are:
170 Expired, Invalid, Revoked, Trusted, Unverified, Verified, and Unknown. */
171 truststate = _("Unknown ");
172 }
173
174 int bytes = buf_printf(buf, " 0x%s %s %s %-35.35s %s", key->hash,
175 smime_key_flags(key->flags), truststate, key->email, key->label);
176 if (bytes < 0)
177 bytes = 0;
178
179 return mutt_strnwidth(buf_string(buf), bytes);
180}
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
An SIME key.
Definition: smime.h:43
KeyFlags flags
Definition: smime.h:49
char * hash
Definition: smime.h:45
char * email
Definition: smime.h:44
char * label
Definition: smime.h:46
char trust
i=Invalid r=revoked e=expired u=unverified v=verified t=trusted
Definition: smime.h:48
+ 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 136 of file dlg_pattern.c.

137{
138 struct PatternEntry *entry = &((struct PatternEntry *) menu->mdata)[line];
139
140 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
141 if (c_arrow_cursor)
142 {
143 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
144 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
145 }
146
147 const struct Expando *c_pattern_format = cs_subset_expando(NeoMutt->sub, "pattern_format");
148 return expando_filter(c_pattern_format, PatternRenderData, entry,
149 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
150}
const struct ExpandoRenderData PatternRenderData[]
Callbacks for Pattern Expandos.
Definition: dlg_pattern.c:85
A line in the Pattern Completion menu.
Definition: private.h:37
+ 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 MailboxView *mv = menu->mdata;
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 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
113 }
114
115 const struct Expando *c_index_format = cs_subset_expando(NeoMutt->sub, "index_format");
116 return mutt_make_string(buf, max_cols, c_index_format, m, -1, m->emails[line],
118}
View of a Mailbox.
Definition: mview.h:40
struct Menu * menu
Needed for pattern compilation.
Definition: mview.h:47
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:51
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function: