NeoMutt  2025-12-11-924-g64e75a
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Function Dispatcher API

Prototype for a Function Dispatcher. More...

+ Collaboration diagram for Function Dispatcher API:

Topics

 Alias Function API
 Prototype for a Alias Function.
 
 Attach Function API
 Prototype for a Attach Function.
 
 Autocrypt Function API
 Prototype for a Autocrypt Function.
 
 Compose Function API
 Prototype for a Compose Function.
 
 Preview Function API
 Prototype for a Preview Function.
 
 Envelope Function API
 Prototype for a Envelope Function.
 
 Global Function API
 Prototype for a Global Function.
 
 History Function API
 Prototype for a History Function.
 
 Index Function API
 Prototype for an Index Function.
 
 Menu Function API
 Prototype for a Menu Function.
 
 Gpgme Function API
 Prototype for a Gpgme Function.
 
 Pgp Function API
 Prototype for a Pgp Function.
 
 Smime Function API
 Prototype for a Smime Function.
 
 Pager Function API
 Prototype for a Pager Function.
 
 Pattern Function API
 Prototype for a Pattern Function.
 
 Postpone Function API
 Prototype for a Postpone Function.
 
 Sidebar Function API
 Prototype for a Sidebar Function.
 

Functions

int alias_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Alias function - Implements function_dispatcher_t -.
 
int attach_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Attach function - Implements function_dispatcher_t -.
 
int autocrypt_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Autocrypt function - Implements function_dispatcher_t -.
 
int compose_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Compose function - Implements function_dispatcher_t -.
 
int preview_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a preview function - Implements function_dispatcher_t -.
 
int enter_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform an Enter function - Implements function_dispatcher_t -.
 
int env_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform an Envelope function - Implements function_dispatcher_t -.
 
int global_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Global function - Implements function_dispatcher_t -.
 
int history_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a History function - Implements function_dispatcher_t -.
 
static int list_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a List dialog function - Implements function_dispatcher_t -.
 
int index_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform an Index function - Implements function_dispatcher_t -.
 
int menu_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Menu function - Implements function_dispatcher_t -.
 
int menu_tagging_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform tagging operations on the Menu - Implements function_dispatcher_t -.
 
int gpgme_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Gpgme function - Implements function_dispatcher_t -.
 
int pgp_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Pgp function - Implements function_dispatcher_t -.
 
int smime_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Smime function - Implements function_dispatcher_t -.
 
int pager_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Pager function - Implements function_dispatcher_t -.
 
int pattern_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Pattern function - Implements function_dispatcher_t -.
 
int postpone_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Postpone function - Implements function_dispatcher_t -.
 
int sb_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Sidebar function - Implements function_dispatcher_t -.
 

Detailed Description

Prototype for a Function Dispatcher.

Perform a NeoMutt function

Parameters
winWindow
eventEvent to act upon
Return values
numFunctionRetval

Function Documentation

◆ alias_function_dispatcher()

int alias_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Alias function - Implements function_dispatcher_t -.

Definition at line 640 of file functions.c.

641{
642 // The Dispatcher may be called on any Window in the Dialog
643 struct MuttWindow *dlg = dialog_find(win);
644 if (!event || !dlg || !dlg->wdata)
645 return FR_ERROR;
646
647 struct Menu *menu = dlg->wdata;
648 struct AliasMenuData *mdata = menu->mdata;
649 if (!mdata)
650 return FR_ERROR;
651
652 const int op = event->op;
653
654 struct AliasFunctionData fdata = {
655 .n = NeoMutt,
656 .wdata = mdata,
657 };
658
659 int rc = FR_UNKNOWN;
660 for (size_t i = 0; AliasFunctions[i].op != OP_NULL; i++)
661 {
662 const struct AliasFunction *fn = &AliasFunctions[i];
663 if (fn->op == op)
664 {
665 rc = fn->function(&fdata, event);
666 break;
667 }
668 }
669
670 if (rc == FR_UNKNOWN) // Not our function
671 return rc;
672
673 const char *result = dispatcher_get_retval_name(rc);
674 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
675
677 return rc;
678}
static const struct AliasFunction AliasFunctions[]
All the NeoMutt functions that the Alias supports.
Definition functions.c:614
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
const char * dispatcher_get_retval_name(int rv)
Get the name of a return value.
Definition dispatcher.c:55
void dispatcher_flush_on_error(int rv)
Flush pending keys after a dispatch error.
Definition dispatcher.c:65
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
#define NONULL(x)
Definition string2.h:44
Data passed to Alias worker functions.
Definition functions.h:40
A NeoMutt function.
Definition functions.h:64
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:65
alias_function_t function
Function to call.
Definition functions.h:66
AliasView array wrapper with Pattern information -.
Definition gui.h:55
struct Menu * menu
Menu.
Definition gui.h:59
Definition lib.h:86
void * mdata
Private data.
Definition lib.h:155
void * wdata
Private data.
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_function_dispatcher()

int attach_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Attach function - Implements function_dispatcher_t -.

Definition at line 829 of file functions.c.

830{
831 // The Dispatcher may be called on any Window in the Dialog
832 struct MuttWindow *dlg = dialog_find(win);
833 if (!event || !dlg || !dlg->wdata)
834 {
836 return FR_ERROR;
837 }
838
839 struct Menu *menu = dlg->wdata;
840 struct AttachPrivateData *priv = menu->mdata;
841 if (!priv)
842 {
844 return FR_ERROR;
845 }
846
847 const int op = event->op;
848
849 struct AttachFunctionData fdata = {
850 .n = NeoMutt,
851 .priv = priv,
852 };
853
854 int rc = FR_UNKNOWN;
855 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
856 {
857 const struct AttachFunction *fn = &AttachFunctions[i];
858 if (fn->op == op)
859 {
860 rc = fn->function(&fdata, event);
861 break;
862 }
863 }
864
866 return rc;
867}
static const struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition functions.c:792
Data passed to Attach worker functions.
Definition functions.h:33
struct AttachPrivateData * priv
Attach private data.
Definition functions.h:35
A NeoMutt function.
Definition functions.h:57
attach_function_t function
Function to call.
Definition functions.h:59
int op
Op code, e.g. OP_ATTACH_COLLAPSE.
Definition functions.h:58
Private state data for Attachments.
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
struct Menu * menu
Current Menu.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_function_dispatcher()

int autocrypt_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Autocrypt function - Implements function_dispatcher_t -.

Definition at line 239 of file functions.c.

240{
241 // The Dispatcher may be called on any Window in the Dialog
242 struct MuttWindow *dlg = dialog_find(win);
243 if (!event || !dlg || !dlg->wdata)
244 {
246 return FR_ERROR;
247 }
248
249 const int op = event->op;
250 struct Menu *menu = dlg->wdata;
251 struct AutocryptData *ad = menu->mdata;
252 if (!ad)
253 {
255 return FR_ERROR;
256 }
257
258 int rc = FR_UNKNOWN;
259 for (size_t i = 0; AutocryptFunctions[i].op != OP_NULL; i++)
260 {
261 const struct AutocryptFunction *fn = &AutocryptFunctions[i];
262 if (fn->op == op)
263 {
264 rc = fn->function(ad, event);
265 break;
266 }
267 }
268
269 if (rc == FR_UNKNOWN) // Not our function
270 return rc;
271
272 const char *result = dispatcher_get_retval_name(rc);
273 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
274
276 return rc;
277}
static const struct AutocryptFunction AutocryptFunctions[]
All the NeoMutt functions that the Autocrypt supports.
Definition functions.c:225
Data to pass to the Autocrypt Functions.
struct Menu * menu
Autocrypt Menu.
A NeoMutt function.
Definition functions.h:49
autocrypt_function_t function
Function to call.
Definition functions.h:51
int op
Op code, e.g. OP_AUTOCRYPT_CREATE_ACCT.
Definition functions.h:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_function_dispatcher()

int compose_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Compose function - Implements function_dispatcher_t -.

Definition at line 2713 of file functions.c.

2714{
2715 // The Dispatcher may be called on any Window in the Dialog
2716 struct MuttWindow *dlg = dialog_find(win);
2717 if (!event || !dlg || !dlg->wdata)
2718 {
2720 return FR_ERROR;
2721 }
2722
2723 const int op = event->op;
2724
2726
2727 struct ComposeFunctionData fdata = {
2728 .n = NeoMutt,
2729 .mod_data = mod_data,
2730 .shared = dlg->wdata,
2731 };
2732
2733 int rc = FR_UNKNOWN;
2734 for (size_t i = 0; ComposeFunctions[i].op != OP_NULL; i++)
2735 {
2736 const struct ComposeFunction *fn = &ComposeFunctions[i];
2737 if (fn->op == op)
2738 {
2739 rc = fn->function(&fdata, event);
2740 break;
2741 }
2742 }
2743
2744 if (rc == FR_UNKNOWN) // Not our function
2745 return rc;
2746
2747 const char *result = dispatcher_get_retval_name(rc);
2748 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
2749
2751 return rc;
2752}
static const struct ComposeFunction ComposeFunctions[]
All the NeoMutt functions that the Compose supports.
Definition functions.c:2661
@ MODULE_ID_COMPOSE
ModuleCompose, Compose an Email
Definition module_api.h:57
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
Data passed to Compose worker functions.
Definition functions.h:33
struct ComposeModuleData * mod_data
Compose module data.
Definition functions.h:35
A NeoMutt function.
Definition functions.h:59
int op
Op code, e.g. OP_COMPOSE_WRITE_MESSAGE.
Definition functions.h:60
compose_function_t function
Function to call.
Definition functions.h:61
Compose private Module data.
Definition module_data.h:30
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preview_function_dispatcher()

int preview_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a preview function - Implements function_dispatcher_t -.

Definition at line 439 of file preview.c.

440{
441 if (!event || !win || !win->wdata)
442 return FR_UNKNOWN;
443
444 const int op = event->op;
445 int rc = FR_UNKNOWN;
446 for (size_t i = 0; PreviewFunctions[i].op != OP_NULL; i++)
447 {
448 const struct PreviewFunction *fn = &PreviewFunctions[i];
449 if (fn->op == op)
450 {
451 struct PreviewWindowData *wdata = win->wdata;
452 rc = fn->function(wdata, event);
453 break;
454 }
455 }
456
457 if (rc == FR_UNKNOWN) // Not our function
458 return rc;
459
460 const char *result = dispatcher_get_retval_name(rc);
461 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
462
464 return rc;
465}
static const struct PreviewFunction PreviewFunctions[]
All the functions that the preview window supports.
Definition preview.c:428
A message preview function.
Definition preview.c:107
int op
Op code, e.g. OP_NEXT_PAGE.
Definition preview.c:108
preview_function_t function
Function to call.
Definition preview.c:109
Data to fill the Preview Window.
Definition preview.c:78
struct MuttWindow * win
Window holding the message preview.
Definition preview.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enter_function_dispatcher()

int enter_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform an Enter function - Implements function_dispatcher_t -.

Definition at line 535 of file functions.c.

536{
537 if (!event || !win || !win->wdata)
538 return FR_UNKNOWN;
539
540 const int op = event->op;
541
543
544 struct EnterFunctionData fdata = {
545 .n = NeoMutt,
546 .mod_data = mod_data,
547 .wdata = win->wdata,
548 };
549
550 int rc = FR_UNKNOWN;
551 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
552 {
553 const struct EnterFunction *fn = &EnterFunctions[i];
554 if (fn->op == op)
555 {
556 rc = fn->function(&fdata, event);
557 break;
558 }
559 }
560
561 if (rc == FR_UNKNOWN) // Not our function
562 return rc;
563
564 const char *result = dispatcher_get_retval_name(rc);
565 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
566
568 return rc;
569}
static const struct EnterFunction EnterFunctions[]
All the NeoMutt functions that Enter supports.
Definition functions.c:500
@ MODULE_ID_EDITOR
ModuleEditor, Edit a string
Definition module_api.h:63
Editor private Module data.
Definition module_data.h:30
Data passed to Enter worker functions.
Definition functions.h:42
struct EditorModuleData * mod_data
Editor module data.
Definition functions.h:44
A NeoMutt function.
Definition functions.h:66
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:67
enter_function_t function
Function to call.
Definition functions.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_function_dispatcher()

int env_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform an Envelope function - Implements function_dispatcher_t -.

Definition at line 536 of file functions.c.

537{
538 if (!event || !win || !win->wdata)
539 return FR_UNKNOWN;
540
541 const int op = event->op;
542 int rc = FR_UNKNOWN;
543 for (size_t i = 0; EnvelopeFunctions[i].op != OP_NULL; i++)
544 {
545 const struct EnvelopeFunction *fn = &EnvelopeFunctions[i];
546 if (fn->op == op)
547 {
548 struct EnvelopeWindowData *wdata = win->wdata;
549 rc = fn->function(wdata, event);
550 break;
551 }
552 }
553
554 if (rc == FR_UNKNOWN) // Not our function
555 return rc;
556
557 const char *result = dispatcher_get_retval_name(rc);
558 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
559
561 return rc;
562}
static const struct EnvelopeFunction EnvelopeFunctions[]
All the NeoMutt functions that the Envelope supports.
Definition functions.c:512
A NeoMutt Envelope function.
Definition functions.h:49
int op
Op code, e.g. OP_ENVELOPE_EDIT_FROM.
Definition functions.h:50
envelope_function_t function
Function to call.
Definition functions.h:51
Data to fill the Envelope Window.
Definition wdata.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_function_dispatcher()

int global_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Global function - Implements function_dispatcher_t -.

Note
win Should be the currently focused Window

Definition at line 182 of file global.c.

183{
184 if (!event || !win)
185 return FR_UNKNOWN;
186
187 const int op = event->op;
188 int rc = FR_UNKNOWN;
189 for (size_t i = 0; GlobalFunctions[i].op != OP_NULL; i++)
190 {
191 const struct GlobalFunction *fn = &GlobalFunctions[i];
192 if (fn->op == op)
193 {
194 rc = fn->function(win, event);
195 break;
196 }
197 }
198
199 if (rc == FR_UNKNOWN) // Not our function
200 return rc;
201
202 const char *result = dispatcher_get_retval_name(rc);
203 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
204
206 return FR_SUCCESS; // Whatever the outcome, we handled it
207}
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
static const struct GlobalFunction GlobalFunctions[]
All the NeoMutt functions that the Global supports.
Definition global.c:164
A NeoMutt function.
Definition global.h:48
global_function_t function
Function to call.
Definition global.h:50
int op
Op code, e.g. OP_ENTER_COMMAND.
Definition global.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ history_function_dispatcher()

int history_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a History function - Implements function_dispatcher_t -.

Definition at line 85 of file functions.c.

86{
87 // The Dispatcher may be called on any Window in the Dialog
88 struct MuttWindow *dlg = dialog_find(win);
89 if (!event || !dlg || !dlg->wdata)
90 {
92 return FR_ERROR;
93 }
94
95 const int op = event->op;
96 struct Menu *menu = dlg->wdata;
97 struct HistoryData *hd = menu->mdata;
98 if (!hd)
99 {
101 return FR_ERROR;
102 }
103
104 int rc = FR_UNKNOWN;
105 for (size_t i = 0; HistoryFunctions[i].op != OP_NULL; i++)
106 {
107 const struct HistoryFunction *fn = &HistoryFunctions[i];
108 if (fn->op == op)
109 {
110 rc = fn->function(hd, event);
111 break;
112 }
113 }
114
115 if (rc == FR_UNKNOWN) // Not our function
116 return rc;
117
118 const char *result = dispatcher_get_retval_name(rc);
119 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
120
122 return rc;
123}
static const struct HistoryFunction HistoryFunctions[]
All the NeoMutt functions that the History supports.
Definition functions.c:73
Data to pass to the History Functions.
Definition functions.h:35
struct Menu * menu
History Menu.
Definition functions.h:39
A NeoMutt function.
Definition functions.h:62
history_function_t function
Function to call.
Definition functions.h:64
int op
Op code, e.g. OP_GENERIC_SELECT_ENTRY.
Definition functions.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_function_dispatcher()

static int list_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )
static

Perform a List dialog function - Implements function_dispatcher_t -.

Definition at line 274 of file dlg_list.c.

275{
276 struct MuttWindow *dlg = dialog_find(win);
277 if (!event || !dlg || !dlg->wdata)
278 {
280 return FR_ERROR;
281 }
282
283 struct Menu *menu = dlg->wdata;
284 struct ListData *ld = menu->mdata;
285 if (!ld)
286 {
288 return FR_ERROR;
289 }
290
291 int rc = FR_UNKNOWN;
292 for (size_t i = 0; ListFunctions[i].op != OP_NULL; i++)
293 {
294 if (ListFunctions[i].op == event->op)
295 {
296 rc = ListFunctions[i].function(ld, event);
297 break;
298 }
299 }
300
301 if (rc == FR_UNKNOWN)
302 return rc;
303
304 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(event->op),
307 return rc;
308}
static const struct ListFunction ListFunctions[]
Functions handled by the list dialog.
Definition dlg_list.c:257
int op
Function opcode, e.g. OP_HELP.
Definition get.h:77
Private data for the Mailing-list action dialog.
Definition dlg_list.c:78
struct Menu * menu
Dialog menu.
Definition dlg_list.c:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_function_dispatcher()

int index_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform an Index function - Implements function_dispatcher_t -.

Definition at line 4067 of file functions.c.

4068{
4069 // The Dispatcher may be called on any Window in the Dialog
4070 struct MuttWindow *dlg = dialog_find(win);
4071 if (!event || !dlg || !dlg->wdata || !win->parent || !win->parent->wdata)
4072 {
4074 return FR_ERROR;
4075 }
4076
4077 const int op = event->op;
4078 struct IndexPrivateData *priv = win->parent->wdata;
4079 struct IndexSharedData *shared = dlg->wdata;
4080
4082
4083 struct IndexFunctionData fdata = {
4084 .n = NeoMutt,
4085 .mod_data = mod_data,
4086 .shared = shared,
4087 .priv = priv,
4088 };
4089
4090 int rc = FR_UNKNOWN;
4091 for (size_t i = 0; IndexFunctions[i].op != OP_NULL; i++)
4092 {
4093 const struct IndexFunction *fn = &IndexFunctions[i];
4094 if (fn->op == op)
4095 {
4096 if (!prereq(shared, priv->menu, fn->flags))
4097 {
4098 rc = FR_ERROR;
4099 break;
4100 }
4101 rc = fn->function(&fdata, event);
4102 break;
4103 }
4104 }
4105
4106 if (rc == FR_UNKNOWN) // Not our function
4107 return rc;
4108
4109 const char *result = dispatcher_get_retval_name(rc);
4110 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
4111
4113 return rc;
4114}
static bool prereq(struct IndexSharedData *shared, struct Menu *menu, CheckFlags checks)
Check the pre-requisites for a function.
Definition functions.c:3876
static const struct IndexFunction IndexFunctions[]
All the NeoMutt functions that the Index supports.
Definition functions.c:3925
@ MODULE_ID_INDEX
ModuleIndex, Index
Definition module_api.h:72
Data passed to Index worker functions.
Definition functions.h:35
struct IndexSharedData * shared
Shared Index data.
Definition functions.h:38
struct IndexPrivateData * priv
Private Index data.
Definition functions.h:39
struct IndexModuleData * mod_data
Index module data.
Definition functions.h:37
A NeoMutt function.
Definition functions.h:62
int op
Op code, e.g. OP_MAIN_LIMIT.
Definition functions.h:63
index_function_t function
Function to call.
Definition functions.h:64
int flags
Prerequisites for the function, e.g. CHECK_IN_MAILBOX.
Definition functions.h:65
Index private Module data.
Definition module_data.h:32
Private state data for the Index.
struct Menu * menu
Menu controlling the index.
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct MuttWindow * parent
Parent Window.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_function_dispatcher()

int menu_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Menu function - Implements function_dispatcher_t -.

Definition at line 366 of file functions.c.

367{
368 if (!event || !win || !win->wdata)
369 return FR_UNKNOWN;
370
371 const int op = event->op;
372 struct Menu *menu = win->wdata;
373
374 struct MenuFunctionData fdata = {
375 .n = NeoMutt,
376 .menu = menu,
377 };
378
379 int rc = FR_UNKNOWN;
380 for (size_t i = 0; MenuFunctions[i].op != OP_NULL; i++)
381 {
382 const struct MenuFunction *fn = &MenuFunctions[i];
383 if (fn->op == op)
384 {
385 rc = fn->function(&fdata, event);
386 break;
387 }
388 }
389
390 if (rc == FR_UNKNOWN) // Not our function
391 return rc;
392
393 const char *result = dispatcher_get_retval_name(rc);
394 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
395
397 return rc;
398}
static const struct MenuFunction MenuFunctions[]
All the NeoMutt functions that the Menu supports.
Definition functions.c:335
Data passed to Menu worker functions.
Definition functions.h:32
struct Menu * menu
Menu data.
Definition functions.h:34
A NeoMutt function.
Definition functions.h:56
menu_function_t function
Function to call.
Definition functions.h:58
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:57
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_tagging_dispatcher()

int menu_tagging_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform tagging operations on the Menu - Implements function_dispatcher_t -.

Definition at line 239 of file tagging.c.

240{
241 if (!win || !win->wdata || !event)
242 {
244 return FR_ERROR;
245 }
246
247 struct Menu *menu = win->wdata;
248 const int op = event->op;
249 int rc = FR_UNKNOWN;
250
251 switch (op)
252 {
253 case OP_END_COND:
254 rc = op_end_cond(menu, op);
255 break;
256 case OP_TAG:
257 rc = op_tag(menu, op, event->count);
258 break;
259 case OP_TAG_PREFIX:
260 rc = op_tag_prefix(menu, op);
261 break;
262 case OP_TAG_PREFIX_COND:
263 rc = op_tag_prefix_cond(menu, op);
264 break;
265 case OP_ABORT:
266 rc = menu_abort(menu);
267 break;
268 case OP_TIMEOUT:
269 rc = menu_timeout(menu);
270 break;
271 default:
272 rc = menu_other(menu);
273 break;
274 }
275
277 return rc;
278}
#define OP_TIMEOUT
1 second with no events
Definition opcodes.h:35
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition opcodes.h:36
int count
Optional count prefix, e.g. 3 for 3j
Definition get.h:78
static int menu_other(struct Menu *menu)
Some non-tagging operation occurred.
Definition tagging.c:229
static int menu_abort(struct Menu *menu)
User aborted an operation.
Definition tagging.c:206
static int op_end_cond(struct Menu *menu, int op)
End of conditional execution (noop)
Definition tagging.c:73
static int op_tag_prefix_cond(struct Menu *menu, int op)
Apply next function ONLY to tagged messages.
Definition tagging.c:181
static int op_tag(struct Menu *menu, int op, int count)
Tag the current entry.
Definition tagging.c:87
static int op_tag_prefix(struct Menu *menu, int op)
Apply next function to tagged messages.
Definition tagging.c:155
static int menu_timeout(struct Menu *menu)
Timeout waiting for a keypress.
Definition tagging.c:218
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_function_dispatcher()

int gpgme_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Gpgme function - Implements function_dispatcher_t -.

Definition at line 863 of file gpgme_functions.c.

864{
865 // The Dispatcher may be called on any Window in the Dialog
866 struct MuttWindow *dlg = dialog_find(win);
867 if (!event || !dlg || !dlg->wdata)
868 {
870 return FR_ERROR;
871 }
872
873 const int op = event->op;
874 struct Menu *menu = dlg->wdata;
875 struct GpgmeData *gd = menu->mdata;
876 if (!gd)
877 {
879 return FR_ERROR;
880 }
881
882 int rc = FR_UNKNOWN;
883 for (size_t i = 0; GpgmeFunctions[i].op != OP_NULL; i++)
884 {
885 const struct GpgmeFunction *fn = &GpgmeFunctions[i];
886 if (fn->op == op)
887 {
888 rc = fn->function(gd, event);
889 break;
890 }
891 }
892
893 if (rc == FR_UNKNOWN) // Not our function
894 return rc;
895
896 const char *result = dispatcher_get_retval_name(rc);
897 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
898
900 return rc;
901}
static const struct GpgmeFunction GpgmeFunctions[]
All the NeoMutt functions that the Gpgme supports.
Data to pass to the Gpgme Functions.
struct Menu * menu
Gpgme Menu.
A NeoMutt function.
gpgme_function_t function
Function to call.
int op
Op code, e.g. OP_GENERIC_SELECT_ENTRY.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_function_dispatcher()

int pgp_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Pgp function - Implements function_dispatcher_t -.

Definition at line 225 of file pgp_functions.c.

226{
227 // The Dispatcher may be called on any Window in the Dialog
228 struct MuttWindow *dlg = dialog_find(win);
229 if (!event || !dlg || !dlg->wdata)
230 {
232 return FR_ERROR;
233 }
234
235 const int op = event->op;
236 struct Menu *menu = dlg->wdata;
237 struct PgpData *pd = menu->mdata;
238 if (!pd)
239 {
241 return FR_ERROR;
242 }
243
244 int rc = FR_UNKNOWN;
245 for (size_t i = 0; PgpFunctions[i].op != OP_NULL; i++)
246 {
247 const struct PgpFunction *fn = &PgpFunctions[i];
248 if (fn->op == op)
249 {
250 rc = fn->function(pd, event);
251 break;
252 }
253 }
254
255 if (rc == FR_UNKNOWN) // Not our function
256 return rc;
257
258 const char *result = dispatcher_get_retval_name(rc);
259 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
260
262 return rc;
263}
static const struct PgpFunction PgpFunctions[]
All the NeoMutt functions that the Pgp supports.
Data to pass to the Pgp Functions.
struct Menu * menu
Pgp Menu.
A NeoMutt function.
int op
Op code, e.g. OP_GENERIC_SELECT_ENTRY.
pgp_function_t function
Function to call.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ smime_function_dispatcher()

int smime_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Smime function - Implements function_dispatcher_t -.

Definition at line 110 of file smime_functions.c.

111{
112 // The Dispatcher may be called on any Window in the Dialog
113 struct MuttWindow *dlg = dialog_find(win);
114 if (!event || !dlg || !dlg->wdata)
115 {
117 return FR_ERROR;
118 }
119
120 const int op = event->op;
121 struct Menu *menu = dlg->wdata;
122 struct SmimeData *sd = menu->mdata;
123 if (!sd)
124 {
126 return FR_ERROR;
127 }
128
129 int rc = FR_UNKNOWN;
130 for (size_t i = 0; SmimeFunctions[i].op != OP_NULL; i++)
131 {
132 const struct SmimeFunction *fn = &SmimeFunctions[i];
133 if (fn->op == op)
134 {
135 rc = fn->function(sd, event);
136 break;
137 }
138 }
139
140 if (rc == FR_UNKNOWN) // Not our function
141 return rc;
142
143 const char *result = dispatcher_get_retval_name(rc);
144 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
145
147 return rc;
148}
static const struct SmimeFunction SmimeFunctions[]
All the NeoMutt functions that the Smime supports.
Data to pass to the Smime Functions.
struct Menu * menu
Smime Menu.
A NeoMutt function.
smime_function_t function
Function to call.
int op
Op code, e.g. OP_GENERIC_SELECT_ENTRY.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_function_dispatcher()

int pager_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Pager function - Implements function_dispatcher_t -.

Definition at line 1207 of file functions.c.

1208{
1209 if (!win || !event)
1210 {
1213 return FR_ERROR;
1214 }
1215
1216 if (!win->parent || !win->parent->wdata)
1217 {
1219 return FR_ERROR;
1220 }
1221
1222 struct PagerPrivateData *priv = win->parent->wdata;
1223
1224 struct MuttWindow *dlg = dialog_find(win);
1225 if (!dlg || !dlg->wdata)
1226 {
1228 return FR_ERROR;
1229 }
1230
1231 const int op = event->op;
1232
1234
1235 struct PagerFunctionData fdata = {
1236 .n = NeoMutt,
1237 .mod_data = mod_data,
1238 .shared = dlg->wdata,
1239 .priv = priv,
1240 };
1241
1242 int rc = FR_UNKNOWN;
1243 for (size_t i = 0; PagerFunctions[i].op != OP_NULL; i++)
1244 {
1245 const struct PagerFunction *fn = &PagerFunctions[i];
1246 if (fn->op == op)
1247 {
1248 rc = fn->function(&fdata, event);
1249 break;
1250 }
1251 }
1252
1253 if (rc == FR_UNKNOWN) // Not our function
1254 return rc;
1255
1256 const char *result = dispatcher_get_retval_name(rc);
1257 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
1258
1260 return rc;
1261}
#define mutt_error(...)
Definition logging2.h:94
@ MODULE_ID_PAGER
ModulePager, Pager
Definition module_api.h:83
#define _(a)
Definition message.h:28
static const char * Not_available_in_this_menu
Error message for unavailable functions.
Definition functions.c:58
static const struct PagerFunction PagerFunctions[]
All the NeoMutt functions that the Pager supports.
Definition functions.c:1178
Data passed to Pager worker functions.
Definition functions.h:37
struct PagerModuleData * mod_data
Pager module data.
Definition functions.h:39
struct PagerPrivateData * priv
Private Pager data.
Definition functions.h:41
A NeoMutt function.
Definition functions.h:64
pager_function_t function
Function to call.
Definition functions.h:66
int op
Op code, e.g. OP_MAIN_LIMIT.
Definition functions.h:65
Pager private Module data.
Definition module_data.h:30
Private state data for the Pager.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_function_dispatcher()

int pattern_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Pattern function - Implements function_dispatcher_t -.

Definition at line 90 of file functions.c.

91{
92 // The Dispatcher may be called on any Window in the Dialog
93 struct MuttWindow *dlg = dialog_find(win);
94 if (!event || !dlg || !dlg->wdata)
95 {
97 return FR_ERROR;
98 }
99
100 const int op = event->op;
101 struct Menu *menu = dlg->wdata;
102 struct PatternData *pd = menu->mdata;
103 if (!pd)
104 {
106 return FR_ERROR;
107 }
108
109 struct PatternFunctionData fdata = {
110 .n = NeoMutt,
111 .pd = pd,
112 };
113
114 int rc = FR_UNKNOWN;
115 for (size_t i = 0; PatternFunctions[i].op != OP_NULL; i++)
116 {
117 const struct PatternFunction *fn = &PatternFunctions[i];
118 if (fn->op == op)
119 {
120 rc = fn->function(&fdata, event);
121 break;
122 }
123 }
124
125 if (rc == FR_UNKNOWN) // Not our function
126 return rc;
127
128 const char *result = dispatcher_get_retval_name(rc);
129 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
130
132 return rc;
133}
static const struct PatternFunction PatternFunctions[]
All the NeoMutt functions that the Pattern supports.
Definition functions.c:78
Data to pass to the Pattern Functions.
struct Menu * menu
Pattern Menu.
Data passed to Pattern worker functions.
Definition functions.h:33
struct PatternData * pd
Pattern data.
Definition functions.h:35
A NeoMutt function.
Definition functions.h:57
int op
Op code, e.g. OP_GENERIC_SELECT_ENTRY.
Definition functions.h:58
pattern_function_t function
Function to call.
Definition functions.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postpone_function_dispatcher()

int postpone_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Postpone function - Implements function_dispatcher_t -.

Definition at line 292 of file functions.c.

293{
294 // The Dispatcher may be called on any Window in the Dialog
295 struct MuttWindow *dlg = dialog_find(win);
296 if (!event || !dlg || !dlg->wdata)
297 {
299 return FR_ERROR;
300 }
301
302 const int op = event->op;
303 struct Menu *menu = dlg->wdata;
304 struct PostponeData *pd = menu->mdata;
305 if (!pd)
306 {
308 return FR_ERROR;
309 }
310
311 int rc = FR_UNKNOWN;
312 for (size_t i = 0; PostponeFunctions[i].op != OP_NULL; i++)
313 {
314 const struct PostponeFunction *fn = &PostponeFunctions[i];
315 if (fn->op == op)
316 {
317 rc = fn->function(pd, event);
318 break;
319 }
320 }
321
322 if (rc == FR_UNKNOWN) // Not our function
323 return rc;
324
325 const char *result = dispatcher_get_retval_name(rc);
326 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
327
329 return rc;
330}
static const struct PostponeFunction PostponeFunctions[]
All the NeoMutt functions that the Postpone supports.
Definition functions.c:275
Data to pass to the Postpone Functions.
Definition functions.h:35
struct Menu * menu
Postponed Menu.
Definition functions.h:37
A NeoMutt function.
Definition functions.h:62
postpone_function_t function
Function to call.
Definition functions.h:64
int op
Op code, e.g. OP_DELETE.
Definition functions.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_function_dispatcher()

int sb_function_dispatcher ( struct MuttWindow * win,
const struct KeyEvent * event )

Perform a Sidebar function - Implements function_dispatcher_t -.

Definition at line 714 of file functions.c.

715{
716 if (!event || !win || !win->wdata)
717 return FR_UNKNOWN;
718
719 const int op = event->op;
720
722
723 struct SidebarFunctionData fdata = {
724 .n = NeoMutt,
725 .mod_data = mod_data,
726 .wdata = win->wdata,
727 };
728
729 int rc = FR_UNKNOWN;
730 for (size_t i = 0; SidebarFunctions[i].op != OP_NULL; i++)
731 {
732 const struct SidebarFunction *fn = &SidebarFunctions[i];
733 if (fn->op == op)
734 {
735 rc = fn->function(&fdata, event);
736 break;
737 }
738 }
739
740 if (rc == FR_UNKNOWN) // Not our function
741 return rc;
742
743 const char *result = dispatcher_get_retval_name(rc);
744 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
745
747 return rc;
748}
@ MODULE_ID_SIDEBAR
ModuleSidebar, Sidebar
Definition module_api.h:91
static const struct SidebarFunction SidebarFunctions[]
All the NeoMutt functions that the Sidebar supports.
Definition functions.c:692
Data passed to Sidebar worker functions.
Definition functions.h:32
struct SidebarModuleData * mod_data
Sidebar module data.
Definition functions.h:34
A NeoMutt function.
Definition functions.h:57
int op
Op code, e.g. OP_SIDEBAR_NEXT.
Definition functions.h:58
sidebar_function_t function
Function to call.
Definition functions.h:59
Sidebar private Module data.
Definition module_data.h:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function: