NeoMutt  2025-12-11-911-gd8d604
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, const struct KeyEvent *event)
 Delete the current entry - Implements postpone_function_t -.
 
static int op_exit (struct PostponeData *pd, const struct KeyEvent *event)
 Exit this menu - Implements postpone_function_t -.
 
static int op_generic_select_entry (struct PostponeData *pd, const struct KeyEvent *event)
 Select the current entry - Implements postpone_function_t -.
 
static int op_search (struct PostponeData *pd, const struct KeyEvent *event)
 Search for a regular expression - Implements postpone_function_t -.
 

Detailed Description

Prototype for a Postpone Function.

Parameters
menuMenu
eventEvent to process
Return values
enumFunctionRetval
Precondition
menu is not NULL
event is not NULL

Function Documentation

◆ op_delete()

static int op_delete ( struct PostponeData * pd,
const struct KeyEvent * event )
static

Delete the current entry - Implements postpone_function_t -.

This function handles:

  • OP_DELETE
  • OP_UNDELETE

Supports repeat-count: 5<delete-entry> deletes the current entry and the next 4. Overruns are silently capped at the end of the list.

Definition at line 174 of file functions.c.

175{
176 struct Menu *menu = pd->menu;
177 struct MailboxView *mv = pd->mailbox_view;
178 struct Mailbox *m = mv->mailbox;
179
180 const int index = menu_get_index(menu);
181 const bool bf = (event->op == OP_DELETE);
182
183 /* should deleted draft messages be saved in the trash folder? */
184 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
185 postpone_add_selection(&ea, menu, m, menu->tag_prefix, event->count);
186 const int num = ARRAY_SIZE(&ea);
187 postpone_apply_set_deleted(m, &ea, bf);
188 ARRAY_FREE(&ea);
189
190 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
191 if (!menu->tag_prefix && c_resolve && ((index + num) < menu->max))
192 {
193 const int new_index = index + num;
194 menu_set_index(menu, new_index);
195 if (new_index >= (menu->top + menu->page_len))
196 {
197 menu->top = new_index;
199 }
200 }
201 else
202 {
203 menu_queue_redraw(menu, (menu->tag_prefix || (num > 1)) ? MENU_REDRAW_INDEX :
205 }
206
207 return FR_SUCCESS;
208}
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:179
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:155
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:63
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:169
static void postpone_apply_set_deleted(struct Mailbox *m, struct EmailArray *ea, bool deleted)
Apply the deleted flag to a working set of Emails.
Definition functions.c:147
static int postpone_add_selection(struct EmailArray *ea, struct Menu *menu, struct Mailbox *m, bool tagged, int count)
Build a working set of Emails for an action.
Definition functions.c:103
int count
Optional count prefix, e.g. 3 for 3j
Definition get.h:78
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:81
Definition lib.h:86
int top
Entry that is the top of the current page.
Definition lib.h:98
bool tag_prefix
User has pressed <tag-prefix>
Definition lib.h:92
int max
Number of entries in the menu.
Definition lib.h:88
int page_len
Number of entries per screen.
Definition lib.h:91
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
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:

◆ op_exit()

static int op_exit ( struct PostponeData * pd,
const struct KeyEvent * event )
static

Exit this menu - Implements postpone_function_t -.

Definition at line 213 of file functions.c.

214{
215 pd->done = true;
216 return FR_SUCCESS;
217}
bool done
Should we close the Dialog?
Definition functions.h:39

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct PostponeData * pd,
const struct KeyEvent * event )
static

Select the current entry - Implements postpone_function_t -.

Definition at line 222 of file functions.c.

223{
224 int index = menu_get_index(pd->menu);
225 struct MailboxView *mv = pd->mailbox_view;
226 struct Mailbox *m = mv->mailbox;
227 pd->email = m->emails[index];
228 pd->done = true;
229 return FR_SUCCESS;
230}
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
struct Email * email
Selected Email.
Definition functions.h:38
+ Here is the call graph for this function:

◆ op_search()

static int op_search ( struct PostponeData * pd,
const struct KeyEvent * event )
static

Search for a regular expression - Implements postpone_function_t -.

This function handles:

  • OP_SEARCH
  • OP_SEARCH_NEXT
  • OP_SEARCH_OPPOSITE
  • OP_SEARCH_REVERSE

Definition at line 241 of file functions.c.

242{
243 SearchFlags flags = SEARCH_NONE;
244 switch (event->op)
245 {
246 case OP_SEARCH:
247 flags |= SEARCH_PROMPT;
248 pd->search_state->reverse = false;
249 break;
250 case OP_SEARCH_REVERSE:
251 flags |= SEARCH_PROMPT;
252 pd->search_state->reverse = true;
253 break;
254 case OP_SEARCH_NEXT:
255 break;
256 case OP_SEARCH_OPPOSITE:
257 flags |= SEARCH_OPPOSITE;
258 break;
259 }
260
261 int index = menu_get_index(pd->menu);
262 struct MailboxView *mv = pd->mailbox_view;
263 index = mutt_search_command(mv, pd->menu, index, pd->search_state, flags);
264 if (index != -1)
265 menu_set_index(pd->menu, index);
266
267 return FR_SUCCESS;
268}
int mutt_search_command(struct MailboxView *mv, struct Menu *menu, int cur, struct SearchState *state, SearchFlags flags)
Perform a search.
Definition pattern.c:462
uint8_t SearchFlags
@ SEARCH_NONE
No flags are set.
@ SEARCH_PROMPT
Ask for search input.
@ SEARCH_OPPOSITE
Search in the opposite direction.
int op
Function opcode, e.g. OP_HELP.
Definition get.h:77
struct SearchState * search_state
State of the current search.
Definition functions.h:40
bool reverse
search backwards
+ Here is the call graph for this function: