NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
lib.h File Reference

Select a Mailbox from a list. More...

#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include "mutt/lib.h"
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Folder
 A folder/dir in the browser. More...
 
struct  FolderFile
 Browser entry representing a folder/dir. More...
 
struct  BrowserState
 State of the file/mailbox browser. More...
 

Macros

#define MUTT_SEL_NO_FLAGS   0
 No flags are set. More...
 
#define MUTT_SEL_MAILBOX   (1 << 0)
 Select a mailbox. More...
 
#define MUTT_SEL_MULTI   (1 << 1)
 Multi-selection is enabled. More...
 
#define MUTT_SEL_FOLDER   (1 << 2)
 Select a local directory. More...
 

Typedefs

typedef uint8_t SelectFileFlags
 Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX. More...
 

Functions

 ARRAY_HEAD (BrowserStateEntry, struct FolderFile)
 
void mutt_select_file (char *file, size_t filelen, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
 Let the user select a file. More...
 
void mutt_buffer_select_file (struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
 Let the user select a file. More...
 
void mutt_browser_select_dir (const char *f)
 Remember the last directory selected. More...
 
void mutt_browser_cleanup (void)
 Clean up working Buffers. More...
 
void browser_sort (struct BrowserState *state)
 Sort the entries in the browser. More...
 
void browser_add_folder (const struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *st, struct Mailbox *m, void *data)
 Add a folder to the browser list. More...
 
void browser_highlight_default (struct BrowserState *state, struct Menu *menu)
 Decide which browser item should be highlighted. More...
 
int examine_directory (struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *d, const char *prefix)
 Get list of all files/newsgroups with mask. More...
 
int examine_mailboxes (struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
 Get list of mailboxes/subscribed newsgroups. More...
 
void init_menu (struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
 Set up a new menu. More...
 
void init_state (struct BrowserState *state, struct Menu *menu)
 Initialise a browser state. More...
 
bool link_is_dir (const char *folder, const char *path)
 Does this symlink point to a directory? More...
 
void destroy_state (struct BrowserState *state)
 Free the BrowserState. More...
 
void dump_state (struct BrowserState *state)
 

Variables

struct Buffer LastDir
 
struct Buffer LastDirBackup
 

Detailed Description

Select a Mailbox from a list.

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 lib.h.

Macro Definition Documentation

◆ MUTT_SEL_NO_FLAGS

#define MUTT_SEL_NO_FLAGS   0

No flags are set.

Definition at line 55 of file lib.h.

◆ MUTT_SEL_MAILBOX

#define MUTT_SEL_MAILBOX   (1 << 0)

Select a mailbox.

Definition at line 56 of file lib.h.

◆ MUTT_SEL_MULTI

#define MUTT_SEL_MULTI   (1 << 1)

Multi-selection is enabled.

Definition at line 57 of file lib.h.

◆ MUTT_SEL_FOLDER

#define MUTT_SEL_FOLDER   (1 << 2)

Select a local directory.

Definition at line 58 of file lib.h.

Typedef Documentation

◆ SelectFileFlags

typedef uint8_t SelectFileFlags

Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.

Definition at line 54 of file lib.h.

Function Documentation

◆ ARRAY_HEAD()

ARRAY_HEAD ( BrowserStateEntry  ,
struct FolderFile   
)

◆ mutt_select_file()

void mutt_select_file ( char *  file,
size_t  filelen,
SelectFileFlags  flags,
struct Mailbox m,
char ***  files,
int *  numfiles 
)

Let the user select a file.

Parameters
[in]fileBuffer for the result
[in]filelenLength of buffer
[in]flagsFlags, see SelectFileFlags
[in]mMailbox
[out]filesArray of selected files
[out]numfilesNumber of selected files

Definition at line 1372 of file browser.c.

1374{
1375 struct Buffer *f_buf = mutt_buffer_pool_get();
1376
1377 mutt_buffer_strcpy(f_buf, NONULL(file));
1378 mutt_buffer_select_file(f_buf, flags, m, files, numfiles);
1379 mutt_str_copy(file, mutt_buffer_string(f_buf), filelen);
1380
1382}
void mutt_buffer_select_file(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file.
Definition: browser.c:1088
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:327
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:652
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
#define NONULL(x)
Definition: string2.h:37
String manipulation buffer.
Definition: buffer.h:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_buffer_select_file()

void mutt_buffer_select_file ( struct Buffer file,
SelectFileFlags  flags,
struct Mailbox m,
char ***  files,
int *  numfiles 
)

Let the user select a file.

Parameters
[in]fileBuffer for the result
[in]flagsFlags, see SelectFileFlags
[in]mMailbox
[out]filesArray of selected files
[out]numfilesNumber of selected files

Definition at line 1088 of file browser.c.

1090{
1092 priv->file = file;
1093 priv->mailbox = m;
1094 priv->files = files;
1095 priv->numfiles = numfiles;
1096 struct MuttWindow *dlg = NULL;
1097
1098 priv->multiple = (flags & MUTT_SEL_MULTI);
1099 priv->folder = (flags & MUTT_SEL_FOLDER);
1100 priv->state.is_mailbox_list = (flags & MUTT_SEL_MAILBOX) && priv->folder;
1101 priv->last_selected_mailbox = -1;
1102
1103 init_lastdir();
1104
1105#ifdef USE_NNTP
1106 if (OptNews)
1107 {
1108 if (mutt_buffer_is_empty(file))
1109 {
1111
1112 /* default state for news reader mode is browse subscribed newsgroups */
1113 priv->state.is_mailbox_list = false;
1114 for (size_t i = 0; i < adata->groups_num; i++)
1115 {
1116 struct NntpMboxData *mdata = adata->groups_list[i];
1117 if (mdata && mdata->subscribed)
1118 {
1119 priv->state.is_mailbox_list = true;
1120 break;
1121 }
1122 }
1123 }
1124 else
1125 {
1126 mutt_buffer_copy(priv->prefix, file);
1127 }
1128 }
1129 else
1130#endif
1131 if (!mutt_buffer_is_empty(file))
1132 {
1134#ifdef USE_IMAP
1135 if (imap_path_probe(mutt_buffer_string(file), NULL) == MUTT_IMAP)
1136 {
1137 init_state(&priv->state, NULL);
1138 priv->state.imap_browse = true;
1139 if (imap_browse(mutt_buffer_string(file), &priv->state) == 0)
1140 {
1142 browser_sort(&priv->state);
1143 }
1144 }
1145 else
1146 {
1147#endif
1148 int i;
1149 for (i = mutt_buffer_len(file) - 1;
1150 (i > 0) && ((mutt_buffer_string(file))[i] != '/'); i--)
1151 {
1152 ; // do nothing
1153 }
1154
1155 if (i > 0)
1156 {
1157 if ((mutt_buffer_string(file))[0] == '/')
1158 {
1160 }
1161 else
1162 {
1166 }
1167 }
1168 else
1169 {
1170 if ((mutt_buffer_string(file))[0] == '/')
1172 else
1174 }
1175
1176 if ((i <= 0) && (mutt_buffer_string(file)[0] != '/'))
1177 mutt_buffer_copy(priv->prefix, file);
1178 else
1179 mutt_buffer_strcpy(priv->prefix, mutt_buffer_string(file) + i + 1);
1180 priv->kill_prefix = true;
1181#ifdef USE_IMAP
1182 }
1183#endif
1184 }
1185 else
1186 {
1187 if (!priv->folder)
1188 {
1190 }
1191 else
1192 {
1193 /* Whether we use the tracking feature of the browser depends
1194 * on which sort method we chose to use. This variable is defined
1195 * only to help readability of the code. */
1196 bool browser_track = false;
1197
1198 const short c_sort_browser = cs_subset_sort(NeoMutt->sub, "sort_browser");
1199 switch (c_sort_browser & SORT_MASK)
1200 {
1201 case SORT_DESC:
1202 case SORT_SUBJECT:
1203 case SORT_ORDER:
1204 browser_track = true;
1205 break;
1206 }
1207
1208 /* We use mutt_browser_select_dir to initialize the two
1209 * variables (LastDir, LastDirBackup) at the appropriate
1210 * values.
1211 *
1212 * We do it only when LastDir is not set (first pass there)
1213 * or when CurrentFolder and LastDirBackup are not the same.
1214 * This code is executed only when we list files, not when
1215 * we press up/down keys to navigate in a displayed list.
1216 *
1217 * We only do this when CurrentFolder has been set (ie, not
1218 * when listing folders on startup with "neomutt -y").
1219 *
1220 * This tracker is only used when browser_track is true,
1221 * meaning only with sort methods SUBJECT/DESC for now. */
1222 if (CurrentFolder)
1223 {
1225 {
1226 /* If browsing in "local"-mode, than we chose to define LastDir to
1227 * MailDir */
1229 {
1230 case MUTT_IMAP:
1231 case MUTT_MAILDIR:
1232 case MUTT_MBOX:
1233 case MUTT_MH:
1234 case MUTT_MMDF:
1235 {
1236 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
1237 const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
1238 if (c_folder)
1239 mutt_buffer_strcpy(&LastDir, c_folder);
1240 else if (c_spool_file)
1241 mutt_browser_select_dir(c_spool_file);
1242 break;
1243 }
1244 default:
1246 break;
1247 }
1248 }
1250 {
1252 }
1253 }
1254
1255 /* When browser tracking feature is disabled, clear LastDirBackup */
1256 if (!browser_track)
1258 }
1259
1260#ifdef USE_IMAP
1261 if (!priv->state.is_mailbox_list &&
1263 {
1264 init_state(&priv->state, NULL);
1265 priv->state.imap_browse = true;
1267 browser_sort(&priv->state);
1268 }
1269 else
1270#endif
1271 {
1272 size_t i = mutt_buffer_len(&LastDir);
1273 while ((i > 0) && (mutt_buffer_string(&LastDir)[--i] == '/'))
1274 LastDir.data[i] = '\0';
1278 }
1279 }
1280
1281 mutt_buffer_reset(file);
1282
1283 const struct Mapping *help_data = NULL;
1284#ifdef USE_NNTP
1285 if (OptNews)
1286 help_data = FolderNewsHelp;
1287 else
1288#endif
1289 help_data = FolderHelp;
1290
1291 dlg = simple_dialog_new(MENU_FOLDER, WT_DLG_BROWSER, help_data);
1292
1293 priv->menu = dlg->wdata;
1294 dlg->wdata = priv;
1297 if (priv->multiple)
1298 priv->menu->tag = file_tag;
1299
1300 priv->sbar = window_find_child(dlg, WT_STATUS_BAR);
1302
1303 struct MuttWindow *win_menu = priv->menu->win;
1304
1305 // NT_COLOR is handled by the SimpleDialog
1308
1309 if (priv->state.is_mailbox_list)
1310 {
1311 examine_mailboxes(m, NULL, &priv->state);
1312 }
1313 else
1314#ifdef USE_IMAP
1315 if (!priv->state.imap_browse)
1316#endif
1317 {
1318 // examine_directory() calls browser_add_folder() which needs the menu
1319 if (examine_directory(m, priv->menu, &priv->state, mutt_buffer_string(&LastDir),
1320 mutt_buffer_string(priv->prefix)) == -1)
1321 {
1322 goto bail;
1323 }
1324 }
1325
1326 init_menu(&priv->state, priv->menu, m, priv->sbar);
1327 // only now do we have a valid priv->state to attach
1328 priv->menu->mdata = &priv->state;
1329
1330 // ---------------------------------------------------------------------------
1331 // Event Loop
1332 int op = OP_NULL;
1333 do
1334 {
1335 menu_tagging_dispatcher(priv->menu->win, op);
1336 window_redraw(NULL);
1337
1338 op = km_dokey(MENU_FOLDER);
1339 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
1340 if (op < 0)
1341 continue;
1342 if (op == OP_NULL)
1343 {
1345 continue;
1346 }
1348
1349 int rc = browser_function_dispatcher(priv->win_browser, op);
1350
1351 if (rc == FR_UNKNOWN)
1352 rc = menu_function_dispatcher(priv->menu->win, op);
1353 if (rc == FR_UNKNOWN)
1354 rc = global_function_dispatcher(NULL, op);
1355 } while (!priv->done);
1356 // ---------------------------------------------------------------------------
1357
1358bail:
1359 simple_dialog_free(&dlg);
1361}
int browser_function_dispatcher(struct MuttWindow *win_browser, int op)
Perform a Browser function.
Definition: functions.c:1143
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: lib.h:56
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:194
#define MUTT_SEL_FOLDER
Select a local directory.
Definition: lib.h:58
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: lib.h:57
struct BrowserPrivateData * browser_private_data_new(void)
Create new Browser Data.
Definition: private_data.c:54
void init_state(struct BrowserState *state, struct Menu *menu)
Initialise a browser state.
Definition: browser.c:532
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
Definition: browser.c:874
static void init_lastdir(void)
Initialise the browser directories.
Definition: browser.c:144
static const struct Mapping FolderNewsHelp[]
Help Bar for the NNTP Mailbox browser dialog.
Definition: browser.c:122
struct Buffer LastDir
Definition: browser.c:136
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
Definition: browser.c:1068
struct Buffer LastDirBackup
Definition: browser.c:137
static const struct Mapping FolderHelp[]
Help Bar for the File/Dir/Mailbox browser dialog.
Definition: browser.c:109
int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *d, const char *prefix)
Get list of all files/newsgroups with mask.
Definition: browser.c:556
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
Definition: browser.c:684
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:260
size_t mutt_buffer_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
Definition: buffer.c:105
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:371
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:248
void mutt_buffer_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition: buffer.c:189
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:462
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:85
size_t mutt_buffer_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
Definition: buffer.c:342
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:317
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:223
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:164
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:320
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static void folder_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the folder browser - Implements Menu::make_entry() -.
Definition: browser.c:806
static int select_file_search(struct Menu *menu, regex_t *rx, int line)
Menu search callback for matching files - Implements Menu::search() -.
Definition: browser.c:790
static int file_tag(struct Menu *menu, int sel, int act)
Tag an entry in the menu - Implements Menu::tag() -.
Definition: browser.c:983
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
Definition: imap.c:2400
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: browser.c:1003
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: browser.c:1035
void browser_private_data_free(struct BrowserPrivateData **ptr)
Free Private Browser Data - Implements MuttWindow::wdata_free() -.
Definition: private_data.c:36
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:166
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:129
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
Definition: browse.c:182
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:795
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1061
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
@ MUTT_MMDF
'mmdf' Mailbox type
Definition: mailbox.h:46
@ MUTT_MH
'MH' Mailbox type
Definition: mailbox.h:47
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
@ MUTT_MBOX
'mbox' Mailbox type
Definition: mailbox.h:45
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition: mailbox.h:48
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:189
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
Definition: path.c:561
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
char * CurrentFolder
Currently selected mailbox.
Definition: mutt_globals.h:54
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:604
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
@ WT_DLG_BROWSER
Browser Dialog, mutt_buffer_select_file()
Definition: mutt_window.h:80
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:322
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1327
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:46
bool OptNews
(pseudo) used to change reader mode
Definition: options.h:50
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
@ SORT_SUBJECT
Sort by the email's subject.
Definition: sort2.h:46
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:48
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:63
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
Private state data for the Browser.
Definition: private_data.h:34
char *** files
Array of selected files.
Definition: private_data.h:38
struct Menu * menu
Menu.
Definition: private_data.h:43
struct Buffer * prefix
Folder prefix string.
Definition: private_data.h:49
bool kill_prefix
Prefix is in use.
Definition: private_data.h:44
bool done
Should we close the Dialog?
Definition: private_data.h:53
bool folder
Select folders.
Definition: private_data.h:46
int last_selected_mailbox
Index of last selected Mailbox.
Definition: private_data.h:50
int * numfiles
Number of selected files.
Definition: private_data.h:39
struct Mailbox * mailbox
Mailbox.
Definition: private_data.h:37
struct BrowserState state
State containing list of files/dir/mailboxes.
Definition: private_data.h:42
struct Buffer * file
Buffer for the result.
Definition: private_data.h:36
bool multiple
Allow mulitple selections.
Definition: private_data.h:45
struct MuttWindow * win_browser
Browser Window.
Definition: private_data.h:52
struct MuttWindow * sbar
Status Bar.
Definition: private_data.h:51
char * folder
Folder name.
Definition: lib.h:115
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:117
bool imap_browse
IMAP folder.
Definition: lib.h:114
char * data
Pointer to data.
Definition: buffer.h:35
void * mdata
Driver specific data.
Definition: mailbox.h:132
Mapping between user-readable string and a constant.
Definition: mapping.h:32
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:96
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition: lib.h:109
int(* tag)(struct Menu *menu, int sel, int act)
Definition: lib.h:121
void * mdata
Private data.
Definition: lib.h:137
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
NNTP-specific Account data -.
Definition: adata.h:37
void ** groups_list
Definition: adata.h:61
NNTP-specific Mailbox data -.
Definition: mdata.h:33
struct NntpAccountData * adata
Definition: mdata.h:47
@ MENU_FOLDER
General file/mailbox browser.
Definition: type.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_browser_select_dir()

void mutt_browser_select_dir ( const char *  f)

Remember the last directory selected.

Parameters
fDirectory name to save

This function helps the browser to know which directory has been selected. It should be called anywhere a confirm hit is done to open a new directory/file which is a maildir/mbox.

We could check if the sort method is appropriate with this feature.

Definition at line 1068 of file browser.c.

1069{
1070 init_lastdir();
1071
1073
1074 /* Method that will fetch the parent path depending on the type of the path. */
1075 char buf[PATH_MAX] = { 0 };
1078}
#define PATH_MAX
Definition: mutt.h:40
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
Definition: muttlib.c:1549
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_browser_cleanup()

void mutt_browser_cleanup ( void  )

Clean up working Buffers.

Definition at line 158 of file browser.c.

159{
162}
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:309
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_sort()

void browser_sort ( struct BrowserState state)

Sort the entries in the browser.

Parameters
stateBrowser state

Call to qsort using browser_compare function. Some specific sort methods are not used via NNTP.

Definition at line 194 of file sort.c.

195{
196 const short c_sort_browser = cs_subset_sort(NeoMutt->sub, "sort_browser");
197 switch (c_sort_browser & SORT_MASK)
198 {
199#ifdef USE_NNTP
200 case SORT_SIZE:
201 case SORT_DATE:
202 if (OptNews)
203 return;
204#endif
205 default:
206 break;
207 }
208
210}
#define ARRAY_SORT(head, fn)
Sort an array.
Definition: array.h:277
static int browser_compare(const void *a, const void *b)
Sort the items in the browser - Implements sort_t -.
Definition: sort.c:156
@ SORT_SIZE
Sort by the size of the email.
Definition: sort2.h:44
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:43
struct BrowserStateEntry entry
Array of files / dirs / mailboxes.
Definition: lib.h:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_add_folder()

void browser_add_folder ( const struct Menu menu,
struct BrowserState state,
const char *  name,
const char *  desc,
const struct stat *  st,
struct Mailbox m,
void *  data 
)

Add a folder to the browser list.

Parameters
menuMenu to use
stateBrowser state
nameName of folder
descDescription of folder
ststat info for the folder
mMailbox
dataData to associate with the folder

Definition at line 479 of file browser.c.

482{
483 if ((!menu || state->is_mailbox_list) && m && !m->visible)
484 {
485 return;
486 }
487
488 struct FolderFile ff = { 0 };
489
490 if (st)
491 {
492 ff.mode = st->st_mode;
493 ff.mtime = st->st_mtime;
494 ff.size = st->st_size;
495 ff.gid = st->st_gid;
496 ff.uid = st->st_uid;
497 ff.nlink = st->st_nlink;
498 ff.local = true;
499 }
500 else
501 {
502 ff.local = false;
503 }
504
505 if (m)
506 {
507 ff.has_mailbox = true;
508 ff.gen = m->gen;
509 ff.has_new_mail = m->has_new;
510 ff.msg_count = m->msg_count;
511 ff.msg_unread = m->msg_unread;
512 }
513
514 ff.name = mutt_str_dup(name);
515 ff.desc = mutt_str_dup(desc ? desc : name);
516#ifdef USE_IMAP
517 ff.imap = false;
518#endif
519#ifdef USE_NNTP
520 if (OptNews)
521 ff.nd = data;
522#endif
523
524 ARRAY_ADD(&state->entry, ff);
525}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition: array.h:155
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:250
Browser entry representing a folder/dir.
Definition: lib.h:73
bool imap
This is an IMAP folder.
Definition: lib.h:91
bool has_mailbox
This is a mailbox.
Definition: lib.h:95
char * name
Name of file/dir/mailbox.
Definition: lib.h:81
uid_t uid
File's User ID.
Definition: lib.h:77
gid_t gid
File's Group ID.
Definition: lib.h:78
bool has_new_mail
true if mailbox has "new mail"
Definition: lib.h:84
nlink_t nlink
Number of hard links.
Definition: lib.h:79
char * desc
Description of mailbox.
Definition: lib.h:82
struct NntpMboxData * nd
Extra NNTP data.
Definition: lib.h:99
off_t size
File size.
Definition: lib.h:75
int gen
Unique id, used for (un)sorting.
Definition: lib.h:102
time_t mtime
Modification time.
Definition: lib.h:76
int msg_count
total number of messages
Definition: lib.h:85
mode_t mode
File permissions.
Definition: lib.h:74
int msg_unread
number of unread messages
Definition: lib.h:86
bool has_new
Mailbox has new mail.
Definition: mailbox.h:85
int msg_count
Total number of messages.
Definition: mailbox.h:88
bool visible
True if a result of "mailboxes".
Definition: mailbox.h:130
int msg_unread
Number of unread messages.
Definition: mailbox.h:89
int gen
Generation number, for sorting.
Definition: mailbox.h:146
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_highlight_default()

void browser_highlight_default ( struct BrowserState state,
struct Menu menu 
)

Decide which browser item should be highlighted.

Parameters
stateBrowser state
menuCurrent Menu

This function takes a menu and a state and defines the current entry that should be highlighted.

Definition at line 848 of file browser.c.

849{
850 menu->top = 0;
851 /* Reset menu position to 1.
852 * We do not risk overflow as the init_menu function changes
853 * current if it is bigger than state->entrylen. */
854 if (!ARRAY_EMPTY(&state->entry) &&
855 (mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "..") ||
856 mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "../")))
857 {
858 /* Skip the first entry, unless there's only one entry. */
859 menu_set_index(menu, (menu->max > 1));
860 }
861 else
862 {
863 menu_set_index(menu, 0);
864 }
865}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition: array.h:134
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:73
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:168
int top
Entry that is the top of the current page.
Definition: lib.h:80
int max
Number of entries in the menu.
Definition: lib.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ examine_directory()

int examine_directory ( struct Mailbox m,
struct Menu menu,
struct BrowserState state,
const char *  d,
const char *  prefix 
)

Get list of all files/newsgroups with mask.

Parameters
mMailbox
menuCurrent Menu
stateState of browser
dDirectory
prefixFiles/newsgroups must match this prefix
Return values
0Success
-1Error

Definition at line 556 of file browser.c.

558{
559 int rc = -1;
560 struct Buffer *buf = mutt_buffer_pool_get();
561#ifdef USE_NNTP
562 if (OptNews)
563 {
565
566 init_state(state, menu);
567
568 for (unsigned int i = 0; i < adata->groups_num; i++)
569 {
570 struct NntpMboxData *mdata = adata->groups_list[i];
571 if (!mdata)
572 continue;
573 if (prefix && *prefix && !mutt_str_startswith(mdata->group, prefix))
574 continue;
575 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
576 if (!mutt_regex_match(c_mask, mdata->group))
577 {
578 continue;
579 }
580 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
581 }
582 }
583 else
584#endif /* USE_NNTP */
585 {
586 struct stat st = { 0 };
587 DIR *dp = NULL;
588 struct dirent *de = NULL;
589
590 while (stat(d, &st) == -1)
591 {
592 if (errno == ENOENT)
593 {
594 /* The last used directory is deleted, try to use the parent dir. */
595 char *c = strrchr(d, '/');
596
597 if (c && (c > d))
598 {
599 *c = '\0';
600 continue;
601 }
602 }
603 mutt_perror(d);
604 goto ed_out;
605 }
606
607 if (!S_ISDIR(st.st_mode))
608 {
609 mutt_error(_("%s is not a directory"), d);
610 goto ed_out;
611 }
612
613 if (m)
615
616 dp = opendir(d);
617 if (!dp)
618 {
619 mutt_perror(d);
620 goto ed_out;
621 }
622
623 init_state(state, menu);
624
625 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
627 while ((de = readdir(dp)))
628 {
629 if (mutt_str_equal(de->d_name, "."))
630 continue; /* we don't need . */
631
632 if (prefix && *prefix && !mutt_str_startswith(de->d_name, prefix))
633 {
634 continue;
635 }
636 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
637 if (!mutt_regex_match(c_mask, de->d_name))
638 {
639 continue;
640 }
641
642 mutt_buffer_concat_path(buf, d, de->d_name);
643 if (lstat(mutt_buffer_string(buf), &st) == -1)
644 continue;
645
646 /* No size for directories or symlinks */
647 if (S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
648 st.st_size = 0;
649 else if (!S_ISREG(st.st_mode))
650 continue;
651
652 struct MailboxNode *np = NULL;
653 STAILQ_FOREACH(np, &ml, entries)
654 {
656 break;
657 }
658
659 if (np && m && mutt_str_equal(np->mailbox->realpath, m->realpath))
660 {
661 np->mailbox->msg_count = m->msg_count;
662 np->mailbox->msg_unread = m->msg_unread;
663 }
664 browser_add_folder(menu, state, de->d_name, NULL, &st, np ? np->mailbox : NULL, NULL);
665 }
667 closedir(dp);
668 }
669 browser_sort(state);
670 rc = 0;
671ed_out:
673 return rc;
674}
void browser_add_folder(const struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *st, struct Mailbox *m, void *data)
Add a folder to the browser list.
Definition: browser.c:479
size_t mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
Definition: buffer.c:389
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
Definition: helpers.c:243
#define mutt_error(...)
Definition: logging.h:87
#define mutt_perror(...)
Definition: logging.h:88
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:210
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:42
#define _(a)
Definition: message.h:28
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
Definition: regex.c:631
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:227
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:156
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
Definition: mxapi.h:74
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:141
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:164
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
List of Mailboxes.
Definition: mailbox.h:153
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
char * group
Name of newsgroup.
Definition: mdata.h:34
Cached regular expression.
Definition: regex3.h:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ examine_mailboxes()

int examine_mailboxes ( struct Mailbox m,
struct Menu menu,
struct BrowserState state 
)

Get list of mailboxes/subscribed newsgroups.

Parameters
mMailbox
menuCurrent menu
stateState of browser
Return values
0Success
-1Error

Definition at line 684 of file browser.c.

685{
686 struct stat st = { 0 };
687 struct Buffer *md = NULL;
688 struct Buffer *mailbox = NULL;
689
690#ifdef USE_NNTP
691 if (OptNews)
692 {
694
695 init_state(state, menu);
696
697 for (unsigned int i = 0; i < adata->groups_num; i++)
698 {
699 const bool c_show_only_unread = cs_subset_bool(NeoMutt->sub, "show_only_unread");
700 struct NntpMboxData *mdata = adata->groups_list[i];
701 if (mdata && (mdata->has_new_mail ||
702 (mdata->subscribed && (mdata->unread || !c_show_only_unread))))
703 {
704 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
705 }
706 }
707 }
708 else
709#endif
710 {
711 init_state(state, menu);
712
714 return -1;
715 mailbox = mutt_buffer_pool_get();
717
719
720 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
722 struct MailboxNode *np = NULL;
723 STAILQ_FOREACH(np, &ml, entries)
724 {
725 if (!np->mailbox)
726 continue;
727
728 if (m && mutt_str_equal(np->mailbox->realpath, m->realpath))
729 {
730 np->mailbox->msg_count = m->msg_count;
731 np->mailbox->msg_unread = m->msg_unread;
732 }
733
735 const bool c_browser_abbreviate_mailboxes = cs_subset_bool(NeoMutt->sub, "browser_abbreviate_mailboxes");
736 if (c_browser_abbreviate_mailboxes)
738
739 switch (np->mailbox->type)
740 {
741 case MUTT_IMAP:
742 case MUTT_POP:
744 np->mailbox->name, NULL, np->mailbox, NULL);
745 continue;
746 case MUTT_NOTMUCH:
747 case MUTT_NNTP:
748 browser_add_folder(menu, state, mailbox_path(np->mailbox),
749 np->mailbox->name, NULL, np->mailbox, NULL);
750 continue;
751 default: /* Continue */
752 break;
753 }
754
755 if (lstat(mailbox_path(np->mailbox), &st) == -1)
756 continue;
757
758 if ((!S_ISREG(st.st_mode)) && (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)))
759 continue;
760
761 if (np->mailbox->type == MUTT_MAILDIR)
762 {
763 struct stat st2 = { 0 };
764
765 mutt_buffer_printf(md, "%s/new", mailbox_path(np->mailbox));
766 if (stat(mutt_buffer_string(md), &st) < 0)
767 st.st_mtime = 0;
768 mutt_buffer_printf(md, "%s/cur", mailbox_path(np->mailbox));
769 if (stat(mutt_buffer_string(md), &st2) < 0)
770 st2.st_mtime = 0;
771 if (st2.st_mtime > st.st_mtime)
772 st.st_mtime = st2.st_mtime;
773 }
774
775 browser_add_folder(menu, state, mutt_buffer_string(mailbox),
776 np->mailbox->name, &st, np->mailbox, NULL);
777 }
779 }
780 browser_sort(state);
781
782 mutt_buffer_pool_release(&mailbox);
784 return 0;
785}
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:51
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:599
#define TAILQ_EMPTY(head)
Definition: queue.h:721
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_menu()

void init_menu ( struct BrowserState state,
struct Menu menu,
struct Mailbox m,
struct MuttWindow sbar 
)

Set up a new menu.

Parameters
stateBrowser state
menuCurrent menu
mMailbox
sbarStatus bar

Definition at line 874 of file browser.c.

876{
877 char title[256] = { 0 };
878 menu->max = ARRAY_SIZE(&state->entry);
879
880 int index = menu_get_index(menu);
881 if (index >= menu->max)
882 menu_set_index(menu, menu->max - 1);
883 if (index < 0)
884 menu_set_index(menu, 0);
885 if (menu->top > index)
886 menu->top = 0;
887
888 menu->num_tagged = 0;
889
890#ifdef USE_NNTP
891 if (OptNews)
892 {
893 if (state->is_mailbox_list)
894 {
895 snprintf(title, sizeof(title), _("Subscribed newsgroups"));
896 }
897 else
898 {
899 snprintf(title, sizeof(title), _("Newsgroups on server [%s]"),
901 }
902 }
903 else
904#endif
905 {
906 if (state->is_mailbox_list)
907 {
908 snprintf(title, sizeof(title), _("Mailboxes [%d]"),
910 }
911 else
912 {
913 struct Buffer *path = mutt_buffer_pool_get();
916 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
917#ifdef USE_IMAP
918 const bool c_imap_list_subscribed = cs_subset_bool(NeoMutt->sub, "imap_list_subscribed");
919 if (state->imap_browse && c_imap_list_subscribed)
920 {
921 snprintf(title, sizeof(title), _("Subscribed [%s], File mask: %s"),
922 mutt_buffer_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
923 }
924 else
925#endif
926 {
927 snprintf(title, sizeof(title), _("Directory [%s], File mask: %s"),
928 mutt_buffer_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
929 }
931 }
932 }
933 sbar_set_title(sbar, title);
934
935 /* Browser tracking feature.
936 * The goal is to highlight the good directory if LastDir is the parent dir
937 * of LastDirBackup (this occurs mostly when one hit "../"). It should also work
938 * properly when the user is in examine_mailboxes-mode. */
940 {
941 char target_dir[PATH_MAX] = { 0 };
942
943#ifdef USE_IMAP
944 /* Check what kind of dir LastDirBackup is. */
946 {
947 mutt_str_copy(target_dir, mutt_buffer_string(&LastDirBackup), sizeof(target_dir));
948 imap_clean_path(target_dir, sizeof(target_dir));
949 }
950 else
951#endif
952 mutt_str_copy(target_dir, strrchr(mutt_buffer_string(&LastDirBackup), '/') + 1,
953 sizeof(target_dir));
954
955 /* If we get here, it means that LastDir is the parent directory of
956 * LastDirBackup. I.e., we're returning from a subdirectory, and we want
957 * to position the cursor on the directory we're returning from. */
958 bool matched = false;
959 struct FolderFile *ff = NULL;
960 ARRAY_FOREACH(ff, &state->entry)
961 {
962 if (mutt_str_equal(ff->name, target_dir))
963 {
964 menu_set_index(menu, ARRAY_FOREACH_IDX);
965 matched = true;
966 break;
967 }
968 }
969 if (!matched)
970 browser_highlight_default(state, menu);
971 }
972 else
973 {
974 browser_highlight_default(state, menu);
975 }
976
978}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:86
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: browser.c:848
void imap_clean_path(char *path, size_t plen)
Cleans an IMAP path using imap_fix_path.
Definition: util.c:188
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:178
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:154
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:224
char host[128]
Server to login to.
Definition: connaccount.h:54
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:50
int num_tagged
Number of tagged entries.
Definition: lib.h:83
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:63
char * pattern
printable version
Definition: regex3.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_state()

void init_state ( struct BrowserState state,
struct Menu menu 
)

Initialise a browser state.

Parameters
stateBrowserState to initialise
menuCurrent menu

Definition at line 532 of file browser.c.

533{
534 ARRAY_INIT(&state->entry);
535 ARRAY_RESERVE(&state->entry, 256);
536#ifdef USE_IMAP
537 state->imap_browse = false;
538#endif
539 if (menu)
540 {
541 menu->mdata = &state->entry;
542 menu->mdata_free = NULL; // Menu doesn't own the data
543 }
544}
#define ARRAY_RESERVE(head, num)
Reserve memory for the array.
Definition: array.h:188
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:64
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:152
+ Here is the caller graph for this function:

◆ link_is_dir()

bool link_is_dir ( const char *  folder,
const char *  path 
)

Does this symlink point to a directory?

Parameters
folderFolder
pathLink name
Return values
trueLinks to a directory
falseOtherwise

Definition at line 171 of file browser.c.

172{
173 struct stat st = { 0 };
174 bool retval = false;
175
176 struct Buffer *fullpath = mutt_buffer_pool_get();
177 mutt_buffer_concat_path(fullpath, folder, path);
178
179 if (stat(mutt_buffer_string(fullpath), &st) == 0)
180 retval = S_ISDIR(st.st_mode);
181
182 mutt_buffer_pool_release(&fullpath);
183
184 return retval;
185}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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_FREE(head)
Release all memory.
Definition: array.h:203
#define FREE(x)
Definition: memory.h:43
+ Here is the caller graph for this function:

◆ dump_state()

void dump_state ( struct BrowserState state)

Variable Documentation

◆ LastDir

struct Buffer LastDir
extern

Definition at line 136 of file browser.c.

◆ LastDirBackup

struct Buffer LastDirBackup
extern

Definition at line 137 of file browser.c.