NeoMutt  2024-04-25-85-g27bab4
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 73 of file functions.c.

74{
75 struct Menu *menu = pd->menu;
76 struct MailboxView *mv = pd->mailbox_view;
77 struct Mailbox *m = mv->mailbox;
78
79 const int index = menu_get_index(menu);
80 /* should deleted draft messages be saved in the trash folder? */
81 mutt_set_flag(m, m->emails[index], MUTT_DELETE, (op == OP_DELETE), true);
83 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
84 if (c_resolve && (index < (menu->max - 1)))
85 {
86 menu_set_index(menu, index + 1);
87 if (index >= (menu->top + menu->page_len))
88 {
89 menu->top = index;
91 }
92 }
93 else
94 {
96 }
97
98 return FR_SUCCESS;
99}
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: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:57
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:56
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:58
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
@ MUTT_DELETE
Messages to be deleted.
Definition: mutt.h:75
short PostCount
Number of postponed (draft) emails.
Definition: postpone.c:59
View of a Mailbox.
Definition: mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:51
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:79
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
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
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 104 of file functions.c.

105{
106 pd->done = true;
107 return FR_SUCCESS;
108}
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 113 of file functions.c.

114{
115 int index = menu_get_index(pd->menu);
116 struct MailboxView *mv = pd->mailbox_view;
117 struct Mailbox *m = mv->mailbox;
118 pd->email = m->emails[index];
119 pd->done = true;
120 return FR_SUCCESS;
121}
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 126 of file functions.c.

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