NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
functions.h File Reference

Index functions. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IndexFunction
 A NeoMutt function. More...
 

Typedefs

typedef int(* index_function_t) (struct IndexSharedData *shared, struct IndexPrivateData *priv, int op)
 

Enumerations

enum  IndexRetval {
  IR_UNKNOWN = -7, IR_CONTINUE = -6, IR_DONE = -5, IR_NOT_IMPL = -4,
  IR_NO_ACTION = -3, IR_ERROR = -2, IR_SUCCESS = -1
}
 Possible return values for Index functions. More...
 

Functions

int index_function_dispatcher (struct MuttWindow *win_index, int op)
 Perform an Index function. More...
 

Variables

struct IndexFunction IndexFunctions []
 All the NeoMutt functions that the Index supports. More...
 

Detailed Description

Index functions.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file functions.h.

Typedef Documentation

◆ index_function_t

typedef int(* index_function_t) (struct IndexSharedData *shared, struct IndexPrivateData *priv, int op)

Definition at line 54 of file functions.h.

Enumeration Type Documentation

◆ IndexRetval

Possible return values for Index functions.

Enumerator
IR_UNKNOWN 

Unknown key.

IR_CONTINUE 

Return to the Pager.

IR_DONE 

Exit the Index.

IR_NOT_IMPL 

Invalid function - feature not enabled.

IR_NO_ACTION 

Valid function - no action performed.

IR_ERROR 

Valid function - error occurred.

IR_SUCCESS 

Valid function - successfully performed.

Definition at line 33 of file functions.h.

34 {
35  IR_UNKNOWN = -7,
36  IR_CONTINUE = -6,
37  IR_DONE = -5,
38  IR_NOT_IMPL = -4,
39  IR_NO_ACTION = -3,
40  IR_ERROR = -2,
41  IR_SUCCESS = -1,
42 };
Valid function - successfully performed.
Definition: functions.h:41
Return to the Pager.
Definition: functions.h:36
Exit the Index.
Definition: functions.h:37
Unknown key.
Definition: functions.h:35
Invalid function - feature not enabled.
Definition: functions.h:38
Valid function - error occurred.
Definition: functions.h:40
Valid function - no action performed.
Definition: functions.h:39

Function Documentation

◆ index_function_dispatcher()

int index_function_dispatcher ( struct MuttWindow win_index,
int  op 
)

Perform an Index function.

Parameters
win_indexWindow for the Index
opOperation to perform, e.g. OP_MAIN_LIMIT
Return values
numIndexRetval or opcode

Definition at line 2964 of file functions.c.

2965 {
2966  if (!win_index)
2967  {
2969  return IR_ERROR;
2970  }
2971 
2972  struct IndexPrivateData *priv = win_index->parent->wdata;
2973  if (!priv)
2974  return IR_ERROR;
2975 
2976  struct MuttWindow *dlg = dialog_find(win_index);
2977  if (!dlg || !dlg->wdata)
2978  return IR_ERROR;
2979 
2980  struct IndexSharedData *shared = dlg->wdata;
2981 
2982  int rc = IR_UNKNOWN;
2983  for (size_t i = 0; IndexFunctions[i].op != OP_NULL; i++)
2984  {
2985  const struct IndexFunction *fn = &IndexFunctions[i];
2986  if (fn->op == op)
2987  {
2988  if (!prereq(shared->ctx, priv->menu, fn->flags))
2989  {
2990  rc = IR_ERROR;
2991  break;
2992  }
2993  rc = fn->function(shared, priv, op);
2994  break;
2995  }
2996  }
2997 
2998  return rc;
2999 }
struct IndexFunction IndexFunctions[]
All the NeoMutt functions that the Index supports.
Definition: functions.c:3004
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:44
#define mutt_error(...)
Definition: logging.h:88
Private state data for the Index.
Definition: private_data.h:34
#define _(a)
Definition: message.h:28
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
static const char * Not_available_in_this_menu
Definition: functions.c:89
struct Context * ctx
Current Mailbox view.
Definition: shared_data.h:39
int op
Op code, e.g. OP_MAIN_LIMIT.
Definition: functions.h:61
bool prereq(struct Context *ctx, struct Menu *menu, CheckFlags checks)
Check the pre-requisites for a function.
Definition: functions.c:2914
A NeoMutt function.
Definition: functions.h:59
Unknown key.
Definition: functions.h:35
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
index_function_t function
Function to call.
Definition: functions.h:62
Valid function - error occurred.
Definition: functions.h:40
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:85
int flags
Prerequisites for the function, e.g. CHECK_IN_MAILBOX.
Definition: functions.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ IndexFunctions

struct IndexFunction IndexFunctions[]

All the NeoMutt functions that the Index supports.

Definition at line 3004 of file functions.c.