NeoMutt  2024-04-25-89-g194907
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 <dirent.h>
78#include <errno.h>
79#include <grp.h>
80#include <limits.h>
81#include <locale.h>
82#include <pwd.h>
83#include <stdbool.h>
84#include <stdio.h>
85#include <string.h>
86#include <sys/stat.h>
87#include <time.h>
88#include "mutt/lib.h"
89#include "config/lib.h"
90#include "core/lib.h"
91#include "conn/lib.h"
92#include "gui/lib.h"
93#include "lib.h"
94#include "expando/lib.h"
95#include "imap/lib.h"
96#include "key/lib.h"
97#include "menu/lib.h"
98#include "nntp/lib.h"
99#include "functions.h"
100#include "globals.h"
101#include "mutt_logging.h"
102#include "mutt_mailbox.h"
103#include "muttlib.h"
104#include "mx.h"
105#include "nntp/adata.h"
106#include "nntp/mdata.h"
107#include "private_data.h"
108
111
113static const struct Mapping FolderHelp[] = {
114 // clang-format off
115 { N_("Exit"), OP_EXIT },
116 { N_("Chdir"), OP_CHANGE_DIRECTORY },
117 { N_("Goto"), OP_BROWSER_GOTO_FOLDER },
118 { N_("Mask"), OP_ENTER_MASK },
119 { N_("Help"), OP_HELP },
120 { NULL, 0 },
121 // clang-format on
122};
123
125static const struct Mapping FolderNewsHelp[] = {
126 // clang-format off
127 { N_("Exit"), OP_EXIT },
128 { N_("List"), OP_TOGGLE_MAILBOXES },
129 { N_("Subscribe"), OP_BROWSER_SUBSCRIBE },
130 { N_("Unsubscribe"), OP_BROWSER_UNSUBSCRIBE },
131 { N_("Catchup"), OP_CATCHUP },
132 { N_("Mask"), OP_ENTER_MASK },
133 { N_("Help"), OP_HELP },
134 { NULL, 0 },
135 // clang-format on
136};
137
139struct Buffer LastDir = { 0 };
141struct Buffer LastDirBackup = { 0 };
142
148static void init_lastdir(void)
149{
150 static bool done = false;
151 if (!done)
152 {
155 done = true;
156 }
157}
158
163{
166}
167
175bool link_is_dir(const char *folder, const char *path)
176{
177 struct stat st = { 0 };
178 bool rc = false;
179
180 struct Buffer *fullpath = buf_pool_get();
181 buf_concat_path(fullpath, folder, path);
182
183 if (stat(buf_string(fullpath), &st) == 0)
184 rc = S_ISDIR(st.st_mode);
185
186 buf_pool_release(&fullpath);
187
188 return rc;
189}
190
194long folder_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
195{
196 const struct Folder *folder = data;
197
198 if (!folder->ff->local)
199 return 0;
200
201 return folder->ff->mtime;
202}
203
207void folder_date(const struct ExpandoNode *node, void *data,
208 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
209{
210 const struct Folder *folder = data;
211
212 if (!folder->ff->local)
213 return;
214
215 char tmp[128] = { 0 };
216 char tmp2[128] = { 0 };
217 int len = node->end - node->start;
218 const char *start = node->start;
219
220 struct tm tm = mutt_date_localtime(folder->ff->mtime);
221 bool use_c_locale = false;
222 if (*start == '!')
223 {
224 use_c_locale = true;
225 start++;
226 len--;
227 }
228 ASSERT(len < sizeof(tmp2));
229 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
230
231 if (use_c_locale)
232 {
233 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
234 }
235 else
236 {
237 strftime(tmp, sizeof(tmp), tmp2, &tm);
238 }
239
240 buf_strcpy(buf, tmp);
241}
242
246void folder_space(const struct ExpandoNode *node, void *data,
247 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
248{
249 buf_addstr(buf, " ");
250}
251
255long folder_a_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
256{
257 const struct Folder *folder = data;
258
259 return folder->ff->notify_user;
260}
261
265long folder_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
266{
267 const struct Folder *folder = data;
268
269 return folder->num + 1;
270}
271
275long folder_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
276{
277 const struct Folder *folder = data;
278 if (!folder->ff->local)
279 return 0;
280
281 return folder->ff->mtime;
282}
283
287void folder_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
288 int max_cols, struct Buffer *buf)
289{
290 const struct Folder *folder = data;
291 if (!folder->ff->local)
292 return;
293
294 static const time_t one_year = 31536000;
295 const char *t_fmt = ((mutt_date_now() - folder->ff->mtime) < one_year) ?
296 "%b %d %H:%M" :
297 "%b %d %Y";
298
299 char tmp[128] = { 0 };
300
301 mutt_date_localtime_format(tmp, sizeof(tmp), t_fmt, folder->ff->mtime);
302
303 buf_strcpy(buf, tmp);
304}
305
309long folder_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
310{
311 const struct Folder *folder = data;
312 if (!folder->ff->local)
313 return 0;
314
315 return folder->ff->mtime;
316}
317
321void folder_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
322 int max_cols, struct Buffer *buf)
323{
324 const struct Folder *folder = data;
325 if (!folder->ff->local)
326 return;
327
328 char tmp[128] = { 0 };
329 bool use_c_locale = false;
330 const char *const c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
331 const char *t_fmt = NONULL(c_date_format);
332 if (*t_fmt == '!')
333 {
334 t_fmt++;
335 use_c_locale = true;
336 }
337
338 if (use_c_locale)
339 {
340 mutt_date_localtime_format_locale(tmp, sizeof(tmp), t_fmt,
341 folder->ff->mtime, NeoMutt->time_c_locale);
342 }
343 else
344 {
345 mutt_date_localtime_format(tmp, sizeof(tmp), t_fmt, folder->ff->mtime);
346 }
347
348 buf_strcpy(buf, tmp);
349}
350
354void folder_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
355 int max_cols, struct Buffer *buf)
356{
357 const struct Folder *folder = data;
358
359 const char *s = NONULL(folder->ff->name);
360
361 buf_printf(buf, "%s%s", s,
362 folder->ff->local ?
363 (S_ISLNK(folder->ff->mode) ?
364 "@" :
365 (S_ISDIR(folder->ff->mode) ?
366 "/" :
367 (((folder->ff->mode & S_IXUSR) != 0) ? "*" : ""))) :
368 "");
369}
370
374void folder_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
375 int max_cols, struct Buffer *buf)
376{
377 const struct Folder *folder = data;
378
379 if (folder->ff->local)
380 {
381 buf_printf(buf, "%c%c%c%c%c%c%c%c%c%c",
382 S_ISDIR(folder->ff->mode) ? 'd' : (S_ISLNK(folder->ff->mode) ? 'l' : '-'),
383 ((folder->ff->mode & S_IRUSR) != 0) ? 'r' : '-',
384 ((folder->ff->mode & S_IWUSR) != 0) ? 'w' : '-',
385 ((folder->ff->mode & S_ISUID) != 0) ? 's' :
386 ((folder->ff->mode & S_IXUSR) != 0) ? 'x' :
387 '-',
388 ((folder->ff->mode & S_IRGRP) != 0) ? 'r' : '-',
389 ((folder->ff->mode & S_IWGRP) != 0) ? 'w' : '-',
390 ((folder->ff->mode & S_ISGID) != 0) ? 's' :
391 ((folder->ff->mode & S_IXGRP) != 0) ? 'x' :
392 '-',
393 ((folder->ff->mode & S_IROTH) != 0) ? 'r' : '-',
394 ((folder->ff->mode & S_IWOTH) != 0) ? 'w' : '-',
395 ((folder->ff->mode & S_ISVTX) != 0) ? 't' :
396 ((folder->ff->mode & S_IXOTH) != 0) ? 'x' :
397 '-');
398 }
399 else if (folder->ff->imap)
400 {
401 /* mark folders with subfolders AND mail */
402 buf_printf(buf, "IMAP %c", (folder->ff->inferiors && folder->ff->selectable) ? '+' : ' ');
403 }
404}
405
409void folder_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
410 int max_cols, struct Buffer *buf)
411{
412 const struct Folder *folder = data;
413 if (!folder->ff->local)
414 return;
415
416 struct group *gr = getgrgid(folder->ff->gid);
417 if (gr)
418 {
419 buf_addstr(buf, gr->gr_name);
420 }
421 else
422 {
423 buf_printf(buf, "%u", folder->ff->gid);
424 }
425}
426
430void folder_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
431 int max_cols, struct Buffer *buf)
432{
433 const struct Folder *folder = data;
434
435 const char *s = NULL;
436 if (folder->ff->desc)
437 s = folder->ff->desc;
438 else
439 s = folder->ff->name;
440
441 buf_printf(buf, "%s%s", s,
442 folder->ff->local ?
443 (S_ISLNK(folder->ff->mode) ?
444 "@" :
445 (S_ISDIR(folder->ff->mode) ?
446 "/" :
447 (((folder->ff->mode & S_IXUSR) != 0) ? "*" : ""))) :
448 "");
449}
450
454long folder_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
455{
456 const struct Folder *folder = data;
457
458 if (folder->ff->local)
459 return folder->ff->nlink;
460
461 return 0;
462}
463
467void folder_l(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
468 int max_cols, struct Buffer *buf)
469{
470 const struct Folder *folder = data;
471 if (!folder->ff->local)
472 return;
473
474 buf_add_printf(buf, "%d", (int) folder->ff->nlink);
475}
476
480long folder_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
481{
482 const struct Folder *folder = data;
483
484 if (folder->ff->has_mailbox)
485 return folder->ff->msg_count;
486
487 return 0;
488}
489
493void folder_m(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
494 int max_cols, struct Buffer *buf)
495{
496 const struct Folder *folder = data;
497 if (!folder->ff->has_mailbox)
498 return;
499
500 buf_add_printf(buf, "%d", folder->ff->msg_count);
501}
502
506long folder_n_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
507{
508 const struct Folder *folder = data;
509
510 if (folder->ff->has_mailbox)
511 return folder->ff->msg_unread;
512
513 return 0;
514}
515
519void folder_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
520 int max_cols, struct Buffer *buf)
521{
522 const struct Folder *folder = data;
523 if (!folder->ff->has_mailbox)
524 return;
525
526 buf_add_printf(buf, "%d", folder->ff->msg_unread);
527}
528
532long folder_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
533{
534 const struct Folder *folder = data;
535 return folder->ff->has_new_mail;
536}
537
541void folder_N(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
542 int max_cols, struct Buffer *buf)
543{
544 const struct Folder *folder = data;
545
546 // NOTE(g0mb4): use $to_chars?
547 const char *s = folder->ff->has_new_mail ? "N" : " ";
548 buf_strcpy(buf, s);
549}
550
554long folder_p_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
555{
556 const struct Folder *folder = data;
557
558 return folder->ff->poll_new_mail;
559}
560
564long folder_s_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
565{
566 const struct Folder *folder = data;
567 return folder->ff->size;
568}
569
573void folder_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
574 int max_cols, struct Buffer *buf)
575{
576 const struct Folder *folder = data;
577
578 char tmp[128] = { 0 };
579
580 mutt_str_pretty_size(tmp, sizeof(tmp), folder->ff->size);
581 buf_strcpy(buf, tmp);
582}
583
587long folder_t_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
588{
589 const struct Folder *folder = data;
590 return folder->ff->tagged;
591}
592
596void folder_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
597 int max_cols, struct Buffer *buf)
598{
599 const struct Folder *folder = data;
600
601 // NOTE(g0mb4): use $to_chars?
602 const char *s = folder->ff->tagged ? "*" : " ";
603 buf_strcpy(buf, s);
604}
605
609void folder_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
610 int max_cols, struct Buffer *buf)
611{
612 const struct Folder *folder = data;
613 if (!folder->ff->local)
614 return;
615
616 struct passwd *pw = getpwuid(folder->ff->uid);
617 if (pw)
618 {
619 buf_addstr(buf, pw->pw_name);
620 }
621 else
622 {
623 buf_printf(buf, "%u", folder->ff->uid);
624 }
625}
626
637void browser_add_folder(const struct Menu *menu, struct BrowserState *state,
638 const char *name, const char *desc,
639 const struct stat *st, struct Mailbox *m, void *data)
640{
641 if ((!menu || state->is_mailbox_list) && m && !m->visible)
642 {
643 return;
644 }
645
646 struct FolderFile ff = { 0 };
647
648 if (st)
649 {
650 ff.mode = st->st_mode;
651 ff.mtime = st->st_mtime;
652 ff.size = st->st_size;
653 ff.gid = st->st_gid;
654 ff.uid = st->st_uid;
655 ff.nlink = st->st_nlink;
656 ff.local = true;
657 }
658 else
659 {
660 ff.local = false;
661 }
662
663 if (m)
664 {
665 ff.has_mailbox = true;
666 ff.gen = m->gen;
667 ff.has_new_mail = m->has_new;
668 ff.msg_count = m->msg_count;
669 ff.msg_unread = m->msg_unread;
670 ff.notify_user = m->notify_user;
672 }
673
674 ff.name = mutt_str_dup(name);
675 ff.desc = mutt_str_dup(desc ? desc : name);
676 ff.imap = false;
677 if (OptNews)
678 ff.nd = data;
679
680 ARRAY_ADD(&state->entry, ff);
681}
682
688void init_state(struct BrowserState *state, struct Menu *menu)
689{
690 ARRAY_INIT(&state->entry);
691 ARRAY_RESERVE(&state->entry, 256);
692 state->imap_browse = false;
693
694 if (menu)
695 {
696 menu->mdata = &state->entry;
697 menu->mdata_free = NULL; // Menu doesn't own the data
698 }
699}
700
711int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state,
712 const char *dirname, const char *prefix)
713{
714 int rc = -1;
715 struct Buffer *buf = buf_pool_get();
716 if (OptNews)
717 {
719
720 init_state(state, menu);
721
722 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
723 for (unsigned int i = 0; i < adata->groups_num; i++)
724 {
725 struct NntpMboxData *mdata = adata->groups_list[i];
726 if (!mdata)
727 continue;
728 if (prefix && *prefix && !mutt_str_startswith(mdata->group, prefix))
729 continue;
730 if (!mutt_regex_match(c_mask, mdata->group))
731 {
732 continue;
733 }
734 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
735 }
736 }
737 else
738 {
739 struct stat st = { 0 };
740 DIR *dir = NULL;
741 struct dirent *de = NULL;
742
743 while (stat(dirname, &st) == -1)
744 {
745 if (errno == ENOENT)
746 {
747 /* The last used directory is deleted, try to use the parent dir. */
748 char *c = strrchr(dirname, '/');
749
750 if (c && (c > dirname))
751 {
752 *c = '\0';
753 continue;
754 }
755 }
756 mutt_perror("%s", dirname);
757 goto ed_out;
758 }
759
760 if (!S_ISDIR(st.st_mode))
761 {
762 mutt_error(_("%s is not a directory"), dirname);
763 goto ed_out;
764 }
765
766 if (m)
768
769 dir = mutt_file_opendir(dirname, MUTT_OPENDIR_NONE);
770 if (!dir)
771 {
772 mutt_perror("%s", dirname);
773 goto ed_out;
774 }
775
776 init_state(state, menu);
777
778 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
780
781 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
782 while ((de = readdir(dir)))
783 {
784 if (mutt_str_equal(de->d_name, "."))
785 continue; /* we don't need . */
786
787 if (prefix && *prefix && !mutt_str_startswith(de->d_name, prefix))
788 {
789 continue;
790 }
791 if (!mutt_regex_match(c_mask, de->d_name))
792 {
793 continue;
794 }
795
796 buf_concat_path(buf, dirname, de->d_name);
797 if (lstat(buf_string(buf), &st) == -1)
798 continue;
799
800 /* No size for directories or symlinks */
801 if (S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
802 st.st_size = 0;
803 else if (!S_ISREG(st.st_mode))
804 continue;
805
806 struct MailboxNode *np = NULL;
807 STAILQ_FOREACH(np, &ml, entries)
808 {
810 break;
811 }
812
813 if (np && m && m->poll_new_mail && mutt_str_equal(np->mailbox->realpath, m->realpath))
814 {
815 np->mailbox->msg_count = m->msg_count;
816 np->mailbox->msg_unread = m->msg_unread;
817 }
818 browser_add_folder(menu, state, de->d_name, NULL, &st, np ? np->mailbox : NULL, NULL);
819 }
821 closedir(dir);
822 }
823 browser_sort(state);
824 rc = 0;
825ed_out:
826 buf_pool_release(&buf);
827 return rc;
828}
829
838int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
839{
840 struct stat st = { 0 };
841 struct Buffer *md = NULL;
842 struct Buffer *mailbox = NULL;
843
844 if (OptNews)
845 {
847
848 init_state(state, menu);
849
850 const bool c_show_only_unread = cs_subset_bool(NeoMutt->sub, "show_only_unread");
851 for (unsigned int i = 0; i < adata->groups_num; i++)
852 {
853 struct NntpMboxData *mdata = adata->groups_list[i];
854 if (mdata && (mdata->has_new_mail ||
855 (mdata->subscribed && (mdata->unread || !c_show_only_unread))))
856 {
857 browser_add_folder(menu, state, mdata->group, NULL, NULL, NULL, mdata);
858 }
859 }
860 }
861 else
862 {
863 init_state(state, menu);
864
866 return -1;
867 mailbox = buf_pool_get();
868 md = buf_pool_get();
869
871
872 struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
874 struct MailboxNode *np = NULL;
875 const bool c_browser_abbreviate_mailboxes = cs_subset_bool(NeoMutt->sub, "browser_abbreviate_mailboxes");
876
877 STAILQ_FOREACH(np, &ml, entries)
878 {
879 if (!np->mailbox)
880 continue;
881
882 if (m && m->poll_new_mail && mutt_str_equal(np->mailbox->realpath, m->realpath))
883 {
884 np->mailbox->msg_count = m->msg_count;
885 np->mailbox->msg_unread = m->msg_unread;
886 }
887
889 if (c_browser_abbreviate_mailboxes)
891
892 switch (np->mailbox->type)
893 {
894 case MUTT_IMAP:
895 case MUTT_POP:
897 np->mailbox->name, NULL, np->mailbox, NULL);
898 continue;
899 case MUTT_NOTMUCH:
900 case MUTT_NNTP:
901 browser_add_folder(menu, state, mailbox_path(np->mailbox),
902 np->mailbox->name, NULL, np->mailbox, NULL);
903 continue;
904 default: /* Continue */
905 break;
906 }
907
908 if (lstat(mailbox_path(np->mailbox), &st) == -1)
909 continue;
910
911 if ((!S_ISREG(st.st_mode)) && (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)))
912 continue;
913
914 if (np->mailbox->type == MUTT_MAILDIR)
915 {
916 struct stat st2 = { 0 };
917
918 buf_printf(md, "%s/new", mailbox_path(np->mailbox));
919 if (stat(buf_string(md), &st) < 0)
920 st.st_mtime = 0;
921 buf_printf(md, "%s/cur", mailbox_path(np->mailbox));
922 if (stat(buf_string(md), &st2) < 0)
923 st2.st_mtime = 0;
924 if (st2.st_mtime > st.st_mtime)
925 st.st_mtime = st2.st_mtime;
926 }
927
928 browser_add_folder(menu, state, buf_string(mailbox), np->mailbox->name,
929 &st, np->mailbox, NULL);
930 }
932 }
933 browser_sort(state);
934
935 buf_pool_release(&mailbox);
936 buf_pool_release(&md);
937 return 0;
938}
939
943static int select_file_search(struct Menu *menu, regex_t *rx, int line)
944{
945 struct BrowserEntryArray *entry = menu->mdata;
946 if (OptNews)
947 return regexec(rx, ARRAY_GET(entry, line)->desc, 0, NULL, 0);
948 struct FolderFile *ff = ARRAY_GET(entry, line);
949 char *search_on = ff->desc ? ff->desc : ff->name;
950
951 return regexec(rx, search_on, 0, NULL, 0);
952}
953
959static int folder_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
960{
961 struct BrowserState *bstate = menu->mdata;
962 struct BrowserEntryArray *entry = &bstate->entry;
963 struct Folder folder = {
964 .ff = ARRAY_GET(entry, line),
965 .num = line,
966 };
967
968 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
969 if (c_arrow_cursor)
970 {
971 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
972 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
973 }
974
975 if (OptNews)
976 {
977 const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
978 return expando_filter(c_group_index_format, GroupIndexRenderData, &folder,
979 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
980 }
981
982 if (bstate->is_mailbox_list)
983 {
984 const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
985 return expando_filter(c_mailbox_folder_format, FolderRenderData, &folder,
986 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
987 }
988
989 const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
990 return expando_filter(c_folder_format, FolderRenderData, &folder,
991 MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
992}
993
1002void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
1003{
1004 menu->top = 0;
1005 /* Reset menu position to 1.
1006 * We do not risk overflow as the init_menu function changes
1007 * current if it is bigger than state->entrylen. */
1008 if (!ARRAY_EMPTY(&state->entry) &&
1009 (mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "..") ||
1010 mutt_str_equal(ARRAY_FIRST(&state->entry)->desc, "../")))
1011 {
1012 /* Skip the first entry, unless there's only one entry. */
1013 menu_set_index(menu, (menu->max > 1));
1014 }
1015 else
1016 {
1017 menu_set_index(menu, 0);
1018 }
1019}
1020
1028void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m,
1029 struct MuttWindow *sbar)
1030{
1031 char title[256] = { 0 };
1032 menu->max = ARRAY_SIZE(&state->entry);
1033
1034 int index = menu_get_index(menu);
1035 if (index >= menu->max)
1036 menu_set_index(menu, menu->max - 1);
1037 if (index < 0)
1038 menu_set_index(menu, 0);
1039 if (menu->top > index)
1040 menu->top = 0;
1041
1042 menu->num_tagged = 0;
1043
1044 if (OptNews)
1045 {
1046 if (state->is_mailbox_list)
1047 {
1048 snprintf(title, sizeof(title), _("Subscribed newsgroups"));
1049 }
1050 else
1051 {
1052 snprintf(title, sizeof(title), _("Newsgroups on server [%s]"),
1054 }
1055 }
1056 else
1057 {
1058 if (state->is_mailbox_list)
1059 {
1060 snprintf(title, sizeof(title), _("Mailboxes [%d]"),
1062 }
1063 else
1064 {
1065 struct Buffer *path = buf_pool_get();
1066 buf_copy(path, &LastDir);
1067 buf_pretty_mailbox(path);
1068 const struct Regex *c_mask = cs_subset_regex(NeoMutt->sub, "mask");
1069 const bool c_imap_list_subscribed = cs_subset_bool(NeoMutt->sub, "imap_list_subscribed");
1070 if (state->imap_browse && c_imap_list_subscribed)
1071 {
1072 snprintf(title, sizeof(title), _("Subscribed [%s], File mask: %s"),
1073 buf_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
1074 }
1075 else
1076 {
1077 snprintf(title, sizeof(title), _("Directory [%s], File mask: %s"),
1078 buf_string(path), NONULL(c_mask ? c_mask->pattern : NULL));
1079 }
1080 buf_pool_release(&path);
1081 }
1082 }
1083 sbar_set_title(sbar, title);
1084
1085 /* Browser tracking feature.
1086 * The goal is to highlight the good directory if LastDir is the parent dir
1087 * of LastDirBackup (this occurs mostly when one hit "../"). It should also work
1088 * properly when the user is in examine_mailboxes-mode. */
1090 {
1091 char target_dir[PATH_MAX] = { 0 };
1092
1093 /* Check what kind of dir LastDirBackup is. */
1095 {
1096 mutt_str_copy(target_dir, buf_string(&LastDirBackup), sizeof(target_dir));
1097 imap_clean_path(target_dir, sizeof(target_dir));
1098 }
1099 else
1100 {
1101 mutt_str_copy(target_dir, strrchr(buf_string(&LastDirBackup), '/') + 1,
1102 sizeof(target_dir));
1103 }
1104
1105 /* If we get here, it means that LastDir is the parent directory of
1106 * LastDirBackup. I.e., we're returning from a subdirectory, and we want
1107 * to position the cursor on the directory we're returning from. */
1108 bool matched = false;
1109 struct FolderFile *ff = NULL;
1110 ARRAY_FOREACH(ff, &state->entry)
1111 {
1112 if (mutt_str_equal(ff->name, target_dir))
1113 {
1114 menu_set_index(menu, ARRAY_FOREACH_IDX);
1115 matched = true;
1116 break;
1117 }
1118 }
1119 if (!matched)
1120 browser_highlight_default(state, menu);
1121 }
1122 else
1123 {
1124 browser_highlight_default(state, menu);
1125 }
1126
1128}
1129
1133static int file_tag(struct Menu *menu, int sel, int act)
1134{
1135 struct BrowserEntryArray *entry = menu->mdata;
1136 struct FolderFile *ff = ARRAY_GET(entry, sel);
1137 if (S_ISDIR(ff->mode) ||
1138 (S_ISLNK(ff->mode) && link_is_dir(buf_string(&LastDir), ff->name)))
1139 {
1140 mutt_error(_("Can't attach a directory"));
1141 return 0;
1142 }
1143
1144 bool ot = ff->tagged;
1145 ff->tagged = ((act >= 0) ? act : !ff->tagged);
1146
1147 return ff->tagged - ot;
1148}
1149
1154{
1155 if (nc->event_type != NT_CONFIG)
1156 return 0;
1157 if (!nc->global_data || !nc->event_data)
1158 return -1;
1159
1160 struct EventConfig *ev_c = nc->event_data;
1161
1162 struct BrowserPrivateData *priv = nc->global_data;
1163 struct Menu *menu = priv->menu;
1164
1165 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
1166 {
1167 struct BrowserState *state = menu->mdata;
1168 browser_sort(state);
1169 browser_highlight_default(state, menu);
1170 }
1171 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1172 !mutt_str_equal(ev_c->name, "date_format") &&
1173 !mutt_str_equal(ev_c->name, "folder") &&
1174 !mutt_str_equal(ev_c->name, "folder_format") &&
1175 !mutt_str_equal(ev_c->name, "group_index_format") &&
1176 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1177 !mutt_str_equal(ev_c->name, "sort_browser"))
1178 {
1179 return 0;
1180 }
1181
1183 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1184
1185 return 0;
1186}
1187
1194{
1195 if (nc->event_type != NT_MAILBOX)
1196 return 0;
1198 return 0;
1199 if (!nc->global_data || !nc->event_data)
1200 return -1;
1201
1202 struct BrowserPrivateData *priv = nc->global_data;
1203
1204 struct BrowserState *state = &priv->state;
1205 if (state->is_mailbox_list)
1206 {
1207 struct EventMailbox *ev_m = nc->event_data;
1208 struct Mailbox *m = ev_m->mailbox;
1209 struct FolderFile *ff = NULL;
1210 ARRAY_FOREACH(ff, &state->entry)
1211 {
1212 if (ff->gen != m->gen)
1213 continue;
1214
1215 ff->has_new_mail = m->has_new;
1216 ff->msg_count = m->msg_count;
1217 ff->msg_unread = m->msg_unread;
1218 ff->notify_user = m->notify_user;
1220 mutt_str_replace(&ff->desc, m->name);
1221 break;
1222 }
1223 }
1224
1226 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
1227
1228 return 0;
1229}
1230
1239{
1240 if (nc->event_type != NT_WINDOW)
1241 return 0;
1242 if (!nc->global_data || !nc->event_data)
1243 return -1;
1245 return 0;
1246
1247 struct BrowserPrivateData *priv = nc->global_data;
1248 struct MuttWindow *win_menu = priv->menu->win;
1249
1250 struct EventWindow *ev_w = nc->event_data;
1251 if (ev_w->win != win_menu)
1252 return 0;
1253
1257
1258 mutt_debug(LL_DEBUG5, "window delete done\n");
1259 return 0;
1260}
1261
1272void mutt_browser_select_dir(const char *f)
1273{
1274 init_lastdir();
1275
1277
1278 /* Method that will fetch the parent path depending on the type of the path. */
1279 char buf[PATH_MAX] = { 0 };
1280 mutt_get_parent_path(buf_string(&LastDirBackup), buf, sizeof(buf));
1281 buf_strcpy(&LastDir, buf);
1282}
1283
1295void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m,
1296 char ***files, int *numfiles)
1297{
1299 priv->file = file;
1300 priv->mailbox = m;
1301 priv->files = files;
1302 priv->numfiles = numfiles;
1303 struct MuttWindow *dlg = NULL;
1304
1305 priv->multiple = (flags & MUTT_SEL_MULTI);
1306 priv->folder = (flags & MUTT_SEL_FOLDER);
1307 priv->state.is_mailbox_list = (flags & MUTT_SEL_MAILBOX) && priv->folder;
1308 priv->last_selected_mailbox = -1;
1309
1310 init_lastdir();
1311
1312 if (OptNews)
1313 {
1314 if (buf_is_empty(file))
1315 {
1317
1318 /* default state for news reader mode is browse subscribed newsgroups */
1319 priv->state.is_mailbox_list = false;
1320 for (size_t i = 0; i < adata->groups_num; i++)
1321 {
1322 struct NntpMboxData *mdata = adata->groups_list[i];
1323 if (mdata && mdata->subscribed)
1324 {
1325 priv->state.is_mailbox_list = true;
1326 break;
1327 }
1328 }
1329 }
1330 else
1331 {
1332 buf_copy(priv->prefix, file);
1333 }
1334 }
1335 else if (!buf_is_empty(file))
1336 {
1337 buf_expand_path(file);
1338 if (imap_path_probe(buf_string(file), NULL) == MUTT_IMAP)
1339 {
1340 init_state(&priv->state, NULL);
1341 priv->state.imap_browse = true;
1342 if (imap_browse(buf_string(file), &priv->state) == 0)
1343 {
1344 buf_strcpy(&LastDir, priv->state.folder);
1345 browser_sort(&priv->state);
1346 }
1347 }
1348 else
1349 {
1350 int i;
1351 for (i = buf_len(file) - 1; (i > 0) && ((buf_string(file))[i] != '/'); i--)
1352 {
1353 ; // do nothing
1354 }
1355
1356 if (i > 0)
1357 {
1358 if ((buf_string(file))[0] == '/')
1359 {
1360 buf_strcpy_n(&LastDir, buf_string(file), i);
1361 }
1362 else
1363 {
1365 buf_addch(&LastDir, '/');
1366 buf_addstr_n(&LastDir, buf_string(file), i);
1367 }
1368 }
1369 else
1370 {
1371 if ((buf_string(file))[0] == '/')
1372 buf_strcpy(&LastDir, "/");
1373 else
1375 }
1376
1377 if ((i <= 0) && (buf_string(file)[0] != '/'))
1378 buf_copy(priv->prefix, file);
1379 else
1380 buf_strcpy(priv->prefix, buf_string(file) + i + 1);
1381 priv->kill_prefix = true;
1382 }
1383 }
1384 else
1385 {
1386 if (priv->folder)
1387 {
1388 /* Whether we use the tracking feature of the browser depends
1389 * on which sort method we chose to use. This variable is defined
1390 * only to help readability of the code. */
1391 bool browser_track = false;
1392
1393 const enum SortType c_sort_browser = cs_subset_sort(NeoMutt->sub, "sort_browser");
1394 switch (c_sort_browser & SORT_MASK)
1395 {
1396 case SORT_DESC:
1397 case SORT_SUBJECT:
1398 case SORT_ORDER:
1399 browser_track = true;
1400 break;
1401 }
1402
1403 /* We use mutt_browser_select_dir to initialize the two
1404 * variables (LastDir, LastDirBackup) at the appropriate
1405 * values.
1406 *
1407 * We do it only when LastDir is not set (first pass there)
1408 * or when CurrentFolder and LastDirBackup are not the same.
1409 * This code is executed only when we list files, not when
1410 * we press up/down keys to navigate in a displayed list.
1411 *
1412 * We only do this when CurrentFolder has been set (ie, not
1413 * when listing folders on startup with "neomutt -y").
1414 *
1415 * This tracker is only used when browser_track is true,
1416 * meaning only with sort methods SUBJECT/DESC for now. */
1417 if (CurrentFolder)
1418 {
1419 if (buf_is_empty(&LastDir))
1420 {
1421 /* If browsing in "local"-mode, than we chose to define LastDir to
1422 * MailDir */
1424 {
1425 case MUTT_IMAP:
1426 case MUTT_MAILDIR:
1427 case MUTT_MBOX:
1428 case MUTT_MH:
1429 case MUTT_MMDF:
1430 {
1431 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
1432 const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
1433 if (c_folder)
1434 buf_strcpy(&LastDir, c_folder);
1435 else if (c_spool_file)
1436 mutt_browser_select_dir(c_spool_file);
1437 break;
1438 }
1439 default:
1441 break;
1442 }
1443 }
1445 {
1447 }
1448 }
1449
1450 /* When browser tracking feature is disabled, clear LastDirBackup */
1451 if (!browser_track)
1453 }
1454 else
1455 {
1457 }
1458
1459 if (!priv->state.is_mailbox_list &&
1461 {
1462 init_state(&priv->state, NULL);
1463 priv->state.imap_browse = true;
1465 browser_sort(&priv->state);
1466 }
1467 else
1468 {
1469 size_t i = buf_len(&LastDir);
1470 while ((i > 0) && (buf_string(&LastDir)[--i] == '/'))
1471 LastDir.data[i] = '\0';
1473 if (buf_is_empty(&LastDir))
1475 }
1476 }
1477
1478 buf_reset(file);
1479
1480 const struct Mapping *help_data = NULL;
1481
1482 if (OptNews)
1483 help_data = FolderNewsHelp;
1484 else
1485 help_data = FolderHelp;
1486
1487 dlg = simple_dialog_new(MENU_FOLDER, WT_DLG_BROWSER, help_data);
1488
1489 priv->menu = dlg->wdata;
1490 dlg->wdata = priv;
1493 if (priv->multiple)
1494 priv->menu->tag = file_tag;
1495
1496 priv->sbar = window_find_child(dlg, WT_STATUS_BAR);
1498
1499 struct MuttWindow *win_menu = priv->menu->win;
1500
1501 // NT_COLOR is handled by the SimpleDialog
1505
1506 struct MuttWindow *old_focus = window_set_focus(priv->menu->win);
1507
1508 if (priv->state.is_mailbox_list)
1509 {
1510 examine_mailboxes(m, NULL, &priv->state);
1511 }
1512 else if (!priv->state.imap_browse)
1513 {
1514 // examine_directory() calls browser_add_folder() which needs the menu
1515 if (examine_directory(m, priv->menu, &priv->state, buf_string(&LastDir),
1516 buf_string(priv->prefix)) == -1)
1517 {
1518 goto bail;
1519 }
1520 }
1521
1522 init_menu(&priv->state, priv->menu, m, priv->sbar);
1523 // only now do we have a valid priv->state to attach
1524 priv->menu->mdata = &priv->state;
1525
1526 // ---------------------------------------------------------------------------
1527 // Event Loop
1528 int op = OP_NULL;
1529 do
1530 {
1531 menu_tagging_dispatcher(priv->menu->win, op);
1532 window_redraw(NULL);
1533
1535 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
1536 if (op < 0)
1537 continue;
1538 if (op == OP_NULL)
1539 {
1541 continue;
1542 }
1544
1545 int rc = browser_function_dispatcher(priv->win_browser, op);
1546
1547 if (rc == FR_UNKNOWN)
1548 rc = menu_function_dispatcher(priv->menu->win, op);
1549 if (rc == FR_UNKNOWN)
1550 rc = global_function_dispatcher(NULL, op);
1551 } while (!priv->done);
1552 // ---------------------------------------------------------------------------
1553
1554bail:
1555 window_set_focus(old_focus);
1556 simple_dialog_free(&dlg);
1558}
1559
1565const struct ExpandoRenderData FolderRenderData[] = {
1566 // clang-format off
1585 { -1, -1, NULL, NULL },
1586 // clang-format on
1587};
1588
1594const struct ExpandoRenderData GroupIndexRenderData[] = {
1595 // clang-format off
1605 { -1, -1, NULL, NULL },
1606 // clang-format on
1607};
#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:1140
#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:161
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:204
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:96
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:491
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:377
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:76
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:291
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition: buffer.c:182
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
Definition: buffer.c:416
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:241
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:226
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:395
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:601
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
Definition: buffer.c:509
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition: buffer.c:337
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:217
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:291
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:266
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Definition: config_type.c:357
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:688
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:711
const struct ExpandoRenderData GroupIndexRenderData[]
Callbacks for Nntp Browser Expandos.
Definition: dlg_browser.c:110
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
Definition: dlg_browser.c:1028
static void init_lastdir(void)
Initialise the browser directories.
Definition: dlg_browser.c:148
const struct ExpandoRenderData FolderRenderData[]
Callbacks for Browser Expandos.
Definition: dlg_browser.c:109
static const struct Mapping FolderNewsHelp[]
Help Bar for the NNTP Mailbox browser dialog.
Definition: dlg_browser.c:125
struct Buffer LastDir
Browser: previous selected directory.
Definition: dlg_browser.c:139
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
Definition: dlg_browser.c:1272
struct Buffer LastDirBackup
Browser: backup copy of the current directory.
Definition: dlg_browser.c:141
static const struct Mapping FolderHelp[]
Help Bar for the File/Dir/Mailbox browser dialog.
Definition: dlg_browser.c:113
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:637
void mutt_browser_cleanup(void)
Clean up working Buffers.
Definition: dlg_browser.c:162
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: dlg_browser.c:1002
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
Definition: dlg_browser.c:838
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: dlg_browser.c:175
@ ED_FOLDER
Folder ED_FOL_ ExpandoDataFolder.
Definition: domain.h:43
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition: domain.h:44
int expando_filter(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
Definition: filter.c:141
Parse Expando string.
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
Definition: file.c:642
@ 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:464
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:294
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:194
long folder_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Last modified - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:275
long folder_s_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Size in bytes - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:564
long folder_t_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Is Tagged - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:587
long folder_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Hard links - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:454
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:309
long folder_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: New mail flag - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:532
long folder_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Number of messages - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:480
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:506
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:554
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:255
long folder_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Browser: Index number - Implements ExpandoRenderData::get_number() -.
Definition: dlg_browser.c:265
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:409
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:541
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:321
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:287
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:467
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:609
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:596
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:519
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:207
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:246
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:493
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:374
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:573
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:354
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:430
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:1295
#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:959
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:943
static int file_tag(struct Menu *menu, int sel, int act)
Tag an entry in the menu - Implements Menu::tag() -.
Definition: dlg_browser.c:1133
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:1153
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1193
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1238
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:906
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:951
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:969
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:456
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:660
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:360
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:581
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:280
#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:169
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:936
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:519
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1066
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:315
Some miscellaneous functions.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1321
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:168
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:191
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 ASSERT(COND)
Definition: signal2.h:58
#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:69
const char * end
End of string data.
Definition: node.h:80
const char * start
Start of string data.
Definition: node.h:79
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:42
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:47
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
locale_t time_c_locale
Current locale but LC_TIME=C.
Definition: neomutt.h:48
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