NeoMutt  2022-04-29-323-g5fcc6c
Teaching an old dog new tricks
DOXYGEN
functions.c File Reference

Browser functions. More...

#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "functions.h"
#include "lib.h"
#include "attach/lib.h"
#include "enter/lib.h"
#include "menu/lib.h"
#include "question/lib.h"
#include "send/lib.h"
#include "mutt_globals.h"
#include "mutt_mailbox.h"
#include "muttlib.h"
#include "mx.h"
#include "opcodes.h"
#include "options.h"
#include "private_data.h"
#include "imap/lib.h"
#include "nntp/lib.h"
#include "nntp/adata.h"
#include "nntp/mdata.h"
+ Include dependency graph for functions.c:

Go to the source code of this file.

Functions

static int op_subscribe_pattern (struct BrowserPrivateData *priv, int op)
 Subscribe to newsgroups matching a pattern - Implements browser_function_t -. More...
 
void destroy_state (struct BrowserState *state)
 Free the BrowserState. More...
 
static int op_browser_new_file (struct BrowserPrivateData *priv, int op)
 Select a new file in this directory - Implements browser_function_t -. More...
 
static int op_browser_subscribe (struct BrowserPrivateData *priv, int op)
 Subscribe to current mbox (IMAP/NNTP only) - Implements browser_function_t -. More...
 
static int op_browser_tell (struct BrowserPrivateData *priv, int op)
 Display the currently selected file's name - Implements browser_function_t -. More...
 
static int op_browser_toggle_lsub (struct BrowserPrivateData *priv, int op)
 Toggle view all/subscribed mailboxes (IMAP only) - Implements browser_function_t -. More...
 
static int op_browser_view_file (struct BrowserPrivateData *priv, int op)
 View file - Implements browser_function_t -. More...
 
static int op_catchup (struct BrowserPrivateData *priv, int op)
 Mark all articles in newsgroup as read - Implements browser_function_t -. More...
 
static int op_change_directory (struct BrowserPrivateData *priv, int op)
 Change directories - Implements browser_function_t -. More...
 
static int op_create_mailbox (struct BrowserPrivateData *priv, int op)
 Create a new mailbox (IMAP only) - Implements browser_function_t -. More...
 
static int op_delete_mailbox (struct BrowserPrivateData *priv, int op)
 Delete the current mailbox (IMAP only) - Implements browser_function_t -. More...
 
static int op_enter_mask (struct BrowserPrivateData *priv, int op)
 Enter a file mask - Implements browser_function_t -. More...
 
static int op_exit (struct BrowserPrivateData *priv, int op)
 Exit this menu - Implements browser_function_t -. More...
 
static int op_generic_select_entry (struct BrowserPrivateData *priv, int op)
 Select the current entry - Implements browser_function_t -. More...
 
static int op_load_active (struct BrowserPrivateData *priv, int op)
 Load list of all newsgroups from NNTP server - Implements browser_function_t -. More...
 
static int op_mailbox_list (struct BrowserPrivateData *priv, int op)
 List mailboxes with new mail - Implements browser_function_t -. More...
 
static int op_rename_mailbox (struct BrowserPrivateData *priv, int op)
 Rename the current mailbox (IMAP only) - Implements browser_function_t -. More...
 
static int op_sort (struct BrowserPrivateData *priv, int op)
 Sort messages - Implements browser_function_t -. More...
 
static int op_toggle_mailboxes (struct BrowserPrivateData *priv, int op)
 Toggle whether to browse mailboxes or all files - Implements browser_function_t -. More...
 
int browser_function_dispatcher (struct MuttWindow *win_browser, int op)
 Perform a Browser function. More...
 

Variables

static const char * Not_available_in_this_menu = N_("Not available in this menu")
 
struct BrowserFunction BrowserFunctions []
 All the NeoMutt functions that the Browser supports. More...
 

Detailed Description

Browser 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.c.

Function Documentation

◆ destroy_state()

void destroy_state ( struct BrowserState state)

Free the BrowserState.

Parameters
stateState to free

Frees up the memory allocated for the local-global variables.

Definition at line 74 of file functions.c.

75{
76 struct FolderFile *ff = NULL;
77 ARRAY_FOREACH(ff, &state->entry)
78 {
79 FREE(&ff->name);
80 FREE(&ff->desc);
81 }
82 ARRAY_FREE(&state->entry);
83
84#ifdef USE_IMAP
85 FREE(&state->folder);
86#endif
87}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:203
#define FREE(x)
Definition: memory.h:43
char * folder
Folder name.
Definition: lib.h:115
struct BrowserStateEntry entry
Array of files / dirs / mailboxes.
Definition: lib.h:112
Browser entry representing a folder/dir.
Definition: lib.h:73
char * name
Name of file/dir/mailbox.
Definition: lib.h:81
char * desc
Description of mailbox.
Definition: lib.h:82
+ Here is the caller graph for this function:

◆ browser_function_dispatcher()

int browser_function_dispatcher ( struct MuttWindow win_browser,
int  op 
)

Perform a Browser function.

Parameters
win_browserWindow for the Index
opOperation to perform, e.g. OP_GOTO_PARENT
Return values
numFunctionRetval, e.g. FR_SUCCESS

Definition at line 1143 of file functions.c.

1144{
1145 if (!win_browser)
1146 {
1148 return FR_ERROR;
1149 }
1150
1151 struct BrowserPrivateData *priv = win_browser->parent->wdata;
1152 if (!priv)
1153 return FR_ERROR;
1154
1155 int rc = FR_UNKNOWN;
1156 for (size_t i = 0; BrowserFunctions[i].op != OP_NULL; i++)
1157 {
1158 const struct BrowserFunction *fn = &BrowserFunctions[i];
1159 if (fn->op == op)
1160 {
1161 rc = fn->function(priv, op);
1162 break;
1163 }
1164 }
1165
1166 return rc;
1167}
struct BrowserFunction BrowserFunctions[]
All the NeoMutt functions that the Browser supports.
Definition: functions.c:1087
static const char * Not_available_in_this_menu
Definition: functions.c:64
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
@ FR_ERROR
Valid function - error occurred.
Definition: dispatcher.h:38
#define mutt_error(...)
Definition: logging.h:87
#define _(a)
Definition: message.h:28
A NeoMutt function.
Definition: functions.h:44
int op
Op code, e.g. OP_MAIN_LIMIT.
Definition: functions.h:45
browser_function_t function
Function to call.
Definition: functions.h:46
Private state data for the Browser.
Definition: private_data.h:34
struct MuttWindow * win_browser
Browser Window.
Definition: private_data.h:52
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
+ Here is the caller graph for this function:

Variable Documentation

◆ Not_available_in_this_menu

const char* Not_available_in_this_menu = N_("Not available in this menu")
static

Definition at line 64 of file functions.c.

◆ BrowserFunctions

struct BrowserFunction BrowserFunctions[]

All the NeoMutt functions that the Browser supports.

Definition at line 1087 of file functions.c.