NeoMutt  2025-12-11-977-g8a21d8
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 637 of file functions.c.

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

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

2782{
2783 // The Dispatcher may be called on any Window in the Dialog
2784 struct MuttWindow *dlg = dialog_find(win);
2785 if (!event || !dlg || !dlg->wdata)
2786 {
2788 return FR_ERROR;
2789 }
2790
2791 const int op = event->op;
2792
2794
2795 struct ComposeFunctionData fdata = {
2796 .n = NeoMutt,
2797 .mod_data = mod_data,
2798 .shared = dlg->wdata,
2799 };
2800
2801 int rc = FR_UNKNOWN;
2802 for (size_t i = 0; ComposeFunctions[i].op != OP_NULL; i++)
2803 {
2804 const struct ComposeFunction *fn = &ComposeFunctions[i];
2805 if (fn->op == op)
2806 {
2807 rc = fn->function(&fdata, event);
2808 break;
2809 }
2810 }
2811
2812 if (rc == FR_UNKNOWN) // Not our function
2813 return rc;
2814
2815 const char *result = dispatcher_get_retval_name(rc);
2816 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
2817
2819 return rc;
2820}
static const struct ComposeFunction ComposeFunctions[]
All the NeoMutt functions that the Compose supports.
Definition functions.c:2729
@ 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 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 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 4036 of file functions.c.

4037{
4038 // The Dispatcher may be called on any Window in the Dialog
4039 struct MuttWindow *dlg = dialog_find(win);
4040 if (!event || !dlg || !dlg->wdata || !win->parent || !win->parent->wdata)
4041 {
4043 return FR_ERROR;
4044 }
4045
4046 const int op = event->op;
4047 struct IndexPrivateData *priv = win->parent->wdata;
4048 struct IndexSharedData *shared = dlg->wdata;
4049
4051
4052 struct IndexFunctionData fdata = {
4053 .n = NeoMutt,
4054 .mod_data = mod_data,
4055 .shared = shared,
4056 .priv = priv,
4057 };
4058
4059 int rc = FR_UNKNOWN;
4060 for (size_t i = 0; IndexFunctions[i].op != OP_NULL; i++)
4061 {
4062 const struct IndexFunction *fn = &IndexFunctions[i];
4063 if (fn->op == op)
4064 {
4065 if (!prereq(shared, priv->menu, fn->flags))
4066 {
4067 rc = FR_ERROR;
4068 break;
4069 }
4070 rc = fn->function(&fdata, event);
4071 break;
4072 }
4073 }
4074
4075 if (rc == FR_UNKNOWN) // Not our function
4076 return rc;
4077
4078 const char *result = dispatcher_get_retval_name(rc);
4079 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
4080
4082 return rc;
4083}
static bool prereq(struct IndexSharedData *shared, struct Menu *menu, CheckFlags checks)
Check the pre-requisites for a function.
Definition functions.c:3846
static const struct IndexFunction IndexFunctions[]
All the NeoMutt functions that the Index supports.
Definition functions.c:3895
@ 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 227 of file functions_pgp.c.

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

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

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

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