NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_browser.c
Go to the documentation of this file.
1
76#include "config.h"
77#include <assert.h>
78#include <dirent.h>
79#include <errno.h>
80#include <grp.h>
81#include <limits.h>
82#include <locale.h>
83#include <pwd.h>
84#include <stdbool.h>
85#include <stdio.h>
86#include <string.h>
87#include <sys/stat.h>
88#include <time.h>
89#include "mutt/lib.h"
90#include "config/lib.h"
91#include "core/lib.h"
92#include "conn/lib.h"
93#include "gui/lib.h"
94#include "lib.h"
95#include "expando/lib.h"
96#include "imap/lib.h"
97#include "key/lib.h"
98#include "menu/lib.h"
99#include "nntp/lib.h"
100#include "functions.h"
101#include "globals.h"
102#include "mutt_logging.h"
103#include "mutt_mailbox.h"
104#include "muttlib.h"
105#include "mx.h"
106#include "nntp/adata.h"
107#include "nntp/mdata.h"
108#include "private_data.h"
109
112
114static const struct Mapping FolderHelp[] = {
115 // clang-format off
116 { N_("Exit"), OP_EXIT },
117 { N_("Chdir"), OP_CHANGE_DIRECTORY },
118 { N_("Goto"), OP_BROWSER_GOTO_FOLDER },
119 { N_("Mask"), OP_ENTER_MASK },
120 { N_("Help"), OP_HELP },
121 { NULL, 0 },
122 // clang-format on
123};
124
126static const struct Mapping FolderNewsHelp[] = {
127 // clang-format off
128 { N_("Exit"), OP_EXIT },
129 { N_("List"), OP_TOGGLE_MAILBOXES },
130 { N_("Subscribe"), OP_BROWSER_SUBSCRIBE },
131 { N_("Unsubscribe"), OP_BROWSER_UNSUBSCRIBE },
132 { N_("Catchup"), OP_CATCHUP },
133 { N_("Mask"), OP_ENTER_MASK },
134 { N_("Help"), OP_HELP },
135 { NULL, 0 },
136 // clang-format on
137};
138
140struct Buffer LastDir = { 0 };
142struct Buffer LastDirBackup = { 0 };
143
149static void init_lastdir(void)
150{
151 static bool done = false;
152 if (!done)
153 {
156 done = true;
157 }
158}
159
164{
167}
168
176bool link_is_dir(const char *folder, const char *path)
177{
178 struct stat st = { 0 };
179 bool rc = false;
180
181 struct Buffer *fullpath = buf_pool_get();
182 buf_concat_path(fullpath, folder, path);
183
184 if (stat(buf_string(fullpath), &st) == 0)
185 rc = S_ISDIR(st.st_mode);
186
187 buf_pool_release(&fullpath);
188
189 return rc;
190}
191
195long folder_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
196{
197 const struct Folder *folder = data;
198
199 if (!folder->ff->local)
200 return 0;
201
202 return folder->ff->mtime;
203}
204
208void folder_date(const struct ExpandoNode *node, void *data,
209 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
210{
211 const struct Folder *folder = data;
212
213 if (!folder->ff->local)
214 return;
215
216 char tmp[128] = { 0 };
217 char tmp2[128] = { 0 };
218 int len = node->end - node->start;
219 const char *start = node->start;
220
221 struct tm tm = mutt_date_localtime(folder->ff->mtime);
222 bool use_c_locale = false;
223 if (*start == '!')
224 {
225 use_c_locale = true;
226 start++;
227 len--;
228 }
229 assert(len < sizeof(tmp2));
230 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
231
232 if (use_c_locale)
233 {
234 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
235 }
236 else
237 {
238 strftime(tmp, sizeof(tmp), tmp2, &tm);
239 }
240
241 buf_strcpy(buf, tmp);
242}
243
247void folder_space(const struct ExpandoNode *node, void *data,
248 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
249{
250 buf_addstr(buf, " ");
251}
252
256long folder_a_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
257{
258 const struct Folder *folder = data;
259
260 return folder->ff->notify_user;
261}
262
266long folder_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
267{
268 const struct Folder *folder = data;
269
270 return folder->num + 1;
271}
272
276long folder_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
277{
278 const struct Folder *folder = data;
279 if (!folder->ff->local)
280 return 0;
281
282 return folder->ff->mtime;
283}
284
288void folder_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
289 int max_cols, struct Buffer *buf)
290{
291 const struct Folder *folder = data;
292 if (!folder->ff->local)
293 return;
294
295 static const time_t one_year = 31536000;
296 const char *t_fmt = ((mutt_date_now() - folder->ff->mtime) < one_year) ?
297 "%b %d %H:%M" :
298 "%b %d %Y";
299
300 char tmp[128] = { 0 };
301
302 mutt_date_localtime_format(tmp, sizeof(tmp), t_fmt, folder->ff->mtime);
303
304 buf_strcpy(buf, tmp);
305}
306
310long folder_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
311{
312 const struct Folder *folder = data;
313 if (!folder->ff->local)
314 return 0;
315
316 return folder->ff->mtime;
317}
318
322void folder_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
323 int max_cols, struct Buffer *buf)
324{
325 const struct Folder *folder = data;
326 if (!folder->ff->local)
327 return;
328
329 char tmp[128] = { 0 };
330 bool use_c_locale = false;
331 const char *const c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
332 const char *t_fmt = NONULL(c_date_format);
333 if (*t_fmt == '!')
334 {
335 t_fmt++;
336 use_c_locale = true;
337 }
338
339 if (use_c_locale)
340 {
341 mutt_date_localtime_format_locale(tmp, sizeof(tmp), t_fmt,
342 folder->ff->mtime, NeoMutt->time_c_locale);
343 }
344 else
345 {
346 mutt_date_localtime_format(tmp, sizeof(tmp), t_fmt, folder->ff->mtime);
347 }
348
349 buf_strcpy(buf, tmp);
350}
351
355void folder_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
356 int max_cols, struct Buffer *buf)
357{
358 const struct Folder *folder = data;
359
360 const char *s = NONULL(folder->ff->name);
361
362 buf_printf(buf, "%s%s", s,
363 folder->ff->local ?
364 (S_ISLNK(folder->ff->mode) ?
365 "@" :
366 (S_ISDIR(folder->ff->mode) ?
367 "/" :
368 (((folder->ff->mode & S_IXUSR) != 0) ? "*" : ""))) :
369 "");
370}
371
375void folder_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
376 int max_cols, struct Buffer *buf)
377{
378 const struct Folder *folder = data;
379
380 if (folder->ff->local)
381 {
382 buf_printf(buf, "%c%c%c%c%c%c%c%c%c%c",
383 S_ISDIR(folder->ff->mode) ? 'd' : (S_ISLNK(folder->ff->mode) ? 'l' : '-'),
384 ((folder->ff->mode & S_IRUSR) != 0) ? 'r' : '-',
385 ((folder->ff->mode & S_IWUSR) != 0) ? 'w' : '-',
386 ((folder->ff->mode & S_ISUID) != 0) ? 's' :
387 ((folder->ff->mode & S_IXUSR) != 0) ? 'x' :
388 '-',
389 ((folder->ff->mode & S_IRGRP) != 0) ? 'r' : '-',
390 ((folder->ff->mode & S_IWGRP) != 0) ? 'w' : '-',
391 ((folder->ff->mode & S_ISGID) != 0) ? 's' :
392 ((folder->ff->mode & S_IXGRP) != 0) ? 'x' :
393 '-',
394 ((folder->ff->mode & S_IROTH) != 0) ? 'r' : '-',
395 ((folder->ff->mode & S_IWOTH) != 0) ? 'w' : '-',
396 ((folder->ff->mode & S_ISVTX) != 0) ? 't' :
397 ((folder->ff->mode & S_IXOTH) != 0) ? 'x' :
398 '-');
399 }
400 else if (folder->ff->imap)
401 {
402 /* mark folders with subfolders AND mail */
403 buf_printf(buf, "IMAP %c", (folder->ff->inferiors && folder->ff->selectable) ? '+' : ' ');
404 }
405}
406
410void folder_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
411 int max_cols, struct Buffer *buf)
412{
413 const struct Folder *folder = data;
414 if (!folder->ff->local)
415 return;
416
417 struct group *gr = getgrgid(folder->ff->gid);
418 if (gr)
419 {
420 buf_addstr(buf, gr->gr_name);
421 }
422 else
423 {
424 buf_printf(buf, "%u", folder->ff->gid);
425 }
426}
427
431void folder_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
432 int max_cols, struct Buffer *buf)
433{
434 const struct Folder *folder = data;
435
436 const char *s = NULL;
437 if (folder->ff->desc)
438 s = folder->ff->desc;
439 else
440 s = folder->ff->name;
441
442 buf_printf(buf, "%s%s", s,
443 folder->ff->local ?
444 (S_ISLNK(folder->ff->mode) ?
445 "@" :
446 (S_ISDIR(folder->ff->mode) ?
447 "/" :
448 (((folder->ff->mode & S_IXUSR) != 0) ? "*" : ""))) :
449 "");
450}
451
455long folder_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
456{
457 const struct Folder *folder = data;
458
459 if (folder->ff->local)
460 return folder->ff->nlink;
461
462 return 0;
463}
464
468void folder_l(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
469 int max_cols, struct Buffer *buf)
470{
471 const struct Folder *folder = data;
472 if (!folder->ff->local)
473 return;
474
475 buf_add_printf(buf, "%d", (int) folder->ff->nlink);
476}
477
481long folder_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
482{
483 const struct Folder *folder = data;
484
485 if (folder->ff->has_mailbox)
486 return folder->ff->msg_count;
487
488 return 0;
489}
490
494void folder_m(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
495 int max_cols, struct Buffer *buf)
496{
497 const struct Folder *folder = data;
498 if (!folder->ff->has_mailbox)
499 return;
500
501 buf_add_printf(buf, "%d", folder->ff->msg_count);
502}
503
507long folder_n_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
508{
509 const struct Folder *folder = data;
510
511 if (folder->ff->has_mailbox)
512 return folder->ff->msg_unread;
513
514 return 0;
515}
516
520void folder_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
521 int max_cols, struct Buffer *buf)
522{
523 const struct Folder *folder = data;
524 if (!folder->ff->has_mailbox)
525 return;
526
527 buf_add_printf(buf, "%d", folder->ff->msg_unread);
528}
529
533long folder_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
534{
535 const struct Folder *folder = data;
536 return folder->ff->has_new_mail;
537}
538
542void folder_N(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
543 int max_cols, struct Buffer *buf)
544{
545 const struct Folder *folder = data;
546
547 // NOTE(g0mb4): use $to_chars?
548 const char *s = folder->ff->has_new_mail ? "N" : " ";
549 buf_strcpy(buf, s);
550}
551
555long folder_p_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
556{
557 const struct Folder *folder = data;
558
559 return folder->ff->poll_new_mail;
560}
561
565long folder_s_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
566{
567 const struct Folder *folder = data;
568 return folder->ff->size;
569}
570
574void folder_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
575 int max_cols, struct Buffer *buf)
576{
577 const struct Folder *folder = data;
578
579 char tmp[128] = { 0 };
580
581 mutt_str_pretty_size(tmp, sizeof(tmp), folder->ff->size);
582 buf_strcpy(buf, tmp);
583}
584
588long folder_t_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
589{
590 const struct Folder *folder = data;
591 return folder->ff->tagged;
592}
593
597void folder_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
598 int max_cols, struct Buffer *buf)
599{
600 const struct Folder *folder = data;
601
602 // NOTE(g0mb4): use $to_chars?
603 const char *s = folder->ff->tagged ? "*" : " ";
604 buf_strcpy(buf, s);
605}
606
610void folder_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
611 int max_cols, struct Buffer *buf)
612{
613 const struct Folder *folder = data;
614 if (!folder->ff->local)
615 return;
616
617 struct passwd *pw = getpwuid(folder->ff->uid);
618 if (pw)
619 {
620 buf_addstr(buf, pw->pw_name);
621 }
622 else
623 {
624 buf_printf(buf, "%u", folder->ff->uid);
625 }
626}
627
638void browser_add_folder(const struct Menu *menu, struct BrowserState *state,
639 const char *name, const char *desc,
640 const struct stat *st, struct Mailbox *m, void *data)
641{
642 if ((!menu || state->is_mailbox_list) && m && !m->visible)
643 {
644 return;
645 }
646
647 struct FolderFile ff = { 0 };
648
649 if (st)
650 {
651 ff.mode = st->st_mode;
652 ff.mtime = st->st_mtime;
653 ff.size = st->st_size;
654 ff.gid = st->st_gid;
655 ff.uid = st->st_uid;
656 ff.nlink = st->st_nlink;
657 ff.local = true;
658 }
659 else
660 {
661 ff.local = false;
662 }
663
664 if (m)
665 {
666 ff.has_mailbox = true;
667 ff.gen = m->gen;
668 ff.has_new_mail = m->has_new;
669 ff.msg_count = m->msg_count;
670 ff.msg_unread = m->msg_unread;
671 ff.notify_user = m->notify_user;
673 }
674
675 ff.name = mutt_str_dup(name);
676 ff.desc = mutt_str_dup(desc ? desc : name);
677 ff.imap = false;
678 if (OptNews)
679 ff.nd = data;
680
681 ARRAY_ADD(&state->entry, ff);
682}
683
689void init_state(struct BrowserState *state, struct Menu *menu)
690{
691 ARRAY_INIT(&state->entry);
692 ARRAY_RESERVE(&state->entry, 256);
693 state->imap_browse = false;
694
695 if (menu)
696 {
697 menu->mdata = &state->entry;
698 menu->mdata_free = NULL; // Menu doesn't own the data
699 }
700}
701
712int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state,
713 const char *dirname, const char *prefix)
714{
715 int rc = -1;
716 struct Buffer *buf = buf_pool_get();
717 if (OptNews)
718 {
720
721 init_state(state, menu);
722
723 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
724 for (unsigned int i = 0; i < adata->groups_num; i++)
725 {
726 struct NntpMboxData *mdata = adata->groups_list[i];
727 if (!mdata)
728 continue;
729 if (prefix && *prefix && !mutt_str_startswith(mdata->group, prefix))
730 continue;
731 if (!mutt_regex_match(c_mask, mdata->group))
732 {
733 continue;
734 }
735 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
736 }
737 }
738 else
739 {
740 struct stat st = { 0 };
741 DIR *dir = NULL;
742 struct dirent *de = NULL;
743
744 while (stat(dirname, &st) == -1)
745 {
746 if (errno == ENOENT)
747 {
748 /* The last used directory is deleted, try to use the parent dir. */
749 char *c = strrchr(dirname, '/');
750
751 if (c && (c > dirname))
752 {
753 *c = '\0';
754 continue;
755 }
756 }
757 mutt_perror("%s", dirname);
758 goto ed_out;
759 }
760
761 if (!S_ISDIR(st.st_mode))
762 {
763 mutt_error(_("%s is not a directory"), dirname);
764 goto ed_out;
765 }
766
767 if (m)
769
770 dir = mutt_file_opendir(dirname, MUTT_OPENDIR_NONE);
771 if (!dir)
772 {
773 mutt_perror("%s", dirname);
774 goto ed_out;
775 }
776
777 init_state(state, menu);
778
779 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
781
782 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
783 while ((de = readdir(dir)))
784 {
785 if (mutt_str_equal(de->d_name, "."))
786 continue; /* we don't need . */
787
788 if (prefix && *prefix && !mutt_str_startswith(de->d_name, prefix))
789 {
790 continue;
791 }
792 if (!mutt_regex_match(c_mask, de->d_name))
793 {
794 continue;
795 }
796
797 buf_concat_path(buf, dirname, de->d_name);
798 if (lstat(buf_string(buf), &st) == -1)
799 continue;
800
801 /* No size for directories or symlinks */
802 if (S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
803 st.st_size = 0;
804 else if (!S_ISREG(st.st_mode))
805 continue;
806
807 struct MailboxNode *np = NULL;
808 STAILQ_FOREACH(np, &ml, entries)
809 {
811 break;
812 }
813
814 if (np && m && m->poll_new_mail && mutt_str_equal(np->mailbox->realpath, m->realpath))
815 {
816 np->mailbox->msg_count = m->msg_count;
817 np->mailbox->msg_unread = m->msg_unread;
818 }
819 browser_add_folder(menu, state, de->d_name, NULL, &st, np ? np->mailbox : NULL, NULL);
820 }
822 closedir(dir);
823 }
824 browser_sort(state);
825 rc = 0;
826ed_out:
827 buf_pool_release(&buf);
828 return rc;
829}
830
839int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
840{
841 struct stat st = { 0 };
842 struct Buffer *md = NULL;
843 struct Buffer *mailbox = NULL;
844
845 if (OptNews)
846 {
848
849 init_state(state, menu);
850
851 const bool c_show_only_unread = cs_subset_bool(NeoMutt->sub, "show_only_unread");
852 for (unsigned int i = 0; i < adata->groups_num; i++)
853 {
854 struct NntpMboxData *mdata = adata->groups_list[i];
855 if (mdata && (mdata->has_new_mail ||
856 (mdata->subscribed && (mdata->unread || !c_show_only_unread))))
857 {
858 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
859 }
860 }
861 }
862 else
863 {
864 init_state(state, menu);
865
867 return -1;
868 mailbox = buf_pool_get();
869 md = buf_pool_get();
870
872
873 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
875 struct MailboxNode *np = NULL;
876 const bool c_browser_abbreviate_mailboxes = cs_subset_bool(NeoMutt->sub, "browser_abbreviate_mailboxes");
877
878 STAILQ_FOREACH(np, &ml, entries)
879 {
880 if (!np->mailbox)
881 continue;
882
883 if (m && m->poll_new_mail && mutt_str_equal(np->mailbox->realpath, m->realpath))
884 {
885 np->mailbox->msg_count = m->msg_count;
886 np->mailbox->msg_unread = m->msg_unread;
887 }
888
890 if (c_browser_abbreviate_mailboxes)
892
893 switch (np->mailbox->type)
894 {
895 case MUTT_IMAP:
896 case MUTT_POP:
898 np->mailbox->name, NULL, np->mailbox, NULL);
899 continue;
900 case MUTT_NOTMUCH:
901 case MUTT_NNTP:
902 browser_add_folder(menu, state, mailbox_path(np->mailbox),
903 np->mailbox->name, NULL, np->mailbox, NULL);
904 continue;
905 default: /* Continue */
906 break;
907 }
908
909 if (lstat(mailbox_path(np->mailbox), &st) == -1)
910 continue;
911
912 if ((!S_ISREG(st.st_mode)) && (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)))
913 continue;
914
915 if (np->mailbox->type == MUTT_MAILDIR)
916 {
917 struct stat st2 = { 0 };
918
919 buf_printf(md, "%s/new", mailbox_path(np->mailbox));
920 if (stat(buf_string(md), &st) < 0)
921 st.st_mtime = 0;
922 buf_printf(md, "%s/cur", mailbox_path(np->mailbox));
923 if (stat(buf_string(md), &st2) < 0)
924 st2.st_mtime = 0;
925 if (st2.st_mtime > st.st_mtime)
926 st.st_mtime = st2.st_mtime;
927 }
928
929 browser_add_folder(menu, state, buf_string(mailbox), np->mailbox->name,
930 &st, np->mailbox, NULL);
931 }
933 }
934 browser_sort(state);
935
936 buf_pool_release(&mailbox);
937 buf_pool_release(&md);
938 return 0;
939}
940
944static int select_file_search(struct Menu *menu, regex_t *rx, int line)
945{
946 struct BrowserEntryArray *entry = menu->mdata;
947 if (OptNews)
948 return regexec(rx, ARRAY_GET(entry, line)->desc, 0, NULL, 0);
949 struct FolderFile *ff = ARRAY_GET(entry, line);
950 char *search_on = ff->desc ? ff->desc : ff->name;
951
952 return regexec(rx, search_on, 0, NULL, 0);
953}
954
960static int folder_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
961{
962 struct BrowserState *bstate = menu->mdata;
963 struct BrowserEntryArray *entry = &bstate->entry;
964 struct Folder folder = {
965 .ff = ARRAY_GET(entry, line),
966 .num = line,
967 };
968
969 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
970 if (c_arrow_cursor)
971 {
972 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
973 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
974 }
975
976 if (OptNews)
977 {
978 const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
979 return expando_render(c_group_index_format, GroupIndexRenderData, &folder,
980 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
981 }
982
983 if (bstate->is_mailbox_list)
984 {
985 const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
986 return expando_render(c_mailbox_folder_format, FolderRenderData, &folder,
987 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
988 }
989
990 const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
991 return expando_render(c_folder_format, FolderRenderData, &folder,
992 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
993}
994
1003void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
1004{
1005 menu->top = 0;
1006 /* Reset menu position to 1.
1007 * We do not risk overflow as the init_menu function changes
1008 * current if it is bigger than state->entrylen. */
1009 if (!ARRAY_EMPTY(&state->entry) &&
1010 (mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "..") ||
1011 mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "../")))
1012 {
1013 /* Skip the first entry, unless there's only one entry. */
1014 menu_set_index(menu, (menu->max > 1));
1015 }
1016 else
1017 {
1018 menu_set_index(menu, 0);
1019 }
1020}
1021
1029void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m,
1030 struct MuttWindow *sbar)
1031{
1032 char title[256] = { 0 };
1033 menu->max = ARRAY_SIZE(&state->entry);
1034
1035 int index = menu_get_index(menu);
1036 if (index >= menu->max)
1037 menu_set_index(menu, menu->max - 1);
1038 if (index < 0)
1039 menu_set_index(menu, 0);
1040 if (menu->top > index)
1041 menu->top = 0;
1042
1043 menu->num_tagged = 0;
1044
1045 if (OptNews)
1046 {
1047 if (state->is_mailbox_list)
1048 {
1049 snprintf(title, sizeof(title), _("Subscribed newsgroups"));
1050 }
1051 else
1052 {
1053 snprintf(title, sizeof(title), _("Newsgroups on server [%s]"),
1055 }
1056 }
1057 else
1058 {
1059 if (state->is_mailbox_list)
1060 {
1061 snprintf(title, sizeof(title), _("Mailboxes [%d]"),
1063 }
1064 else
1065 {
1066 struct Buffer *path = buf_pool_get();
1067 buf_copy(path, &LastDir);
1068 buf_pretty_mailbox(path);
1069 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
1070 const bool c_imap_list_subscribed = cs_subset_bool(NeoMutt->sub, "imap_list_subscribed");
1071 if (state->imap_browse && c_imap_list_subscribed)
1072 {
1073 snprintf(title, sizeof(title), _("Subscribed [%s], File mask: %s"),
1074 buf_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
1075 }
1076 else
1077 {
1078 snprintf(title, sizeof(title), _("Directory [%s], File mask: %s"),
1079 buf_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
1080 }
1081 buf_pool_release(&path);
1082 }
1083 }
1084 sbar_set_title(sbar, title);
1085
1086 /* Browser tracking feature.
1087 * The goal is to highlight the good directory if LastDir is the parent dir
1088 * of LastDirBackup (this occurs mostly when one hit "../"). It should also work
1089 * properly when the user is in examine_mailboxes-mode. */
1091 {
1092 char target_dir[PATH_MAX] = { 0 };
1093
1094 /* Check what kind of dir LastDirBackup is. */
1096 {
1097 mutt_str_copy(target_dir, buf_string(&LastDirBackup), sizeof(target_dir));
1098 imap_clean_path(target_dir, sizeof(target_dir));
1099 }
1100 else
1101 {
1102 mutt_str_copy(target_dir, strrchr(buf_string(&LastDirBackup), '/') + 1,
1103 sizeof(target_dir));
1104 }
1105
1106 /* If we get here, it means that LastDir is the parent directory of
1107 * LastDirBackup. I.e., we're returning from a subdirectory, and we want
1108 * to position the cursor on the directory we're returning from. */
1109 bool matched = false;
1110 struct FolderFile *ff = NULL;
1111 ARRAY_FOREACH(ff, &state->entry)
1112 {
1113 if (mutt_str_equal(ff->name, target_dir))
1114 {
1115 menu_set_index(menu, ARRAY_FOREACH_IDX);
1116 matched = true;
1117 break;
1118 }
1119 }
1120 if (!matched)
1121 browser_highlight_default(state, menu);
1122 }
1123 else
1124 {
1125 browser_highlight_default(state, menu);
1126 }
1127
1129}
1130
1134static int file_tag(struct Menu *menu, int sel, int act)
1135{
1136 struct BrowserEntryArray *entry = menu->mdata;
1137 struct FolderFile *ff = ARRAY_GET(entry, sel);
1138 if (S_ISDIR(ff->mode) ||
1139 (S_ISLNK(ff->mode) && link_is_dir(buf_string(&LastDir), ff->name)))
1140 {
1141 mutt_error(_("Can't attach a directory"));
1142 return 0;
1143 }
1144
1145 bool ot = ff->tagged;
1146 ff->tagged = ((act >= 0) ? act : !ff->tagged);
1147
1148 return ff->tagged - ot;
1149}
1150
1155{
1156 if (nc->event_type != NT_CONFIG)
1157 return 0;
1158 if (!nc->global_data || !nc->event_data)
1159 return -1;
1160
1161 struct EventConfig *ev_c = nc->event_data;
1162
1163 struct BrowserPrivateData *priv = nc->global_data;
1164 struct Menu *menu = priv->menu;
1165
1166 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
1167 {
1168 struct BrowserState *state = menu->mdata;
1169 browser_sort(state);
1170 browser_highlight_default(state, menu);
1171 }
1172 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1173 !mutt_str_equal(ev_c->name, "date_format") &&
1174 !mutt_str_equal(ev_c->name, "folder") &&
1175 !mutt_str_equal(ev_c->name, "folder_format") &&
1176 !mutt_str_equal(ev_c->name, "group_index_format") &&
1177 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1178 !mutt_str_equal(ev_c->name, "sort_browser"))
1179 {
1180 return 0;
1181 }
1182
1184 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1185
1186 return 0;
1187}
1188
1195{
1196 if (nc->event_type != NT_MAILBOX)
1197 return 0;
1199 return 0;
1200 if (!nc->global_data || !nc->event_data)
1201 return -1;
1202
1203 struct BrowserPrivateData *priv = nc->global_data;
1204
1205 struct BrowserState *state = &priv->state;
1206 if (state->is_mailbox_list)
1207 {
1208 struct EventMailbox *ev_m = nc->event_data;
1209 struct Mailbox *m = ev_m->mailbox;
1210 struct FolderFile *ff = NULL;
1211 ARRAY_FOREACH(ff, &state->entry)
1212 {
1213 if (ff->gen != m->gen)
1214 continue;
1215
1216 ff->has_new_mail = m->has_new;
1217 ff->msg_count = m->msg_count;
1218 ff->msg_unread = m->msg_unread;
1219 ff->notify_user = m->notify_user;
1221 mutt_str_replace(&ff->desc, m->name);
1222 break;
1223 }
1224 }
1225
1227 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
1228
1229 return 0;
1230}
1231
1240{
1241 if (nc->event_type != NT_WINDOW)
1242 return 0;
1243 if (!nc->global_data || !nc->event_data)
1244 return -1;
1246 return 0;
1247
1248 struct BrowserPrivateData *priv = nc->global_data;
1249 struct MuttWindow *win_menu = priv->menu->win;
1250
1251 struct EventWindow *ev_w = nc->event_data;
1252 if (ev_w->win != win_menu)
1253 return 0;
1254
1258
1259 mutt_debug(LL_DEBUG5, "window delete done\n");
1260 return 0;
1261}
1262
1273void mutt_browser_select_dir(const char *f)
1274{
1275 init_lastdir();
1276
1278
1279 /* Method that will fetch the parent path depending on the type of the path. */
1280 char buf[PATH_MAX] = { 0 };
1281 mutt_get_parent_path(buf_string(&LastDirBackup), buf, sizeof(buf));
1282 buf_strcpy(&LastDir, buf);
1283}
1284
1296void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m,
1297 char ***files, int *numfiles)
1298{
1300 priv->file = file;
1301 priv->mailbox = m;
1302 priv->files = files;
1303 priv->numfiles = numfiles;
1304 struct MuttWindow *dlg = NULL;
1305
1306 priv->multiple = (flags & MUTT_SEL_MULTI);
1307 priv->folder = (flags & MUTT_SEL_FOLDER);
1308 priv->state.is_mailbox_list = (flags & MUTT_SEL_MAILBOX) && priv->folder;
1309 priv->last_selected_mailbox = -1;
1310
1311 init_lastdir();
1312
1313 if (OptNews)
1314 {
1315 if (buf_is_empty(file))
1316 {
1318
1319 /* default state for news reader mode is browse subscribed newsgroups */
1320 priv->state.is_mailbox_list = false;
1321 for (size_t i = 0; i < adata->groups_num; i++)
1322 {
1323 struct NntpMboxData *mdata = adata->groups_list[i];
1324 if (mdata && mdata->subscribed)
1325 {
1326 priv->state.is_mailbox_list = true;
1327 break;
1328 }
1329 }
1330 }
1331 else
1332 {
1333 buf_copy(priv->prefix, file);
1334 }
1335 }
1336 else if (!buf_is_empty(file))
1337 {
1338 buf_expand_path(file);
1339 if (imap_path_probe(buf_string(file), NULL) == MUTT_IMAP)
1340 {
1341 init_state(&priv->state, NULL);
1342 priv->state.imap_browse = true;
1343 if (imap_browse(buf_string(file), &priv->state) == 0)
1344 {
1345 buf_strcpy(&LastDir, priv->state.folder);
1346 browser_sort(&priv->state);
1347 }
1348 }
1349 else
1350 {
1351 int i;
1352 for (i = buf_len(file) - 1; (i > 0) && ((buf_string(file))[i] != '/'); i--)
1353 {
1354 ; // do nothing
1355 }
1356
1357 if (i > 0)
1358 {
1359 if ((buf_string(file))[0] == '/')
1360 {
1361 buf_strcpy_n(&LastDir, buf_string(file), i);
1362 }
1363 else
1364 {
1366 buf_addch(&LastDir, '/');
1367 buf_addstr_n(&LastDir, buf_string(file), i);
1368 }
1369 }
1370 else
1371 {
1372 if ((buf_string(file))[0] == '/')
1373 buf_strcpy(&LastDir, "/");
1374 else
1376 }
1377
1378 if ((i <= 0) && (buf_string(file)[0] != '/'))
1379 buf_copy(priv->prefix, file);
1380 else
1381 buf_strcpy(priv->prefix, buf_string(file) + i + 1);
1382 priv->kill_prefix = true;
1383 }
1384 }
1385 else
1386 {
1387 if (priv->folder)
1388 {
1389 /* Whether we use the tracking feature of the browser depends
1390 * on which sort method we chose to use. This variable is defined
1391 * only to help readability of the code. */
1392 bool browser_track = false;
1393
1394 const enum SortType c_sort_browser = cs_subset_sort(NeoMutt->sub, "sort_browser");
1395 switch (c_sort_browser & SORT_MASK)
1396 {
1397 case SORT_DESC:
1398 case SORT_SUBJECT:
1399 case SORT_ORDER:
1400 browser_track = true;
1401 break;
1402 }
1403
1404 /* We use mutt_browser_select_dir to initialize the two
1405 * variables (LastDir, LastDirBackup) at the appropriate
1406 * values.
1407 *
1408 * We do it only when LastDir is not set (first pass there)
1409 * or when CurrentFolder and LastDirBackup are not the same.
1410 * This code is executed only when we list files, not when
1411 * we press up/down keys to navigate in a displayed list.
1412 *
1413 * We only do this when CurrentFolder has been set (ie, not
1414 * when listing folders on startup with "neomutt -y").
1415 *
1416 * This tracker is only used when browser_track is true,
1417 * meaning only with sort methods SUBJECT/DESC for now. */
1418 if (CurrentFolder)
1419 {
1420 if (buf_is_empty(&LastDir))
1421 {
1422 /* If browsing in "local"-mode, than we chose to define LastDir to
1423 * MailDir */
1425 {
1426 case MUTT_IMAP:
1427 case MUTT_MAILDIR:
1428 case MUTT_MBOX:
1429 case MUTT_MH:
1430 case MUTT_MMDF:
1431 {
1432 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
1433 const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
1434 if (c_folder)
1435 buf_strcpy(&LastDir, c_folder);
1436 else if (c_spool_file)
1437 mutt_browser_select_dir(c_spool_file);
1438 break;
1439 }
1440 default:
1442 break;
1443 }
1444 }
1446 {
1448 }
1449 }
1450
1451 /* When browser tracking feature is disabled, clear LastDirBackup */
1452 if (!browser_track)
1454 }
1455 else
1456 {
1458 }
1459
1460 if (!priv->state.is_mailbox_list &&
1462 {
1463 init_state(&priv->state, NULL);
1464 priv->state.imap_browse = true;
1466 browser_sort(&priv->state);
1467 }
1468 else
1469 {
1470 size_t i = buf_len(&LastDir);
1471 while ((i > 0) && (buf_string(&LastDir)[--i] == '/'))
1472 LastDir.data[i] = '\0';
1474 if (buf_is_empty(&LastDir))
1476 }
1477 }
1478
1479 buf_reset(file);
1480
1481 const struct Mapping *help_data = NULL;
1482
1483 if (OptNews)
1484 help_data = FolderNewsHelp;
1485 else
1486 help_data = FolderHelp;
1487
1488 dlg = simple_dialog_new(MENU_FOLDER, WT_DLG_BROWSER, help_data);
1489
1490 priv->menu = dlg->wdata;
1491 dlg->wdata = priv;
1494 if (priv->multiple)
1495 priv->menu->tag = file_tag;
1496
1497 priv->sbar = window_find_child(dlg, WT_STATUS_BAR);
1499
1500 struct MuttWindow *win_menu = priv->menu->win;
1501
1502 // NT_COLOR is handled by the SimpleDialog
1506
1507 struct MuttWindow *old_focus = window_set_focus(priv->menu->win);
1508
1509 if (priv->state.is_mailbox_list)
1510 {
1511 examine_mailboxes(m, NULL, &priv->state);
1512 }
1513 else if (!priv->state.imap_browse)
1514 {
1515 // examine_directory() calls browser_add_folder() which needs the menu
1516 if (examine_directory(m, priv->menu, &priv->state, buf_string(&LastDir),
1517 buf_string(priv->prefix)) == -1)
1518 {
1519 goto bail;
1520 }
1521 }
1522
1523 init_menu(&priv->state, priv->menu, m, priv->sbar);
1524 // only now do we have a valid priv->state to attach
1525 priv->menu->mdata = &priv->state;
1526
1527 // ---------------------------------------------------------------------------
1528 // Event Loop
1529 int op = OP_NULL;
1530 do
1531 {
1532 menu_tagging_dispatcher(priv->menu->win, op);
1533 window_redraw(NULL);
1534
1536 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
1537 if (op < 0)
1538 continue;
1539 if (op == OP_NULL)
1540 {
1542 continue;
1543 }
1545
1546 int rc = browser_function_dispatcher(priv->win_browser, op);
1547
1548 if (rc == FR_UNKNOWN)
1549 rc = menu_function_dispatcher(priv->menu->win, op);
1550 if (rc == FR_UNKNOWN)
1551 rc = global_function_dispatcher(NULL, op);
1552 } while (!priv->done);
1553 // ---------------------------------------------------------------------------
1554
1555bail:
1556 window_set_focus(old_focus);
1557 simple_dialog_free(&dlg);
1559}
1560
1566const struct ExpandoRenderData FolderRenderData[] = {
1567 // clang-format off
1586 { -1, -1, NULL, NULL },
1587 // clang-format on
1588};
1589
1595const struct ExpandoRenderData GroupIndexRenderData[] = {
1596 // clang-format off
1606 { -1, -1, NULL, NULL },
1607 // clang-format on
1608};
#define ARRAY_RESERVE(head, num)
Reserve memory for the array.
Definition: array.h:189
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition: array.h:135
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition: array.h:156
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:74
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:87
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:65
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:109
int browser_function_dispatcher(struct MuttWindow *win, int op)
Perform a Browser function.
Definition: functions.c:1139
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: lib.h:58
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:186
@ ED_FOL_POLL
FolderFile.poll_new_mail.
Definition: lib.h:134
@ ED_FOL_NOTIFY
FolderFile.notify_user.
Definition: lib.h:132
@ ED_FOL_NEW_COUNT
FolderFile.nd (NntpMboxData)
Definition: lib.h:130
@ ED_FOL_FILE_OWNER
FolderFile.uid.
Definition: lib.h:123
@ ED_FOL_FILE_GROUP
FolderFile.gid.
Definition: lib.h:121
@ ED_FOL_FILENAME
FolderFile.name.
Definition: lib.h:120
@ ED_FOL_DATE_FORMAT
FolderFile.mtime.
Definition: lib.h:118
@ ED_FOL_UNREAD_COUNT
FolderFile.msg_unread.
Definition: lib.h:137
@ ED_FOL_FLAGS2
FolderFile.nd (NntpMboxData)
Definition: lib.h:126
@ ED_FOL_FILE_MODE
FolderFile.move.
Definition: lib.h:122
@ ED_FOL_NEW_MAIL
FolderFile.has_new_mail.
Definition: lib.h:131
@ ED_FOL_FILE_SIZE
FolderFile.size.
Definition: lib.h:124
@ ED_FOL_HARD_LINKS
FolderFile.nlink.
Definition: lib.h:127
@ ED_FOL_DATE
FolderFile.mtime.
Definition: lib.h:117
@ ED_FOL_STRF
FolderFile.mtime.
Definition: lib.h:135
@ ED_FOL_TAGGED
FolderFile.tagged.
Definition: lib.h:136
@ ED_FOL_NUMBER
Folder.num.
Definition: lib.h:133
@ ED_FOL_DESCRIPTION
FolderFile.desc, FolderFile.name.
Definition: lib.h:119
@ ED_FOL_MESSAGE_COUNT
FolderFile.msg_count.
Definition: lib.h:128
@ ED_FOL_NEWSGROUP
FolderFile.name.
Definition: lib.h:129
@ ED_FOL_FLAGS
FolderFile.nd (NntpMboxData)
Definition: lib.h:125
#define MUTT_SEL_FOLDER
Select a local directory.
Definition: lib.h:60
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: lib.h:59
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
Definition: lib.h:56
struct BrowserPrivateData * browser_private_data_new(void)
Create new Browser Data.
Definition: private_data.c:55
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
size_t buf_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
Definition: buffer.c:95
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:490
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:376
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:75
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:290
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition: buffer.c:181
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
Definition: buffer.c:415
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:394
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:600
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
Definition: buffer.c:508
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition: buffer.c:336
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
Definition: helpers.c:218
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:267
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Definition: config_type.c:358
Convenience wrapper for the config headers.
Connection Library.
Convenience wrapper for the core headers.
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:183
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:223
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:51
@ MUTT_MMDF
'mmdf' Mailbox type
Definition: mailbox.h:46
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_MH
'MH' Mailbox type
Definition: mailbox.h:47
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
@ MUTT_MBOX
'mbox' Mailbox type
Definition: mailbox.h:45
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:42
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition: mailbox.h:48
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:443
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
void init_state(struct BrowserState *state, struct Menu *menu)
Initialise a browser state.
Definition: dlg_browser.c:689
int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *dirname, const char *prefix)
Get list of all files/newsgroups with mask.
Definition: dlg_browser.c:712
const struct ExpandoRenderData GroupIndexRenderData[]
Callbacks for Nntp Browser Expandos.
Definition: dlg_browser.c:111
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
Definition: dlg_browser.c:1029
static void init_lastdir(void)
Initialise the browser directories.
Definition: dlg_browser.c:149
const struct ExpandoRenderData FolderRenderData[]
Callbacks for Browser Expandos.
Definition: dlg_browser.c:110
static const struct Mapping FolderNewsHelp[]
Help Bar for the NNTP Mailbox browser dialog.
Definition: dlg_browser.c:126
struct Buffer LastDir
Browser: previous selected directory.
Definition: dlg_browser.c:140
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
Definition: dlg_browser.c:1273
struct Buffer LastDirBackup
Browser: backup copy of the current directory.
Definition: dlg_browser.c:142
static const struct Mapping FolderHelp[]
Help Bar for the File/Dir/Mailbox browser dialog.
Definition: dlg_browser.c:114
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: dlg_browser.c:638
void mutt_browser_cleanup(void)
Clean up working Buffers.
Definition: dlg_browser.c:163
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: dlg_browser.c:1003
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
Definition: dlg_browser.c:839
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: dlg_browser.c:176
@ ED_FOLDER
Folder ED_FOL_ ExpandoDataFolder.
Definition: domain.h:43
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition: domain.h:44
Parse Expando string.
int expando_render(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
Definition: expando.c:109
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
Definition: file.c:640
@ MUTT_OPENDIR_NONE
Plain opendir()
Definition: file.h:74
int km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
Definition: get.c:463
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:293
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:70
char * CurrentFolder
Currently selected mailbox.
Definition: globals.c:43
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:230
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:172
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:318
long group_index_a_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
NNTP: Alert for new mail - Implements ExpandoRenderData::get_number() -.
Definition: browse.c:45
long folder_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Last modified (strftime) - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:195
long folder_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Last modified - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:276
long folder_s_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Size in bytes - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:565
long folder_t_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Is Tagged - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:588
long folder_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Hard links - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:455
long folder_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Last modified ($date_format) - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:310
long folder_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: New mail flag - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:533
long folder_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Number of messages - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:481
long group_index_p_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
NNTP: Poll for new mail - Implements ExpandoRenderData::get_number() -.
Definition: browse.c:166
long group_index_s_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
NNTP: Number of unread articles - Implements ExpandoRenderData::get_number() -.
Definition: browse.c:176
long folder_n_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Number of unread messages - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:507
long folder_p_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Poll for new mail - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:555
long group_index_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
NNTP: Index number - Implements ExpandoRenderData::get_number() -.
Definition: browse.c:55
long group_index_n_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
NNTP: Number of new articles - Implements ExpandoRenderData::get_number() -.
Definition: browse.c:125
long folder_a_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Alert for new mail - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:256
long folder_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Index number - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:266
void folder_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Group name - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:410
void folder_N(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: New mail flag - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:542
void folder_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Last modified ($date_format) - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:322
void folder_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Last modified - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:288
void folder_l(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Hard links - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:468
void folder_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Owner name - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:610
void group_index_M(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
NNTP: Moderated flag - Implements ExpandoRenderData::get_string() -.
Definition: browse.c:103
void group_index_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
NNTP: Description - Implements ExpandoRenderData::get_string() -.
Definition: browse.c:65
void folder_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Is Tagged - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:597
void folder_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Number of unread messages - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:520
void folder_date(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Last modified (strftime) - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:208
void folder_space(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Fixed whitespace - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:247
void folder_m(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Number of messages - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:494
void folder_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: File permissions - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:375
void folder_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Size in bytes - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:574
void folder_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Filename - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:355
void group_index_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
NNTP: Newsgroup name - Implements ExpandoRenderData::get_string() -.
Definition: browse.c:91
void group_index_N(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
NNTP: New flag - Implements ExpandoRenderData::get_string() -.
Definition: browse.c:144
void folder_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Browser: Description - Implements ExpandoRenderData::get_string() -.
Definition: dlg_browser.c:431
void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file -.
Definition: dlg_browser.c:1296
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
#define mutt_perror(...)
Definition: logging2.h:93
static int folder_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Format a Folder for the Menu - Implements Menu::make_entry() -.
Definition: dlg_browser.c:960
static int select_file_search(struct Menu *menu, regex_t *rx, int line)
Menu search callback for matching files - Implements Menu::search() -.
Definition: dlg_browser.c:944
static int file_tag(struct Menu *menu, int sel, int act)
Tag an entry in the menu - Implements Menu::tag() -.
Definition: dlg_browser.c:1134
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
Definition: imap.c:2345
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:1154
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1194
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1239
void browser_private_data_free(struct BrowserPrivateData **ptr)
Free Private Browser Data - Implements MuttWindow::wdata_free() -.
Definition: private_data.c:37
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:168
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:132
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
Definition: browse.c:197
IMAP network mailbox.
void imap_clean_path(char *path, size_t plen)
Cleans an IMAP path using imap_fix_path.
Definition: util.c:189
Manage keymappings.
#define GETCH_NO_FLAGS
No flags are set.
Definition: lib.h:51
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
GUI present the user with a selectable list.
#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:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
struct tm mutt_date_localtime(time_t t)
Converts calendar time to a broken-down time structure expressed in user timezone.
Definition: date.c:905
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:950
size_t mutt_date_localtime_format_locale(char *buf, size_t buflen, const char *format, time_t t, locale_t loc)
Format localtime using a given locale.
Definition: date.c:968
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:455
Convenience wrapper for the library headers.
#define N_(a)
Definition: message.h:32
#define _(a)
Definition: message.h:28
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition: notify.c:230
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:191
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
Definition: path.c:469
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
Definition: regex.c:614
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:654
char * mutt_strn_copy(char *dest, const char *src, size_t len, size_t dsize)
Copy a sub-string into a buffer.
Definition: string.c:354
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:230
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:575
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:274
#define PATH_MAX
Definition: mutt.h:42
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
NeoMutt Logging.
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:168
Mailbox helper functions.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:684
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
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
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
Definition: muttlib.c:971
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:554
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1101
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:328
Some miscellaneous functions.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1319
API for mailboxes.
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
Definition: mxapi.h:53
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:163
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:186
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
Nntp-specific Mailbox data.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:49
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:48
Private state data for the Pager.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define TAILQ_EMPTY(head)
Definition: queue.h:721
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: render.h:37
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: render.h:32
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:227
Sidebar functions.
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:70
SortType
Methods for sorting.
Definition: sort2.h:34
@ SORT_SUBJECT
Sort by the email's subject.
Definition: sort2.h:38
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:40
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:55
Key value store.
#define NONULL(x)
Definition: string2.h:37
void * adata
Private data (for Mailbox backends)
Definition: account.h:42
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 multiple 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
State of the file/mailbox browser.
Definition: lib.h:144
char * folder
Folder name.
Definition: lib.h:147
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:148
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:145
bool imap_browse
IMAP folder.
Definition: lib.h:146
String manipulation buffer.
Definition: buffer.h:36
char * data
Pointer to data.
Definition: buffer.h:37
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
char host[128]
Server to login to.
Definition: connaccount.h:54
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:49
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
An Event that happened to a Mailbox.
Definition: mailbox.h:199
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:200
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:241
Basic Expando Node.
Definition: node.h:67
const char * end
End of string data.
Definition: node.h:78
const char * start
Start of string data.
Definition: node.h:77
Parsed Expando trees.
Definition: expando.h:41
Browser entry representing a folder/dir.
Definition: lib.h:78
bool selectable
Folder can be selected.
Definition: lib.h:96
bool imap
This is an IMAP folder.
Definition: lib.h:95
bool has_mailbox
This is a mailbox.
Definition: lib.h:98
char * name
Name of file/dir/mailbox.
Definition: lib.h:86
uid_t uid
File's User ID.
Definition: lib.h:82
bool tagged
Folder is tagged.
Definition: lib.h:102
gid_t gid
File's Group ID.
Definition: lib.h:83
bool has_new_mail
true if mailbox has "new mail"
Definition: lib.h:89
bool poll_new_mail
Check mailbox for new mail.
Definition: lib.h:101
bool notify_user
User will be notified of new mail.
Definition: lib.h:100
nlink_t nlink
Number of hard links.
Definition: lib.h:84
char * desc
Description of mailbox.
Definition: lib.h:87
struct NntpMboxData * nd
Extra NNTP data.
Definition: lib.h:103
off_t size
File size.
Definition: lib.h:80
int gen
Unique id, used for (un)sorting.
Definition: lib.h:105
time_t mtime
Modification time.
Definition: lib.h:81
int msg_count
total number of messages
Definition: lib.h:90
mode_t mode
File permissions.
Definition: lib.h:79
bool inferiors
Folder has children.
Definition: lib.h:97
int msg_unread
number of unread messages
Definition: lib.h:91
A folder/dir in the browser.
Definition: lib.h:69
int num
Number in the index.
Definition: lib.h:71
struct FolderFile * ff
File / Dir / Mailbox.
Definition: lib.h:70
List of Mailboxes.
Definition: mailbox.h:166
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:167
A mailbox.
Definition: mailbox.h:79
bool has_new
Mailbox has new mail.
Definition: mailbox.h:85
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
int msg_count
Total number of messages.
Definition: mailbox.h:88
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
bool poll_new_mail
Check for new mail.
Definition: mailbox.h:115
void * mdata
Driver specific data.
Definition: mailbox.h:132
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
bool notify_user
Notify the user of new mail.
Definition: mailbox.h:113
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:147
Mapping between user-readable string and a constant.
Definition: mapping.h:33
Definition: lib.h:79
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
int num_tagged
Number of tagged entries.
Definition: lib.h:93
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:161
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition: lib.h:119
int top
Entry that is the top of the current page.
Definition: lib.h:90
int(* tag)(struct Menu *menu, int sel, int act)
Definition: lib.h:131
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition: lib.h:106
struct ConfigSubset * sub
Inherited config items.
Definition: lib.h:87
void * mdata
Private data.
Definition: lib.h:147
int max
Number of entries in the menu.
Definition: lib.h:81
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:41
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:46
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
locale_t time_c_locale
Current locale but LC_TIME=C.
Definition: neomutt.h:47
NNTP-specific Account data -.
Definition: adata.h:36
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:62
unsigned int groups_num
Definition: adata.h:58
void ** groups_list
Definition: adata.h:60
NNTP-specific Mailbox data -.
Definition: mdata.h:34
struct NntpAccountData * adata
Definition: mdata.h:48
Data passed to a notification function.
Definition: observer.h:34
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:37
void * global_data
Data from notify_observer_add()
Definition: observer.h:39
Cached regular expression.
Definition: regex3.h:85
char * pattern
printable version
Definition: regex3.h:86
@ MENU_FOLDER
General file/mailbox browser.
Definition: type.h:45
@ ED_GLO_PADDING_SPACE
Space Padding.
Definition: uid.h:39