NeoMutt  2025-12-11-980-ge38c27
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_quit (struct PostponeData *pd, const struct KeyEvent *event)
 Save changes and exit this dialog - 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 171 of file functions.c.

172{
173 struct Menu *menu = pd->menu;
174 struct MailboxView *mv = pd->mailbox_view;
175 struct Mailbox *m = mv->mailbox;
176
177 const int index = menu_get_index(menu);
178 const bool bf = (event->op == OP_DELETE);
179
180 /* should deleted draft messages be saved in the trash folder? */
181 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
182 postpone_add_selection(&ea, menu, m, menu->tag_prefix, event->count);
183 const int num = ARRAY_SIZE(&ea);
184 postpone_apply_set_deleted(m, &ea, bf);
185 ARRAY_FREE(&ea);
186
187 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
188 if (!menu->tag_prefix && c_resolve && ((index + num) < menu->max))
189 {
190 const int new_index = index + num;
191 menu_set_index(menu, new_index);
192 if (new_index >= (menu->top + menu->page_len))
193 {
194 menu->top = new_index;
195 }
196 }
198
199 return FR_SUCCESS;
200}
#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:177
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:153
@ MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:64
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:167
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:144
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:100
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_quit()

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

Save changes and exit this dialog - Implements postpone_function_t -.

Definition at line 205 of file functions.c.

206{
207 pd->done = true;
208 return FR_SUCCESS;
209}
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 214 of file functions.c.

215{
216 int index = menu_get_index(pd->menu);
217 struct MailboxView *mv = pd->mailbox_view;
218 struct Mailbox *m = mv->mailbox;
219 pd->email = m->emails[index];
220 pd->done = true;
221 return FR_SUCCESS;
222}
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 233 of file functions.c.

234{
235 SearchFlags flags = SEARCH_NONE;
236 switch (event->op)
237 {
238 case OP_SEARCH:
239 flags |= SEARCH_PROMPT;
240 pd->search_state->reverse = false;
241 break;
242 case OP_SEARCH_REVERSE:
243 flags |= SEARCH_PROMPT;
244 pd->search_state->reverse = true;
245 break;
246 case OP_SEARCH_NEXT:
247 break;
248 case OP_SEARCH_OPPOSITE:
249 flags |= SEARCH_OPPOSITE;
250 break;
251 }
252
253 int index = menu_get_index(pd->menu);
254 struct MailboxView *mv = pd->mailbox_view;
255 index = mutt_search_command(mv, pd->menu, index, pd->search_state, flags);
256 if (index != -1)
257 menu_set_index(pd->menu, index);
258
259 return FR_SUCCESS;
260}
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: