NeoMutt  2025-12-11-769-g906513
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 -.
 
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 509 of file functions.c.

510{
511 // The Dispatcher may be called on any Window in the Dialog
512 struct MuttWindow *dlg = dialog_find(win);
513 if (!event || !dlg || !dlg->wdata)
514 return FR_ERROR;
515
516 struct Menu *menu = dlg->wdata;
517 struct AliasMenuData *mdata = menu->mdata;
518 if (!mdata)
519 return FR_ERROR;
520
521 const int op = event->op;
522
523 struct AliasFunctionData fdata = {
524 .n = NeoMutt,
525 .wdata = mdata,
526 };
527
528 int rc = FR_UNKNOWN;
529 for (size_t i = 0; AliasFunctions[i].op != OP_NULL; i++)
530 {
531 const struct AliasFunction *fn = &AliasFunctions[i];
532 if (fn->op == op)
533 {
534 rc = fn->function(&fdata, event);
535 break;
536 }
537 }
538
539 if (rc == FR_UNKNOWN) // Not our function
540 return rc;
541
542 const char *result = dispatcher_get_retval_name(rc);
543 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
544
545 return rc;
546}
static const struct AliasFunction AliasFunctions[]
All the NeoMutt functions that the Alias supports.
Definition functions.c:483
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:54
@ 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:54
struct Menu * menu
Menu.
Definition gui.h:58
Definition lib.h:80
void * mdata
Private data.
Definition lib.h:149
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 758 of file functions.c.

759{
760 // The Dispatcher may be called on any Window in the Dialog
761 struct MuttWindow *dlg = dialog_find(win);
762 if (!event || !dlg || !dlg->wdata)
763 return FR_ERROR;
764
765 struct Menu *menu = dlg->wdata;
766 struct AttachPrivateData *priv = menu->mdata;
767 if (!priv)
768 return FR_ERROR;
769
770 const int op = event->op;
771
772 struct AttachFunctionData fdata = {
773 .n = NeoMutt,
774 .priv = priv,
775 };
776
777 int rc = FR_UNKNOWN;
778 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
779 {
780 const struct AttachFunction *fn = &AttachFunctions[i];
781 if (fn->op == op)
782 {
783 rc = fn->function(&fdata, event);
784 break;
785 }
786 }
787
788 return rc;
789}
static const struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition functions.c:721
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 227 of file functions.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 return FR_ERROR;
233
234 const int op = event->op;
235 struct Menu *menu = dlg->wdata;
236 struct AutocryptData *ad = menu->mdata;
237 if (!ad)
238 return FR_ERROR;
239
240 int rc = FR_UNKNOWN;
241 for (size_t i = 0; AutocryptFunctions[i].op != OP_NULL; i++)
242 {
243 const struct AutocryptFunction *fn = &AutocryptFunctions[i];
244 if (fn->op == op)
245 {
246 rc = fn->function(ad, event);
247 break;
248 }
249 }
250
251 if (rc == FR_UNKNOWN) // Not our function
252 return rc;
253
254 const char *result = dispatcher_get_retval_name(rc);
255 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
256
257 return rc;
258}
static const struct AutocryptFunction AutocryptFunctions[]
All the NeoMutt functions that the Autocrypt supports.
Definition functions.c:213
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 2219 of file functions.c.

2220{
2221 // The Dispatcher may be called on any Window in the Dialog
2222 struct MuttWindow *dlg = dialog_find(win);
2223 if (!event || !dlg || !dlg->wdata)
2224 return FR_ERROR;
2225
2226 const int op = event->op;
2227
2229
2230 struct ComposeFunctionData fdata = {
2231 .n = NeoMutt,
2232 .mod_data = mod_data,
2233 .shared = dlg->wdata,
2234 };
2235
2236 int rc = FR_UNKNOWN;
2237 for (size_t i = 0; ComposeFunctions[i].op != OP_NULL; i++)
2238 {
2239 const struct ComposeFunction *fn = &ComposeFunctions[i];
2240 if (fn->op == op)
2241 {
2242 rc = fn->function(&fdata, event);
2243 break;
2244 }
2245 }
2246
2247 if (rc == FR_UNKNOWN) // Not our function
2248 return rc;
2249
2250 const char *result = dispatcher_get_retval_name(rc);
2251 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
2252
2253 return rc;
2254}
static const struct ComposeFunction ComposeFunctions[]
All the NeoMutt functions that the Compose supports.
Definition functions.c:2167
@ 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:665
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 412 of file preview.c.

413{
414 if (!event || !win || !win->wdata)
415 return FR_UNKNOWN;
416
417 const int op = event->op;
418 int rc = FR_UNKNOWN;
419 for (size_t i = 0; PreviewFunctions[i].op != OP_NULL; i++)
420 {
421 const struct PreviewFunction *fn = &PreviewFunctions[i];
422 if (fn->op == op)
423 {
424 struct PreviewWindowData *wdata = win->wdata;
425 rc = fn->function(wdata, event);
426 break;
427 }
428 }
429
430 if (rc == FR_UNKNOWN) // Not our function
431 return rc;
432
433 const char *result = dispatcher_get_retval_name(rc);
434 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
435
436 return rc;
437}
static const struct PreviewFunction PreviewFunctions[]
All the functions that the preview window supports.
Definition preview.c:401
A message preview function.
Definition preview.c:106
int op
Op code, e.g. OP_NEXT_PAGE.
Definition preview.c:107
preview_function_t function
Function to call.
Definition preview.c:108
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 532 of file functions.c.

533{
534 if (!event || !win || !win->wdata)
535 return FR_UNKNOWN;
536
537 const int op = event->op;
538
540
541 struct EnterFunctionData fdata = {
542 .n = NeoMutt,
543 .mod_data = mod_data,
544 .wdata = win->wdata,
545 };
546
547 int rc = FR_UNKNOWN;
548 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
549 {
550 const struct EnterFunction *fn = &EnterFunctions[i];
551 if (fn->op == op)
552 {
553 rc = fn->function(&fdata, event);
554 break;
555 }
556 }
557
558 if (rc == FR_UNKNOWN) // Not our function
559 return rc;
560
561 const char *result = dispatcher_get_retval_name(rc);
562 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
563
564 return rc;
565}
static const struct EnterFunction EnterFunctions[]
All the NeoMutt functions that Enter supports.
Definition functions.c:497
@ 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
560 return rc;
561}
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
205 return FR_SUCCESS; // Whatever the outcome, we handled it
206}
@ 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 81 of file functions.c.

82{
83 // The Dispatcher may be called on any Window in the Dialog
84 struct MuttWindow *dlg = dialog_find(win);
85 if (!event || !dlg || !dlg->wdata)
86 return FR_ERROR;
87
88 const int op = event->op;
89 struct Menu *menu = dlg->wdata;
90 struct HistoryData *hd = menu->mdata;
91 if (!hd)
92 return FR_ERROR;
93
94 int rc = FR_UNKNOWN;
95 for (size_t i = 0; HistoryFunctions[i].op != OP_NULL; i++)
96 {
97 const struct HistoryFunction *fn = &HistoryFunctions[i];
98 if (fn->op == op)
99 {
100 rc = fn->function(hd, event);
101 break;
102 }
103 }
104
105 if (rc == FR_UNKNOWN) // Not our function
106 return rc;
107
108 const char *result = dispatcher_get_retval_name(rc);
109 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
110
111 return rc;
112}
static const struct HistoryFunction HistoryFunctions[]
All the NeoMutt functions that the History supports.
Definition functions.c:69
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 3513 of file functions.c.

3514{
3515 // The Dispatcher may be called on any Window in the Dialog
3516 struct MuttWindow *dlg = dialog_find(win);
3517 if (!event || !dlg || !dlg->wdata || !win->parent || !win->parent->wdata)
3518 return FR_ERROR;
3519
3520 const int op = event->op;
3521 struct IndexPrivateData *priv = win->parent->wdata;
3522 struct IndexSharedData *shared = dlg->wdata;
3523
3525
3526 struct IndexFunctionData fdata = {
3527 .n = NeoMutt,
3528 .mod_data = mod_data,
3529 .shared = shared,
3530 .priv = priv,
3531 };
3532
3533 int rc = FR_UNKNOWN;
3534 for (size_t i = 0; IndexFunctions[i].op != OP_NULL; i++)
3535 {
3536 const struct IndexFunction *fn = &IndexFunctions[i];
3537 if (fn->op == op)
3538 {
3539 if (!prereq(shared, priv->menu, fn->flags))
3540 {
3541 rc = FR_ERROR;
3542 break;
3543 }
3544 rc = fn->function(&fdata, event);
3545 break;
3546 }
3547 }
3548
3549 if (rc == FR_UNKNOWN) // Not our function
3550 return rc;
3551
3552 const char *result = dispatcher_get_retval_name(rc);
3553 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
3554
3555 return rc;
3556}
static bool prereq(struct IndexSharedData *shared, struct Menu *menu, CheckFlags checks)
Check the pre-requisites for a function.
Definition functions.c:3315
static const struct IndexFunction IndexFunctions[]
All the NeoMutt functions that the Index supports.
Definition functions.c:3364
@ 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 324 of file functions.c.

325{
326 if (!event || !win || !win->wdata)
327 return FR_UNKNOWN;
328
329 const int op = event->op;
330 struct Menu *menu = win->wdata;
331
332 struct MenuFunctionData fdata = {
333 .n = NeoMutt,
334 .menu = menu,
335 };
336
337 int rc = FR_UNKNOWN;
338 for (size_t i = 0; MenuFunctions[i].op != OP_NULL; i++)
339 {
340 const struct MenuFunction *fn = &MenuFunctions[i];
341 if (fn->op == op)
342 {
343 rc = fn->function(&fdata, event);
344 break;
345 }
346 }
347
348 if (rc == FR_UNKNOWN) // Not our function
349 return rc;
350
351 const char *result = dispatcher_get_retval_name(rc);
352 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
353
354 return rc;
355}
static const struct MenuFunction MenuFunctions[]
All the NeoMutt functions that the Menu supports.
Definition functions.c:284
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:88
+ 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 230 of file tagging.c.

231{
232 if (!win || !win->wdata || !event)
233 return FR_ERROR;
234
235 struct Menu *menu = win->wdata;
236 const int op = event->op;
237
238 switch (op)
239 {
240 case OP_END_COND:
241 return op_end_cond(menu, op);
242 case OP_TAG:
243 return op_tag(menu, op);
244 case OP_TAG_PREFIX:
245 return op_tag_prefix(menu, op);
246 case OP_TAG_PREFIX_COND:
247 return op_tag_prefix_cond(menu, op);
248 case OP_ABORT:
249 return menu_abort(menu);
250 case OP_TIMEOUT:
251 return menu_timeout(menu);
252 default:
253 return menu_other(menu);
254 }
255}
#define OP_TIMEOUT
1 second with no events
Definition opcodes.h:35
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition opcodes.h:36
static int menu_other(struct Menu *menu)
Some non-tagging operation occurred.
Definition tagging.c:220
static int menu_abort(struct Menu *menu)
User aborted an operation.
Definition tagging.c:197
static int op_tag(struct Menu *menu, int op)
Tag the current entry.
Definition tagging.c:86
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:172
static int op_tag_prefix(struct Menu *menu, int op)
Apply next function to tagged messages.
Definition tagging.c:146
static int menu_timeout(struct Menu *menu)
Timeout waiting for a keypress.
Definition tagging.c:209
+ 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 return FR_ERROR;
869
870 const int op = event->op;
871 struct Menu *menu = dlg->wdata;
872 struct GpgmeData *gd = menu->mdata;
873 if (!gd)
874 return FR_ERROR;
875
876 int rc = FR_UNKNOWN;
877 for (size_t i = 0; GpgmeFunctions[i].op != OP_NULL; i++)
878 {
879 const struct GpgmeFunction *fn = &GpgmeFunctions[i];
880 if (fn->op == op)
881 {
882 rc = fn->function(gd, event);
883 break;
884 }
885 }
886
887 if (rc == FR_UNKNOWN) // Not our function
888 return rc;
889
890 const char *result = dispatcher_get_retval_name(rc);
891 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
892
893 return rc;
894}
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 return FR_ERROR;
231
232 const int op = event->op;
233 struct Menu *menu = dlg->wdata;
234 struct PgpData *pd = menu->mdata;
235 if (!pd)
236 return FR_ERROR;
237
238 int rc = FR_UNKNOWN;
239 for (size_t i = 0; PgpFunctions[i].op != OP_NULL; i++)
240 {
241 const struct PgpFunction *fn = &PgpFunctions[i];
242 if (fn->op == op)
243 {
244 rc = fn->function(pd, event);
245 break;
246 }
247 }
248
249 if (rc == FR_UNKNOWN) // Not our function
250 return rc;
251
252 const char *result = dispatcher_get_retval_name(rc);
253 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
254
255 return rc;
256}
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 return FR_ERROR;
116
117 const int op = event->op;
118 struct Menu *menu = dlg->wdata;
119 struct SmimeData *sd = menu->mdata;
120 if (!sd)
121 return FR_ERROR;
122
123 int rc = FR_UNKNOWN;
124 for (size_t i = 0; SmimeFunctions[i].op != OP_NULL; i++)
125 {
126 const struct SmimeFunction *fn = &SmimeFunctions[i];
127 if (fn->op == op)
128 {
129 rc = fn->function(sd, event);
130 break;
131 }
132 }
133
134 if (rc == FR_UNKNOWN) // Not our function
135 return rc;
136
137 const char *result = dispatcher_get_retval_name(rc);
138 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
139
140 return rc;
141}
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 1144 of file functions.c.

1145{
1146 if (!win || !event)
1147 {
1149 return FR_ERROR;
1150 }
1151
1152 struct PagerPrivateData *priv = win->parent->wdata;
1153 if (!priv)
1154 return FR_ERROR;
1155
1156 struct MuttWindow *dlg = dialog_find(win);
1157 if (!dlg || !dlg->wdata)
1158 return FR_ERROR;
1159
1160 const int op = event->op;
1161
1163
1164 struct PagerFunctionData fdata = {
1165 .n = NeoMutt,
1166 .mod_data = mod_data,
1167 .shared = dlg->wdata,
1168 .priv = priv,
1169 };
1170
1171 int rc = FR_UNKNOWN;
1172 for (size_t i = 0; PagerFunctions[i].op != OP_NULL; i++)
1173 {
1174 const struct PagerFunction *fn = &PagerFunctions[i];
1175 if (fn->op == op)
1176 {
1177 rc = fn->function(&fdata, event);
1178 break;
1179 }
1180 }
1181
1182 if (rc == FR_UNKNOWN) // Not our function
1183 return rc;
1184
1185 const char *result = dispatcher_get_retval_name(rc);
1186 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
1187
1188 return rc;
1189}
#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:1115
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 86 of file functions.c.

87{
88 // The Dispatcher may be called on any Window in the Dialog
89 struct MuttWindow *dlg = dialog_find(win);
90 if (!event || !dlg || !dlg->wdata)
91 return FR_ERROR;
92
93 const int op = event->op;
94 struct Menu *menu = dlg->wdata;
95 struct PatternData *pd = menu->mdata;
96 if (!pd)
97 return FR_ERROR;
98
99 struct PatternFunctionData fdata = {
100 .n = NeoMutt,
101 .pd = pd,
102 };
103
104 int rc = FR_UNKNOWN;
105 for (size_t i = 0; PatternFunctions[i].op != OP_NULL; i++)
106 {
107 const struct PatternFunction *fn = &PatternFunctions[i];
108 if (fn->op == op)
109 {
110 rc = fn->function(&fdata, 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
121 return rc;
122}
static const struct PatternFunction PatternFunctions[]
All the NeoMutt functions that the Pattern supports.
Definition functions.c:74
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 192 of file functions.c.

193{
194 // The Dispatcher may be called on any Window in the Dialog
195 struct MuttWindow *dlg = dialog_find(win);
196 if (!event || !dlg || !dlg->wdata)
197 return FR_ERROR;
198
199 const int op = event->op;
200 struct Menu *menu = dlg->wdata;
201 struct PostponeData *pd = menu->mdata;
202 if (!pd)
203 return FR_ERROR;
204
205 int rc = FR_UNKNOWN;
206 for (size_t i = 0; PostponeFunctions[i].op != OP_NULL; i++)
207 {
208 const struct PostponeFunction *fn = &PostponeFunctions[i];
209 if (fn->op == op)
210 {
211 rc = fn->function(pd, event);
212 break;
213 }
214 }
215
216 if (rc == FR_UNKNOWN) // Not our function
217 return rc;
218
219 const char *result = dispatcher_get_retval_name(rc);
220 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
221
222 return rc;
223}
static const struct PostponeFunction PostponeFunctions[]
All the NeoMutt functions that the Postpone supports.
Definition functions.c:175
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 622 of file functions.c.

623{
624 if (!event || !win || !win->wdata)
625 return FR_UNKNOWN;
626
627 const int op = event->op;
628
630
631 struct SidebarFunctionData fdata = {
632 .n = NeoMutt,
633 .mod_data = mod_data,
634 .wdata = win->wdata,
635 };
636
637 int rc = FR_UNKNOWN;
638 for (size_t i = 0; SidebarFunctions[i].op != OP_NULL; i++)
639 {
640 const struct SidebarFunction *fn = &SidebarFunctions[i];
641 if (fn->op == op)
642 {
643 rc = fn->function(&fdata, event);
644 break;
645 }
646 }
647
648 if (rc == FR_UNKNOWN) // Not our function
649 return rc;
650
651 const char *result = dispatcher_get_retval_name(rc);
652 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
653
654 return rc;
655}
@ 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:600
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: