NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c File Reference

Browser functions. More...

#include "config.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 "lib.h"
#include "attach/lib.h"
#include "editor/lib.h"
#include "history/lib.h"
#include "imap/lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "nntp/lib.h"
#include "pattern/lib.h"
#include "question/lib.h"
#include "send/lib.h"
#include "functions.h"
#include "globals.h"
#include "mutt_mailbox.h"
#include "muttlib.h"
#include "mx.h"
#include "nntp/adata.h"
#include "nntp/mdata.h"
#include "private_data.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 -.
 
void destroy_state (struct BrowserState *state)
 Free the BrowserState.
 
static int op_browser_new_file (struct BrowserPrivateData *priv, int op)
 Select a new file in this directory - Implements browser_function_t -.
 
static int op_browser_subscribe (struct BrowserPrivateData *priv, int op)
 Subscribe to current mbox (IMAP/NNTP only) - Implements browser_function_t -.
 
static int op_browser_tell (struct BrowserPrivateData *priv, int op)
 Display the currently selected file's name - Implements browser_function_t -.
 
static int op_browser_toggle_lsub (struct BrowserPrivateData *priv, int op)
 Toggle view all/subscribed mailboxes (IMAP only) - Implements browser_function_t -.
 
static int op_browser_view_file (struct BrowserPrivateData *priv, int op)
 View file - Implements browser_function_t -.
 
static int op_catchup (struct BrowserPrivateData *priv, int op)
 Mark all articles in newsgroup as read - Implements browser_function_t -.
 
static int op_change_directory (struct BrowserPrivateData *priv, int op)
 Change directories - Implements browser_function_t -.
 
static int op_create_mailbox (struct BrowserPrivateData *priv, int op)
 Create a new mailbox (IMAP only) - Implements browser_function_t -.
 
static int op_delete_mailbox (struct BrowserPrivateData *priv, int op)
 Delete the current mailbox (IMAP only) - Implements browser_function_t -.
 
static int op_enter_mask (struct BrowserPrivateData *priv, int op)
 Enter a file mask - Implements browser_function_t -.
 
static int op_exit (struct BrowserPrivateData *priv, int op)
 Exit this menu - Implements browser_function_t -.
 
static int op_generic_select_entry (struct BrowserPrivateData *priv, int op)
 Select the current entry - Implements browser_function_t -.
 
static int op_load_active (struct BrowserPrivateData *priv, int op)
 Load list of all newsgroups from NNTP server - Implements browser_function_t -.
 
static int op_mailbox_list (struct BrowserPrivateData *priv, int op)
 List mailboxes with new mail - Implements browser_function_t -.
 
static int op_rename_mailbox (struct BrowserPrivateData *priv, int op)
 Rename the current mailbox (IMAP only) - Implements browser_function_t -.
 
static int op_sort (struct BrowserPrivateData *priv, int op)
 Sort messages - Implements browser_function_t -.
 
static int op_toggle_mailboxes (struct BrowserPrivateData *priv, int op)
 Toggle whether to browse mailboxes or all files - Implements browser_function_t -.
 
int browser_function_dispatcher (struct MuttWindow *win, int op)
 Perform a Browser function.
 

Variables

static const char * Not_available_in_this_menu = N_("Not available in this menu")
 Error message for unavailable functions.
 
const struct MenuFuncOp OpBrowser []
 Functions for the file Browser Menu.
 
const struct MenuOpSeq BrowserDefaultBindings []
 Key bindings for the file Browser Menu.
 
static const struct BrowserFunction BrowserFunctions []
 All the NeoMutt functions that the Browser supports.
 

Detailed Description

Browser functions.

Authors
  • Richard Russon
  • Dennis Schön

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

138{
139 struct FolderFile *ff = NULL;
140 ARRAY_FOREACH(ff, &state->entry)
141 {
142 FREE(&ff->name);
143 FREE(&ff->desc);
144 }
145 ARRAY_FREE(&state->entry);
146 FREE(&state->folder);
147}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:204
#define FREE(x)
Definition: memory.h:45
char * folder
Folder name.
Definition: lib.h:146
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:144
Browser entry representing a folder/dir.
Definition: lib.h:77
char * name
Name of file/dir/mailbox.
Definition: lib.h:85
char * desc
Description of mailbox.
Definition: lib.h:86
+ Here is the caller graph for this function:

◆ browser_function_dispatcher()

int browser_function_dispatcher ( struct MuttWindow win,
int  op 
)

Perform a Browser function.

Parameters
winWindow for the Browser
opOperation to perform, e.g. OP_GOTO_PARENT
Return values
numFunctionRetval, e.g. FR_SUCCESS

Definition at line 1140 of file functions.c.

1141{
1142 if (!win)
1143 {
1145 return FR_ERROR;
1146 }
1147
1148 struct BrowserPrivateData *priv = win->parent->wdata;
1149 if (!priv)
1150 return FR_ERROR;
1151
1152 int rc = FR_UNKNOWN;
1153 for (size_t i = 0; BrowserFunctions[i].op != OP_NULL; i++)
1154 {
1155 const struct BrowserFunction *fn = &BrowserFunctions[i];
1156 if (fn->op == op)
1157 {
1158 rc = fn->function(priv, op);
1159 break;
1160 }
1161 }
1162
1163 return rc;
1164}
static const char * Not_available_in_this_menu
Error message for unavailable functions.
Definition: functions.c:55
static const struct BrowserFunction BrowserFunctions[]
All the NeoMutt functions that the Browser supports.
Definition: functions.c:1102
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
@ FR_ERROR
Valid function - error occurred.
Definition: dispatcher.h:38
#define mutt_error(...)
Definition: logging2.h:92
#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
void * wdata
Private data.
Definition: mutt_window.h:144
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:134
+ 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

Error message for unavailable functions.

Definition at line 66 of file functions.c.

◆ OpBrowser

const struct MenuFuncOp OpBrowser[]
Initial value:
= {
{ "catchup", OP_CATCHUP },
{ "change-dir", OP_CHANGE_DIRECTORY },
{ "check-new", OP_CHECK_NEW },
{ "create-mailbox", OP_CREATE_MAILBOX },
{ "delete-mailbox", OP_DELETE_MAILBOX },
{ "descend-directory", OP_DESCEND_DIRECTORY },
{ "display-filename", OP_BROWSER_TELL },
{ "enter-mask", OP_ENTER_MASK },
{ "exit", OP_EXIT },
{ "goto-folder", OP_BROWSER_GOTO_FOLDER },
{ "goto-parent", OP_GOTO_PARENT },
{ "mailbox-list", OP_MAILBOX_LIST },
{ "reload-active", OP_LOAD_ACTIVE },
{ "rename-mailbox", OP_RENAME_MAILBOX },
{ "select-new", OP_BROWSER_NEW_FILE },
{ "sort", OP_SORT },
{ "sort-reverse", OP_SORT_REVERSE },
{ "subscribe", OP_BROWSER_SUBSCRIBE },
{ "subscribe-pattern", OP_SUBSCRIBE_PATTERN },
{ "toggle-mailboxes", OP_TOGGLE_MAILBOXES },
{ "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB },
{ "uncatchup", OP_UNCATCHUP },
{ "unsubscribe", OP_BROWSER_UNSUBSCRIBE },
{ "unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN },
{ "view-file", OP_BROWSER_VIEW_FILE },
{ "buffy-list", OP_MAILBOX_LIST },
{ NULL, 0 },
}

Functions for the file Browser Menu.

Definition at line 74 of file functions.c.

◆ BrowserDefaultBindings

const struct MenuOpSeq BrowserDefaultBindings[]
Initial value:
= {
{ OP_BROWSER_GOTO_FOLDER, "=" },
{ OP_BROWSER_NEW_FILE, "N" },
{ OP_BROWSER_SUBSCRIBE, "s" },
{ OP_BROWSER_TELL, "@" },
{ OP_BROWSER_TOGGLE_LSUB, "T" },
{ OP_BROWSER_UNSUBSCRIBE, "u" },
{ OP_BROWSER_VIEW_FILE, " " },
{ OP_CHANGE_DIRECTORY, "c" },
{ OP_CREATE_MAILBOX, "C" },
{ OP_DELETE_MAILBOX, "d" },
{ OP_ENTER_MASK, "m" },
{ OP_EXIT, "q" },
{ OP_GOTO_PARENT, "p" },
{ OP_MAILBOX_LIST, "." },
{ OP_RENAME_MAILBOX, "r" },
{ OP_SORT, "o" },
{ OP_SORT_REVERSE, "O" },
{ OP_TOGGLE_MAILBOXES, "\t" },
{ 0, NULL },
}

Key bindings for the file Browser Menu.

Definition at line 108 of file functions.c.

◆ BrowserFunctions

const struct BrowserFunction BrowserFunctions[]
static

All the NeoMutt functions that the Browser supports.

Definition at line 1102 of file functions.c.