NeoMutt  2023-11-03-85-g512e01
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Postpone Function API

Prototype for a Postpone Function. More...

+ Collaboration diagram for Postpone Function API:

Functions

static int op_delete (struct PostponeData *pd, int op)
 Delete the current entry - Implements postpone_function_t -.
 
static int op_exit (struct PostponeData *pd, int op)
 Exit this menu - Implements postpone_function_t -.
 
static int op_generic_select_entry (struct PostponeData *pd, int op)
 Select the current entry - Implements postpone_function_t -.
 
static int op_search (struct PostponeData *pd, int op)
 Search for a regular expression - Implements postpone_function_t -.
 

Detailed Description

Prototype for a Postpone Function.

Parameters
menuMenu
opOperation to perform, e.g. OP_DELETE
Return values
enumFunctionRetval

Function Documentation

◆ op_delete()

static int op_delete ( struct PostponeData pd,
int  op 
)
static

Delete the current entry - Implements postpone_function_t -.

Definition at line 72 of file functions.c.

73{
74 struct Menu *menu = pd->menu;
75 struct MailboxView *mv = pd->mailbox_view;
76 struct Mailbox *m = mv->mailbox;
77
78 const int index = menu_get_index(menu);
79 /* should deleted draft messages be saved in the trash folder? */
80 mutt_set_flag(m, m->emails[index], MUTT_DELETE, (op == OP_DELETE), true);
82 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
83 if (c_resolve && (index < (menu->max - 1)))
84 {
85 menu_set_index(menu, index + 1);
86 if (index >= (menu->top + menu->page_len))
87 {
88 menu->top = index;
90 }
91 }
92 else
93 {
95 }
96
97 return FR_SUCCESS;
98}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition: flags.c:53
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:57
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:180
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:156
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:59
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:170
@ MUTT_DELETE
Messages to be deleted.
Definition: mutt.h:74
short PostCount
Number of postponed (draft) emails.
Definition: postpone.c:56
View of a Mailbox.
Definition: mview.h:39
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:50
A mailbox.
Definition: mailbox.h:79
int msg_count
Total number of messages.
Definition: mailbox.h:88
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:93
Definition: lib.h:70
int top
Entry that is the top of the current page.
Definition: lib.h:81
int max
Number of entries in the menu.
Definition: lib.h:72
int page_len
Number of entries per screen.
Definition: lib.h:75
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
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:

◆ op_exit()

static int op_exit ( struct PostponeData pd,
int  op 
)
static

Exit this menu - Implements postpone_function_t -.

Definition at line 103 of file functions.c.

104{
105 pd->done = true;
106 return FR_SUCCESS;
107}
bool done
Should we close the Dialog?
Definition: functions.h:38

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct PostponeData pd,
int  op 
)
static

Select the current entry - Implements postpone_function_t -.

Definition at line 112 of file functions.c.

113{
114 int index = menu_get_index(pd->menu);
115 struct MailboxView *mv = pd->mailbox_view;
116 struct Mailbox *m = mv->mailbox;
117 pd->email = m->emails[index];
118 pd->done = true;
119 return FR_SUCCESS;
120}
struct Email * email
Selected Email.
Definition: functions.h:37
+ Here is the call graph for this function:

◆ op_search()

static int op_search ( struct PostponeData pd,
int  op 
)
static

Search for a regular expression - Implements postpone_function_t -.

Definition at line 125 of file functions.c.

126{
128 switch (op)
129 {
130 case OP_SEARCH:
131 flags |= SEARCH_PROMPT;
132 pd->search_state->reverse = false;
133 break;
134 case OP_SEARCH_REVERSE:
135 flags |= SEARCH_PROMPT;
136 pd->search_state->reverse = true;
137 break;
138 case OP_SEARCH_NEXT:
139 break;
140 case OP_SEARCH_OPPOSITE:
141 flags |= SEARCH_OPPOSITE;
142 break;
143 }
144
145 int index = menu_get_index(pd->menu);
146 struct MailboxView *mv = pd->mailbox_view;
147 index = mutt_search_command(mv, pd->menu, index, pd->search_state, flags);
148 if (index != -1)
149 menu_set_index(pd->menu, index);
150
151 return FR_SUCCESS;
152}
int mutt_search_command(struct MailboxView *mv, struct Menu *menu, int cur, struct SearchState *state, SearchFlags flags)
Perform a search.
Definition: pattern.c:438
#define SEARCH_OPPOSITE
Search in the opposite direction.
Definition: search_state.h:45
uint8_t SearchFlags
Flags for a specific search, e.g. SEARCH_PROMPT.
Definition: search_state.h:42
#define SEARCH_NO_FLAGS
No flags are set.
Definition: search_state.h:43
#define SEARCH_PROMPT
Ask for search input.
Definition: search_state.h:44
struct SearchState * search_state
State of the current search.
Definition: functions.h:39
bool reverse
search backwards
Definition: search_state.h:39
+ Here is the call graph for this function: