NeoMutt  2025-12-11-1039-g550ac6
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.
 Mailing-list Function API
 Prototype for a Mailing-list 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 -.
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 mlist_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a List dialog function - 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_fuzzy_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Fuzzy Search 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 643 of file functions.c.

644{
645 // The Dispatcher may be called on any Window in the Dialog
646 struct MuttWindow *dlg = dialog_find(win);
647 if (!event || !dlg || !dlg->wdata)
648 return FR_ERROR;
649
650 struct Menu *menu = dlg->wdata;
651 struct AliasMenuData *mdata = menu->mdata;
652 if (!mdata)
653 return FR_ERROR;
654
655 const int op = event->op;
656
657 struct AliasFunctionData fdata = {
658 .n = NeoMutt,
659 .wdata = mdata,
660 };
661
662 int rc = FR_UNKNOWN;
663 for (size_t i = 0; AliasFunctions[i].op != OP_NULL; i++)
664 {
665 const struct AliasFunction *fn = &AliasFunctions[i];
666 if (fn->op == op)
667 {
668 rc = fn->function(&fdata, event);
669 break;
670 }
671 }
672
673 if (rc == FR_UNKNOWN) // Not our function
674 return rc;
675
676 const char *result = dispatcher_get_retval_name(rc);
677 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
678
680 return rc;
681}
static const struct AliasFunction AliasFunctions[]
All the NeoMutt functions that the Alias supports.
Definition functions.c:616
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 818 of file functions.c.

819{
820 // The Dispatcher may be called on any Window in the Dialog
821 struct MuttWindow *dlg = dialog_find(win);
822 if (!event || !dlg || !dlg->wdata)
823 {
825 return FR_ERROR;
826 }
827
828 struct Menu *menu = dlg->wdata;
829 struct AttachPrivateData *priv = menu->mdata;
830 if (!priv)
831 {
833 return FR_ERROR;
834 }
835
836 const int op = event->op;
837
838 struct AttachFunctionData fdata = {
839 .n = NeoMutt,
840 .priv = priv,
841 };
842
843 int rc = FR_UNKNOWN;
844 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
845 {
846 const struct AttachFunction *fn = &AttachFunctions[i];
847 if (fn->op == op)
848 {
849 rc = fn->function(&fdata, event);
850 break;
851 }
852 }
853
855 return rc;
856}
static const struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition functions.c:781
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 241 of file functions.c.

242{
243 // The Dispatcher may be called on any Window in the Dialog
244 struct MuttWindow *dlg = dialog_find(win);
245 if (!event || !dlg || !dlg->wdata)
246 {
248 return FR_ERROR;
249 }
250
251 const int op = event->op;
252 struct Menu *menu = dlg->wdata;
253 struct AutocryptData *ad = menu->mdata;
254 if (!ad)
255 {
257 return FR_ERROR;
258 }
259
260 int rc = FR_UNKNOWN;
261 for (size_t i = 0; AutocryptFunctions[i].op != OP_NULL; i++)
262 {
263 const struct AutocryptFunction *fn = &AutocryptFunctions[i];
264 if (fn->op == op)
265 {
266 rc = fn->function(ad, event);
267 break;
268 }
269 }
270
271 if (rc == FR_UNKNOWN) // Not our function
272 return rc;
273
274 const char *result = dispatcher_get_retval_name(rc);
275 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
276
278 return rc;
279}
static const struct AutocryptFunction AutocryptFunctions[]
All the NeoMutt functions that the Autocrypt supports.
Definition functions.c:226
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 2816 of file functions.c.

2817{
2818 // The Dispatcher may be called on any Window in the Dialog
2819 struct MuttWindow *dlg = dialog_find(win);
2820 if (!event || !dlg || !dlg->wdata)
2821 {
2823 return FR_ERROR;
2824 }
2825
2826 const int op = event->op;
2827
2829
2830 struct ComposeFunctionData fdata = {
2831 .n = NeoMutt,
2832 .mod_data = mod_data,
2833 .shared = dlg->wdata,
2834 };
2835
2836 int rc = FR_UNKNOWN;
2837 for (size_t i = 0; ComposeFunctions[i].op != OP_NULL; i++)
2838 {
2839 const struct ComposeFunction *fn = &ComposeFunctions[i];
2840 if (fn->op == op)
2841 {
2842 rc = fn->function(&fdata, event);
2843 break;
2844 }
2845 }
2846
2847 if (rc == FR_UNKNOWN) // Not our function
2848 return rc;
2849
2850 const char *result = dispatcher_get_retval_name(rc);
2851 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
2852
2854 return rc;
2855}
static const struct ComposeFunction ComposeFunctions[]
All the NeoMutt functions that the Compose supports.
Definition functions.c:2764
@ 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:666
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 569 of file preview.c.

570{
571 if (!event || !win || !win->wdata)
572 return FR_UNKNOWN;
573
574 const int op = event->op;
575 int rc = FR_UNKNOWN;
576 for (size_t i = 0; PreviewFunctions[i].op != OP_NULL; i++)
577 {
578 const struct PreviewFunction *fn = &PreviewFunctions[i];
579 if (fn->op == op)
580 {
581 struct PreviewWindowData *wdata = win->wdata;
582 rc = fn->function(wdata, event);
583 break;
584 }
585 }
586
587 if (rc == FR_UNKNOWN) // Not our function
588 return rc;
589
590 const char *result = dispatcher_get_retval_name(rc);
591 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
592
594 return rc;
595}
static const struct PreviewFunction PreviewFunctions[]
All the functions that the preview window supports.
Definition preview.c:552
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:40
struct EditorModuleData * mod_data
Editor module data.
Definition functions.h:42
A NeoMutt function.
Definition functions.h:64
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:65
enter_function_t function
Function to call.
Definition functions.h:66
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 539 of file functions.c.

540{
541 if (!event || !win || !win->wdata)
542 return FR_UNKNOWN;
543
544 const int op = event->op;
545 int rc = FR_UNKNOWN;
546 for (size_t i = 0; EnvelopeFunctions[i].op != OP_NULL; i++)
547 {
548 const struct EnvelopeFunction *fn = &EnvelopeFunctions[i];
549 if (fn->op == op)
550 {
551 struct EnvelopeWindowData *wdata = win->wdata;
552 rc = fn->function(wdata, event);
553 break;
554 }
555 }
556
557 if (rc == FR_UNKNOWN) // Not our function
558 return rc;
559
560 const char *result = dispatcher_get_retval_name(rc);
561 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
562
564 return rc;
565}
static const struct EnvelopeFunction EnvelopeFunctions[]
All the NeoMutt functions that the Envelope supports.
Definition functions.c:515
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 193 of file global.c.

194{
195 if (!event || !win)
196 return FR_UNKNOWN;
197
198 const int op = event->op;
199 int rc = FR_UNKNOWN;
200 for (size_t i = 0; GlobalFunctions[i].op != OP_NULL; i++)
201 {
202 const struct GlobalFunction *fn = &GlobalFunctions[i];
203 if (fn->op == op)
204 {
205 rc = fn->function(win, event);
206 break;
207 }
208 }
209
210 if (rc == FR_UNKNOWN) // Not our function
211 return rc;
212
213 const char *result = dispatcher_get_retval_name(rc);
214 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
215
217 return FR_SUCCESS; // Whatever the outcome, we handled it
218}
@ 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:174
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:

◆ 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 4065 of file functions.c.

4066{
4067 // The Dispatcher may be called on any Window in the Dialog
4068 struct MuttWindow *dlg = dialog_find(win);
4069 if (!event || !dlg || !dlg->wdata || !win->parent || !win->parent->wdata)
4070 {
4072 return FR_ERROR;
4073 }
4074
4075 const int op = event->op;
4076 struct IndexPrivateData *priv = win->parent->wdata;
4077 struct IndexSharedData *shared = dlg->wdata;
4078
4080
4081 struct IndexFunctionData fdata = {
4082 .n = NeoMutt,
4083 .mod_data = mod_data,
4084 .shared = shared,
4085 .priv = priv,
4086 };
4087
4088 int rc = FR_UNKNOWN;
4089 for (size_t i = 0; IndexFunctions[i].op != OP_NULL; i++)
4090 {
4091 const struct IndexFunction *fn = &IndexFunctions[i];
4092 if (fn->op == op)
4093 {
4094 if (!prereq(shared, priv->menu, fn->flags))
4095 {
4096 rc = FR_ERROR;
4097 break;
4098 }
4099 rc = fn->function(&fdata, event);
4100 break;
4101 }
4102 }
4103
4104 if (rc == FR_UNKNOWN) // Not our function
4105 return rc;
4106
4107 const char *result = dispatcher_get_retval_name(rc);
4108 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
4109
4111 return rc;
4112}
static bool prereq(struct IndexSharedData *shared, struct Menu *menu, CheckFlags checks)
Check the pre-requisites for a function.
Definition functions.c:3871
static const struct IndexFunction IndexFunctions[]
All the NeoMutt functions that the Index supports.
Definition functions.c:3920
@ MODULE_ID_INDEX
ModuleIndex, Index
Definition module_api.h:73
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:

◆ mlist_function_dispatcher()

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

Perform a List dialog function - Implements function_dispatcher_t -.

Definition at line 269 of file functions.c.

270{
271 struct MuttWindow *dlg = dialog_find(win);
272 if (!event || !dlg || !dlg->wdata)
273 {
275 return FR_ERROR;
276 }
277
278 struct Menu *menu = dlg->wdata;
279 struct ListData *ld = menu->mdata;
280 if (!ld)
281 {
283 return FR_ERROR;
284 }
285
286 int rc = FR_UNKNOWN;
287 for (size_t i = 0; MlistFunctions[i].op != OP_NULL; i++)
288 {
289 if (MlistFunctions[i].op == event->op)
290 {
291 rc = MlistFunctions[i].function(ld, event);
292 break;
293 }
294 }
295
296 if (rc == FR_UNKNOWN)
297 return rc;
298
299 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(event->op),
302 return rc;
303}
static const struct MlistFunction MlistFunctions[]
All the NeoMutt functions that the List Dialog supports.
Definition functions.c:251
int op
Function opcode, e.g. OP_HELP.
Definition get.h:77
Private data for the Mailing-list action dialog.
Definition functions.h:64
struct Menu * menu
Dialog menu.
Definition functions.h:65
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 865 of file functions_gpgme.c.

866{
867 // The Dispatcher may be called on any Window in the Dialog
868 struct MuttWindow *dlg = dialog_find(win);
869 if (!event || !dlg || !dlg->wdata)
870 {
872 return FR_ERROR;
873 }
874
875 const int op = event->op;
876 struct Menu *menu = dlg->wdata;
877 struct GpgmeData *gd = menu->mdata;
878 if (!gd)
879 {
881 return FR_ERROR;
882 }
883
884 int rc = FR_UNKNOWN;
885 for (size_t i = 0; GpgmeFunctions[i].op != OP_NULL; i++)
886 {
887 const struct GpgmeFunction *fn = &GpgmeFunctions[i];
888 if (fn->op == op)
889 {
890 rc = fn->function(gd, event);
891 break;
892 }
893 }
894
895 if (rc == FR_UNKNOWN) // Not our function
896 return rc;
897
898 const char *result = dispatcher_get_retval_name(rc);
899 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
900
902 return rc;
903}
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 228 of file functions_pgp.c.

229{
230 // The Dispatcher may be called on any Window in the Dialog
231 struct MuttWindow *dlg = dialog_find(win);
232 if (!event || !dlg || !dlg->wdata)
233 {
235 return FR_ERROR;
236 }
237
238 const int op = event->op;
239 struct Menu *menu = dlg->wdata;
240 struct PgpData *pd = menu->mdata;
241 if (!pd)
242 {
244 return FR_ERROR;
245 }
246
247 int rc = FR_UNKNOWN;
248 for (size_t i = 0; PgpFunctions[i].op != OP_NULL; i++)
249 {
250 const struct PgpFunction *fn = &PgpFunctions[i];
251 if (fn->op == op)
252 {
253 rc = fn->function(pd, event);
254 break;
255 }
256 }
257
258 if (rc == FR_UNKNOWN) // Not our function
259 return rc;
260
261 const char *result = dispatcher_get_retval_name(rc);
262 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
263
265 return rc;
266}
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 113 of file functions_smime.c.

114{
115 // The Dispatcher may be called on any Window in the Dialog
116 struct MuttWindow *dlg = dialog_find(win);
117 if (!event || !dlg || !dlg->wdata)
118 {
120 return FR_ERROR;
121 }
122
123 const int op = event->op;
124 struct Menu *menu = dlg->wdata;
125 struct SmimeData *sd = menu->mdata;
126 if (!sd)
127 {
129 return FR_ERROR;
130 }
131
132 int rc = FR_UNKNOWN;
133 for (size_t i = 0; SmimeFunctions[i].op != OP_NULL; i++)
134 {
135 const struct SmimeFunction *fn = &SmimeFunctions[i];
136 if (fn->op == op)
137 {
138 rc = fn->function(sd, event);
139 break;
140 }
141 }
142
143 if (rc == FR_UNKNOWN) // Not our function
144 return rc;
145
146 const char *result = dispatcher_get_retval_name(rc);
147 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
148
150 return rc;
151}
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 1056 of file functions.c.

1057{
1058 if (!win || !event)
1059 {
1062 return FR_ERROR;
1063 }
1064
1065 if (!win->parent || !win->parent->wdata)
1066 {
1068 return FR_ERROR;
1069 }
1070
1071 struct PagerPrivateData *priv = win->parent->wdata;
1072
1073 struct MuttWindow *dlg = dialog_find(win);
1074 if (!dlg || !dlg->wdata)
1075 {
1077 return FR_ERROR;
1078 }
1079
1080 const int op = event->op;
1081
1083
1084 struct PagerFunctionData fdata = {
1085 .n = NeoMutt,
1086 .mod_data = mod_data,
1087 .shared = dlg->wdata,
1088 .priv = priv,
1089 };
1090
1091 int rc = FR_UNKNOWN;
1092 for (size_t i = 0; PagerFunctions[i].op != OP_NULL; i++)
1093 {
1094 const struct PagerFunction *fn = &PagerFunctions[i];
1095 if (fn->op == op)
1096 {
1097 rc = fn->function(&fdata, event);
1098 break;
1099 }
1100 }
1101
1102 if (rc == FR_UNKNOWN) // Not our function
1103 return rc;
1104
1105 const char *result = dispatcher_get_retval_name(rc);
1106 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
1107
1109 return rc;
1110}
#define mutt_error(...)
Definition logging2.h:94
@ MODULE_ID_PAGER
ModulePager, Pager
Definition module_api.h:85
#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:1017
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 288 of file functions.c.

289{
290 // The Dispatcher may be called on any Window in the Dialog
291 struct MuttWindow *dlg = dialog_find(win);
292 if (!event || !dlg || !dlg->wdata)
293 {
295 return FR_ERROR;
296 }
297
298 const int op = event->op;
299 struct Menu *menu = dlg->wdata;
300 struct PostponeData *pd = menu->mdata;
301 if (!pd)
302 {
304 return FR_ERROR;
305 }
306
307 int rc = FR_UNKNOWN;
308 for (size_t i = 0; PostponeFunctions[i].op != OP_NULL; i++)
309 {
310 const struct PostponeFunction *fn = &PostponeFunctions[i];
311 if (fn->op == op)
312 {
313 rc = fn->function(pd, event);
314 break;
315 }
316 }
317
318 if (rc == FR_UNKNOWN) // Not our function
319 return rc;
320
321 const char *result = dispatcher_get_retval_name(rc);
322 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
323
325 return rc;
326}
static const struct PostponeFunction PostponeFunctions[]
All the NeoMutt functions that the Postpone supports.
Definition functions.c:270
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_fuzzy_function_dispatcher()

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

Perform a Fuzzy Search function - Implements function_dispatcher_t -.

Definition at line 81 of file functions_fuzzy.c.

82{
83 if (!event || !win || !win->wdata)
84 return FR_UNKNOWN;
85
86 const int op = event->op;
87
89
90 struct SidebarFunctionData fdata = {
91 .n = NeoMutt,
92 .mod_data = mod_data,
93 .wdata = win->wdata,
94 };
95
96 int rc = FR_UNKNOWN;
97 for (size_t i = 0; FuzzyFunctions[i].op != OP_NULL; i++)
98 {
99 const struct SidebarFunction *fn = &FuzzyFunctions[i];
100 if (fn->op == op)
101 {
102 rc = fn->function(&fdata, event);
103 break;
104 }
105 }
106
107 if (rc == FR_UNKNOWN) // Not our function
108 return rc;
109
110 const char *result = dispatcher_get_retval_name(rc);
111 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
112
114 return rc;
115}
static const struct SidebarFunction FuzzyFunctions[]
All the NeoMutt functions that the Sidebar Fuzzy Search supports.
@ MODULE_ID_SIDEBAR
ModuleSidebar, Sidebar
Definition module_api.h:93
Data passed to Sidebar worker functions.
struct SidebarModuleData * mod_data
Sidebar module data.
A NeoMutt function.
int op
Op code, e.g. OP_SIDEBAR_NEXT.
sidebar_function_t function
Function to call.
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:

◆ 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 908 of file functions_sidebar.c.

909{
910 if (!event || !win || !win->wdata)
911 return FR_UNKNOWN;
912
913 const int op = event->op;
914
916
917 struct SidebarFunctionData fdata = {
918 .n = NeoMutt,
919 .mod_data = mod_data,
920 .wdata = win->wdata,
921 };
922
923 int rc = FR_UNKNOWN;
924 for (size_t i = 0; SidebarFunctions[i].op != OP_NULL; i++)
925 {
926 const struct SidebarFunction *fn = &SidebarFunctions[i];
927 if (fn->op == op)
928 {
929 rc = fn->function(&fdata, event);
930 break;
931 }
932 }
933
934 if (rc == FR_UNKNOWN) // Not our function
935 return rc;
936
937 const char *result = dispatcher_get_retval_name(rc);
938 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
939
941 return rc;
942}
static const struct SidebarFunction SidebarFunctions[]
All the NeoMutt functions that the Sidebar supports.
Here is the call graph for this function:
Here is the caller graph for this function: