NeoMutt  2024-04-25-76-g20fe7b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
hdrline.c
Go to the documentation of this file.
1
38#include "config.h"
39#include <stdbool.h>
40#include <stdio.h>
41#include <string.h>
42#include <time.h>
43#include "mutt/lib.h"
44#include "address/lib.h"
45#include "config/lib.h"
46#include "email/lib.h"
47#include "core/lib.h"
48#include "alias/lib.h"
49#include "hdrline.h"
50#include "attach/lib.h"
51#include "color/lib.h"
52#include "expando/lib.h"
53#include "ncrypt/lib.h"
54#include "hook.h"
55#include "maillist.h"
56#include "mutt_thread.h"
57#include "muttlib.h"
58#include "mx.h"
59#include "sort.h"
60#include "subjectrx.h"
61#ifdef USE_NOTMUCH
62#include "notmuch/lib.h"
63#endif
64
66
71{
72 struct Mailbox *mailbox;
74 struct Email *email;
75 const char *pager_progress;
76};
77
84{
91};
92
101static const char *make_from_prefix(enum FieldType disp)
102{
103 /* need 2 bytes at the end, one for the space, another for NUL */
104 static char padded[8];
105 static const char *long_prefixes[DISP_MAX] = {
106 [DISP_TO] = "To ", [DISP_CC] = "Cc ", [DISP_BCC] = "Bcc ",
107 [DISP_FROM] = "", [DISP_PLAIN] = "",
108 };
109
110 const struct MbTable *c_from_chars = cs_subset_mbtable(NeoMutt->sub, "from_chars");
111
112 if (!c_from_chars || !c_from_chars->chars || (c_from_chars->len == 0))
113 return long_prefixes[disp];
114
115 const char *pchar = mbtable_get_nth_wchar(c_from_chars, disp);
116 if (mutt_str_len(pchar) == 0)
117 return "";
118
119 snprintf(padded, sizeof(padded), "%s ", pchar);
120 return padded;
121}
122
137static void make_from(struct Envelope *env, char *buf, size_t buflen,
138 bool do_lists, MuttFormatFlags flags)
139{
140 if (!env || !buf)
141 return;
142
143 bool me;
144 enum FieldType disp;
145 struct AddressList *name = NULL;
146
148
149 if (do_lists || me)
150 {
151 if (check_for_mailing_list(&env->to, make_from_prefix(DISP_TO), buf, buflen))
152 return;
153 if (check_for_mailing_list(&env->cc, make_from_prefix(DISP_CC), buf, buflen))
154 return;
155 }
156
157 if (me && !TAILQ_EMPTY(&env->to))
158 {
159 disp = (flags & MUTT_FORMAT_PLAIN) ? DISP_PLAIN : DISP_TO;
160 name = &env->to;
161 }
162 else if (me && !TAILQ_EMPTY(&env->cc))
163 {
164 disp = DISP_CC;
165 name = &env->cc;
166 }
167 else if (me && !TAILQ_EMPTY(&env->bcc))
168 {
169 disp = DISP_BCC;
170 name = &env->bcc;
171 }
172 else if (!TAILQ_EMPTY(&env->from))
173 {
174 disp = DISP_FROM;
175 name = &env->from;
176 }
177 else
178 {
179 *buf = '\0';
180 return;
181 }
182
183 snprintf(buf, buflen, "%s%s", make_from_prefix(disp), mutt_get_name(TAILQ_FIRST(name)));
184}
185
193static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool do_lists)
194{
195 if (!env || !buf)
196 return;
197
198 bool me = mutt_addr_is_user(TAILQ_FIRST(&env->from));
199
200 if (do_lists || me)
201 {
202 if (check_for_mailing_list_addr(&env->to, buf, buflen))
203 return;
204 if (check_for_mailing_list_addr(&env->cc, buf, buflen))
205 return;
206 }
207
208 if (me && !TAILQ_EMPTY(&env->to))
209 snprintf(buf, buflen, "%s", buf_string(TAILQ_FIRST(&env->to)->mailbox));
210 else if (me && !TAILQ_EMPTY(&env->cc))
211 snprintf(buf, buflen, "%s", buf_string(TAILQ_FIRST(&env->cc)->mailbox));
212 else if (!TAILQ_EMPTY(&env->from))
213 mutt_str_copy(buf, buf_string(TAILQ_FIRST(&env->from)->mailbox), buflen);
214 else
215 *buf = '\0';
216}
217
223static bool user_in_addr(struct AddressList *al)
224{
225 struct Address *a = NULL;
226 TAILQ_FOREACH(a, al, entries)
227 if (mutt_addr_is_user(a))
228 return true;
229 return false;
230}
231
237static enum ToChars user_is_recipient(struct Email *e)
238{
239 if (!e || !e->env)
241
242 struct Envelope *env = e->env;
243
244 if (!e->recip_valid)
245 {
246 e->recip_valid = true;
247
249 {
251 }
252 else if (user_in_addr(&env->to))
253 {
254 if (TAILQ_NEXT(TAILQ_FIRST(&env->to), entries) || !TAILQ_EMPTY(&env->cc))
255 e->recipient = FLAG_CHAR_TO_TO; /* non-unique recipient */
256 else
257 e->recipient = FLAG_CHAR_TO_UNIQUE; /* unique recipient */
258 }
259 else if (user_in_addr(&env->cc))
260 {
262 }
263 else if (check_for_mailing_list(&env->to, NULL, NULL, 0))
264 {
266 }
267 else if (check_for_mailing_list(&env->cc, NULL, NULL, 0))
268 {
270 }
271 else if (user_in_addr(&env->reply_to))
272 {
274 }
275 else
276 {
278 }
279 }
280
281 return e->recipient;
282}
283
289static bool thread_is_new(struct Email *e)
290{
291 return e->collapsed && (e->num_hidden > 1) && (mutt_thread_contains_unread(e) == 1);
292}
293
299static bool thread_is_old(struct Email *e)
300{
301 return e->collapsed && (e->num_hidden > 1) && (mutt_thread_contains_unread(e) == 2);
302}
303
307long index_date_recv_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
308{
309 const struct HdrFormatInfo *hfi = data;
310 const struct Email *e = hfi->email;
311 if (!e)
312 return 0;
313
314 return e->received;
315}
316
320void index_date_recv_local(const struct ExpandoNode *node, void *data,
321 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
322{
323 const struct HdrFormatInfo *hfi = data;
324 const struct Email *e = hfi->email;
325 if (!e)
326 return;
327
328 struct tm tm = mutt_date_localtime(e->received);
329
330 char tmp[128] = { 0 };
331 char tmp2[128] = { 0 };
332
333 int len = node->end - node->start;
334 const char *start = node->start;
335
336 bool use_c_locale = false;
337 if (*start == '!')
338 {
339 use_c_locale = true;
340 start++;
341 len--;
342 }
343 ASSERT(len < sizeof(tmp2));
344 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
345
346 if (use_c_locale)
347 {
348 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
349 }
350 else
351 {
352 strftime(tmp, sizeof(tmp), tmp2, &tm);
353 }
354
355 if (flags & MUTT_FORMAT_INDEX)
357 buf_strcpy(buf, tmp);
358}
359
363long index_date_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
364{
365 const struct HdrFormatInfo *hfi = data;
366 const struct Email *e = hfi->email;
367 if (!e)
368 return 0;
369
370 return e->date_sent;
371}
372
376void index_date_local(const struct ExpandoNode *node, void *data,
377 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
378{
379 const struct HdrFormatInfo *hfi = data;
380 const struct Email *e = hfi->email;
381 if (!e)
382 return;
383
384 struct tm tm = mutt_date_localtime(e->date_sent);
385
386 char tmp[128] = { 0 };
387 char tmp2[128] = { 0 };
388
389 int len = node->end - node->start;
390 const char *start = node->start;
391
392 bool use_c_locale = false;
393 if (*start == '!')
394 {
395 use_c_locale = true;
396 start++;
397 len--;
398 }
399 ASSERT(len < sizeof(tmp2));
400 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
401
402 if (use_c_locale)
403 {
404 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
405 }
406 else
407 {
408 strftime(tmp, sizeof(tmp), tmp2, &tm);
409 }
410
411 if (flags & MUTT_FORMAT_INDEX)
413 buf_strcpy(buf, tmp);
414}
415
419long index_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
420{
421 const struct HdrFormatInfo *hfi = data;
422 const struct Email *e = hfi->email;
423 if (!e)
424 return 0;
425
426 return e->date_sent;
427}
428
432void index_date(const struct ExpandoNode *node, void *data,
433 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
434{
435 const struct HdrFormatInfo *hfi = data;
436 const struct Email *e = hfi->email;
437 if (!e)
438 return;
439
440 time_t now = e->date_sent;
441 if (e->zoccident)
442 now -= (e->zhours * 3600 + e->zminutes * 60);
443 else
444 now += (e->zhours * 3600 + e->zminutes * 60);
445
446 struct tm tm = mutt_date_gmtime(now);
447
448 char tmp[128] = { 0 };
449 char tmp2[128] = { 0 };
450
451 int len = node->end - node->start;
452 const char *start = node->start;
453
454 bool use_c_locale = false;
455 if (*start == '!')
456 {
457 use_c_locale = true;
458 start++;
459 len--;
460 }
461 ASSERT(len < sizeof(tmp2));
462 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
463
464 if (use_c_locale)
465 {
466 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
467 }
468 else
469 {
470 strftime(tmp, sizeof(tmp), tmp2, &tm);
471 }
472
473 if (flags & MUTT_FORMAT_INDEX)
475 buf_strcpy(buf, tmp);
476}
477
481void index_format_hook(const struct ExpandoNode *node, void *data,
482 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
483{
484 const struct HdrFormatInfo *hfi = data;
485 struct Email *e = hfi->email;
486 if (!e)
487 return;
488
489 struct Mailbox *m = hfi->mailbox;
490
491 char tmp[128] = { 0 };
492 const int len = node->end - node->start;
493
494 mutt_strn_copy(tmp, node->start, len, sizeof(tmp));
495
496 const struct Expando *exp = mutt_idxfmt_hook(tmp, m, e);
497 if (!exp)
498 return;
499
501}
502
506void index_a(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
507 int max_cols, struct Buffer *buf)
508{
509 const struct HdrFormatInfo *hfi = data;
510 const struct Email *e = hfi->email;
511 if (!e || !e->env)
512 return;
513
514 const struct Address *from = TAILQ_FIRST(&e->env->from);
515
516 const char *s = NULL;
517 if (from && from->mailbox)
518 {
519 s = mutt_addr_for_display(from);
520 }
521
522 if (flags & MUTT_FORMAT_INDEX)
524 buf_strcpy(buf, s);
525}
526
530void index_A(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
531 int max_cols, struct Buffer *buf)
532{
533 const struct HdrFormatInfo *hfi = data;
534 const struct Email *e = hfi->email;
535 if (!e || !e->env)
536 return;
537
538 const struct Address *reply_to = TAILQ_FIRST(&e->env->reply_to);
539
540 if (reply_to && reply_to->mailbox)
541 {
542 if (flags & MUTT_FORMAT_INDEX)
544 const char *s = mutt_addr_for_display(reply_to);
545 buf_strcpy(buf, s);
546 return;
547 }
548
549 index_a(node, data, flags, max_cols, buf);
550}
551
555void index_b(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
556 int max_cols, struct Buffer *buf)
557{
558 const struct HdrFormatInfo *hfi = data;
559 struct Mailbox *m = hfi->mailbox;
560 if (!m)
561 {
562 buf_addstr(buf, "(null)");
563 return;
564 }
565
566 char *p = NULL;
567
568#ifdef USE_NOTMUCH
569 struct Email *e = hfi->email;
570 if (m->type == MUTT_NOTMUCH)
571 {
573 }
574#endif
575 if (!p)
576 {
577 p = strrchr(mailbox_path(m), '/');
578 if (p)
579 {
580 p++;
581 }
582 }
583 buf_addstr(buf, p ? p : mailbox_path(m));
584}
585
589void index_B(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
590 int max_cols, struct Buffer *buf)
591{
592 const struct HdrFormatInfo *hfi = data;
593 const struct Email *e = hfi->email;
594 if (!e || !e->env)
595 return;
596
597 char tmp[128] = { 0 };
598
599 if (first_mailing_list(tmp, sizeof(tmp), &e->env->to) ||
600 first_mailing_list(tmp, sizeof(tmp), &e->env->cc))
601 {
602 buf_strcpy(buf, tmp);
603 return;
604 }
605
606 index_b(node, data, flags, max_cols, buf);
607}
608
612long index_c_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
613{
614 const struct HdrFormatInfo *hfi = data;
615 const struct Email *e = hfi->email;
616 if (!e || !e->body)
617 return 0;
618
619 return e->body->length;
620}
621
625void index_c(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
626 int max_cols, struct Buffer *buf)
627{
628 const struct HdrFormatInfo *hfi = data;
629 const struct Email *e = hfi->email;
630 if (!e)
631 return;
632
633 char tmp[128] = { 0 };
634
635 if (flags & MUTT_FORMAT_INDEX)
637
638 mutt_str_pretty_size(tmp, sizeof(tmp), e->body->length);
639 buf_strcpy(buf, tmp);
640}
641
645void index_cr(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
646 int max_cols, struct Buffer *buf)
647{
648 const struct HdrFormatInfo *hfi = (const struct HdrFormatInfo *) data;
649 const struct Email *e = hfi->email;
650 if (!e)
651 return;
652
653 char tmp[128] = { 0 };
654
655 if (flags & MUTT_FORMAT_INDEX)
657
658 mutt_str_pretty_size(tmp, sizeof(tmp), email_size(e));
659 buf_strcpy(buf, tmp);
660}
661
665long index_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
666{
667 const struct HdrFormatInfo *hfi = data;
668 const struct Email *e = hfi->email;
669 if (!e)
670 return 0;
671
672 if (flags & MUTT_FORMAT_INDEX)
674
675 return e->msgno + 1;
676}
677
681long index_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
682{
683 const struct HdrFormatInfo *hfi = data;
684 const struct Email *e = hfi->email;
685 if (!e)
686 return 0;
687
688 return e->date_sent;
689}
690
694void index_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
695 int max_cols, struct Buffer *buf)
696{
697 const struct HdrFormatInfo *hfi = data;
698 const struct Email *e = hfi->email;
699 if (!e)
700 return;
701
702 const char *c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
703 const char *cp = NONULL(c_date_format);
704 bool use_c_locale = false;
705 if (*cp == '!')
706 {
707 use_c_locale = true;
708 cp++;
709 }
710
711 /* restore sender's time zone */
712 time_t now = e->date_sent;
713 if (e->zoccident)
714 now -= (e->zhours * 3600 + e->zminutes * 60);
715 else
716 now += (e->zhours * 3600 + e->zminutes * 60);
717
718 struct tm tm = mutt_date_gmtime(now);
719 char tmp[128] = { 0 };
720
721 if (use_c_locale)
722 {
723 strftime_l(tmp, sizeof(tmp), cp, &tm, NeoMutt->time_c_locale);
724 }
725 else
726 {
727 strftime(tmp, sizeof(tmp), cp, &tm);
728 }
729
730 if (flags & MUTT_FORMAT_INDEX)
732
733 buf_strcpy(buf, tmp);
734}
735
739long index_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
740{
741 const struct HdrFormatInfo *hfi = data;
742 const struct Email *e = hfi->email;
743 if (!e)
744 return 0;
745
746 return e->date_sent;
747}
748
752void index_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
753 int max_cols, struct Buffer *buf)
754{
755 const struct HdrFormatInfo *hfi = data;
756 const struct Email *e = hfi->email;
757 if (!e)
758 return;
759
760 const char *c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
761 const char *cp = NONULL(c_date_format);
762 bool use_c_locale = false;
763 if (*cp == '!')
764 {
765 use_c_locale = true;
766 cp++;
767 }
768
769 struct tm tm = mutt_date_localtime(e->date_sent);
770 char tmp[128] = { 0 };
771
772 if (use_c_locale)
773 {
774 strftime_l(tmp, sizeof(tmp), cp, &tm, NeoMutt->time_c_locale);
775 }
776 else
777 {
778 strftime(tmp, sizeof(tmp), cp, &tm);
779 }
780
781 if (flags & MUTT_FORMAT_INDEX)
783
784 buf_strcpy(buf, tmp);
785}
786
790long index_e_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
791{
792 const struct HdrFormatInfo *hfi = data;
793 struct Email *e = hfi->email;
794 struct Mailbox *m = hfi->mailbox;
795
797}
798
802long index_E_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
803{
804 const struct HdrFormatInfo *hfi = data;
805 struct Email *e = hfi->email;
806 struct Mailbox *m = hfi->mailbox;
807
809}
810
814void index_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
815 int max_cols, struct Buffer *buf)
816{
817 const struct HdrFormatInfo *hfi = data;
818 struct Email *e = hfi->email;
819 if (!e || !e->env)
820 return;
821
822 mutt_addrlist_write(&e->env->from, buf, true);
823}
824
828void index_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
829 int max_cols, struct Buffer *buf)
830{
831 const struct HdrFormatInfo *hfi = data;
832 struct Email *e = hfi->email;
833 if (!e || !e->env)
834 return;
835
836 char tmp[128] = { 0 };
837
838 make_from(e->env, tmp, sizeof(tmp), false, MUTT_FORMAT_NO_FLAGS);
839
840 if (flags & MUTT_FORMAT_INDEX)
842
843 buf_strcpy(buf, tmp);
844}
845
849void index_Fp(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
850 int max_cols, struct Buffer *buf)
851{
852 const struct HdrFormatInfo *hfi = (const struct HdrFormatInfo *) data;
853 struct Email *e = hfi->email;
854 if (!e || !e->env)
855 return;
856
857 char tmp[128] = { 0 };
858
859 if (flags & MUTT_FORMAT_INDEX)
861
862 make_from(e->env, tmp, sizeof(tmp), false, MUTT_FORMAT_PLAIN);
863
864 buf_strcpy(buf, tmp);
865}
866
870void index_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
871 int max_cols, struct Buffer *buf)
872{
873 const struct HdrFormatInfo *hfi = data;
874 struct Email *e = hfi->email;
875 if (!e)
876 return;
877
878 if (flags & MUTT_FORMAT_INDEX)
881}
882
886void index_G(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
887 int max_cols, struct Buffer *buf)
888{
889 const struct HdrFormatInfo *hfi = data;
890 struct Email *e = hfi->email;
891 if (!e)
892 return;
893
894 char tag_format[3] = { 0 };
895
896 tag_format[0] = 'G';
897 tag_format[1] = node->start[1];
898 tag_format[2] = '\0';
899
900 char *tag = mutt_hash_find(TagFormats, tag_format);
901 if (!tag)
902 return;
903
904 if (flags & MUTT_FORMAT_INDEX)
907}
908
912void index_H(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
913 int max_cols, struct Buffer *buf)
914{
915 const struct HdrFormatInfo *hfi = data;
916 struct Email *e = hfi->email;
917 if (!e || !e->env)
918 return;
919
920 buf_copy(buf, &e->env->spam);
921}
922
926void index_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
927 int max_cols, struct Buffer *buf)
928{
929 const struct HdrFormatInfo *hfi = data;
930 struct Email *e = hfi->email;
931 if (!e || !e->env)
932 return;
933
934 const char *s = e->env->message_id ? e->env->message_id : "<no.id>";
935 buf_strcpy(buf, s);
936}
937
941void index_I(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
942 int max_cols, struct Buffer *buf)
943{
944 const struct HdrFormatInfo *hfi = data;
945 const struct Email *e = hfi->email;
946 if (!e || !e->env)
947 return;
948
949 const struct Address *from = TAILQ_FIRST(&e->env->from);
950
951 char tmp[128] = { 0 };
952
953 if (mutt_mb_get_initials(mutt_get_name(from), tmp, sizeof(tmp)))
954 {
955 if (flags & MUTT_FORMAT_INDEX)
957
958 buf_strcpy(buf, tmp);
959 return;
960 }
961
962 index_a(node, data, flags, max_cols, buf);
963}
964
968void index_J(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
969 int max_cols, struct Buffer *buf)
970{
971 const struct HdrFormatInfo *hfi = data;
972 struct Email *e = hfi->email;
973 if (!e)
974 return;
975
976 bool have_tags = true;
977 struct Buffer *tags = buf_pool_get();
979 if (!buf_is_empty(tags))
980 {
981 if (flags & MUTT_FORMAT_TREE)
982 {
983 struct Buffer *parent_tags = buf_pool_get();
984 if (e->thread->prev && e->thread->prev->message)
985 {
987 }
988 if (!parent_tags && e->thread->parent && e->thread->parent->message)
989 {
991 }
992 if (parent_tags && buf_istr_equal(tags, parent_tags))
993 have_tags = false;
994 buf_pool_release(&parent_tags);
995 }
996 }
997 else
998 {
999 have_tags = false;
1000 }
1001
1002 if (flags & MUTT_FORMAT_INDEX)
1004
1005 const char *s = have_tags ? buf_string(tags) : "";
1006 buf_strcpy(buf, s);
1007
1008 buf_pool_release(&tags);
1009}
1010
1014void index_K(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1015 int max_cols, struct Buffer *buf)
1016{
1017 const struct HdrFormatInfo *hfi = data;
1018 const struct Email *e = hfi->email;
1019 if (!e || !e->env)
1020 return;
1021
1022 char tmp[128] = { 0 };
1023
1024 if (first_mailing_list(tmp, sizeof(tmp), &e->env->to) ||
1025 first_mailing_list(tmp, sizeof(tmp), &e->env->cc))
1026 {
1027 buf_strcpy(buf, tmp);
1028 }
1029}
1030
1034long index_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1035{
1036 const struct HdrFormatInfo *hfi = data;
1037 const struct Email *e = hfi->email;
1038 if (!e)
1039 return 0;
1040
1041 if (flags & MUTT_FORMAT_INDEX)
1043
1044 return e->lines;
1045}
1046
1050void index_L(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1051 int max_cols, struct Buffer *buf)
1052{
1053 const struct HdrFormatInfo *hfi = data;
1054 const struct Email *e = hfi->email;
1055 if (!e)
1056 return;
1057
1058 char tmp[128] = { 0 };
1059
1060 make_from(e->env, tmp, sizeof(tmp), true, flags);
1061
1062 if (flags & MUTT_FORMAT_INDEX)
1064 buf_strcpy(buf, tmp);
1065}
1066
1070long index_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1071{
1072 const struct HdrFormatInfo *hfi = data;
1073 const struct Mailbox *m = hfi->mailbox;
1074
1075 if (m)
1076 return m->msg_count;
1077
1078 return 0;
1079}
1080
1084void index_M(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1085 int max_cols, struct Buffer *buf)
1086{
1087 const struct HdrFormatInfo *hfi = data;
1088 const struct Email *e = hfi->email;
1089 if (!e)
1090 return;
1091
1092 const bool threads = mutt_using_threads();
1093 const bool is_index = (flags & MUTT_FORMAT_INDEX) != 0;
1094
1095 if (threads && is_index && e->collapsed && (e->num_hidden > 1))
1096 {
1097 if (flags & MUTT_FORMAT_INDEX)
1099 const int num = e->num_hidden;
1100 buf_printf(buf, "%d", num);
1101 }
1102 else if (is_index && threads)
1103 {
1104 if (flags & MUTT_FORMAT_INDEX)
1106 const char *s = " ";
1107 buf_strcpy(buf, s);
1108 }
1109}
1110
1114long index_M_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1115{
1116 const struct HdrFormatInfo *hfi = data;
1117 const struct Email *e = hfi->email;
1118 if (!e)
1119 return 0;
1120
1121 const bool threads = mutt_using_threads();
1122 const bool is_index = (flags & MUTT_FORMAT_INDEX) != 0;
1123
1124 if (threads && is_index && e->collapsed && (e->num_hidden > 1))
1125 {
1126 if (flags & MUTT_FORMAT_INDEX)
1128 return e->num_hidden;
1129 }
1130
1131 return 0;
1132}
1133
1137void index_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1138 int max_cols, struct Buffer *buf)
1139{
1140 const struct HdrFormatInfo *hfi = data;
1141 const struct Email *e = hfi->email;
1142 if (!e || !e->env)
1143 return;
1144
1145 const struct Address *from = TAILQ_FIRST(&e->env->from);
1146
1147 if (flags & MUTT_FORMAT_INDEX)
1149
1150 const char *s = mutt_get_name(from);
1151 buf_strcpy(buf, s);
1152}
1153
1157long index_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1158{
1159 const struct HdrFormatInfo *hfi = data;
1160 const struct Email *e = hfi->email;
1161 if (!e)
1162 return 0;
1163
1164 return e->score;
1165}
1166
1170void index_O(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1171 int max_cols, struct Buffer *buf)
1172{
1173 const struct HdrFormatInfo *hfi = data;
1174 const struct Email *e = hfi->email;
1175 if (!e || !e->env)
1176 return;
1177
1178 char tmp[128] = { 0 };
1179 char *p = NULL;
1180
1181 make_from_addr(e->env, tmp, sizeof(tmp), true);
1182 const bool c_save_address = cs_subset_bool(NeoMutt->sub, "save_address");
1183 if (!c_save_address && (p = strpbrk(tmp, "%@")))
1184 {
1185 *p = '\0';
1186 }
1187
1188 buf_strcpy(buf, tmp);
1189}
1190
1194void index_P(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1195 int max_cols, struct Buffer *buf)
1196{
1197 const struct HdrFormatInfo *hfi = data;
1198
1199 const char *s = hfi->pager_progress;
1200 buf_strcpy(buf, s);
1201}
1202
1206void index_q(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1207 int max_cols, struct Buffer *buf)
1208{
1209 const struct HdrFormatInfo *hfi = data;
1210 const struct Email *e = hfi->email;
1211 if (!e || !e->env)
1212 return;
1213
1214 const char *s = e->env->newsgroups;
1215 buf_strcpy(buf, s);
1216}
1217
1221void index_r(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1222 int max_cols, struct Buffer *buf)
1223{
1224 const struct HdrFormatInfo *hfi = data;
1225 const struct Email *e = hfi->email;
1226 if (!e || !e->env)
1227 return;
1228
1229 mutt_addrlist_write(&e->env->to, buf, true);
1230}
1231
1235void index_R(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1236 int max_cols, struct Buffer *buf)
1237{
1238 const struct HdrFormatInfo *hfi = data;
1239 const struct Email *e = hfi->email;
1240 if (!e || !e->env)
1241 return;
1242
1243 mutt_addrlist_write(&e->env->cc, buf, true);
1244}
1245
1249void index_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1250 int max_cols, struct Buffer *buf)
1251{
1252 const struct HdrFormatInfo *hfi = data;
1253 const struct Email *e = hfi->email;
1254 if (!e || !e->env)
1255 return;
1256
1257 if ((flags & MUTT_FORMAT_TREE) && !e->collapsed && !(flags & MUTT_FORMAT_FORCESUBJ))
1258 return;
1259
1260 if (flags & MUTT_FORMAT_INDEX)
1262
1264
1265 if (e->env->disp_subj)
1266 buf_strcpy(buf, e->env->disp_subj);
1267 else
1268 buf_strcpy(buf, e->env->subject);
1269}
1270
1274void index_S(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1275 int max_cols, struct Buffer *buf)
1276{
1277 const struct HdrFormatInfo *hfi = data;
1278 const struct Email *e = hfi->email;
1279 if (!e)
1280 return;
1281
1282 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1283 const int msg_in_pager = hfi->msg_in_pager;
1284
1285 const char *wch = NULL;
1286 if (e->deleted)
1287 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1288 else if (e->attach_del)
1290 else if (e->tagged)
1291 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1292 else if (e->flagged)
1293 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1294 else if (e->replied)
1295 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1296 else if (e->read && (msg_in_pager != e->msgno))
1297 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_SEMPTY);
1298 else if (e->old)
1299 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1300 else
1301 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1302
1303 if (flags & MUTT_FORMAT_INDEX)
1305
1306 buf_strcpy(buf, wch);
1307}
1308
1312void index_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1313 int max_cols, struct Buffer *buf)
1314{
1315 const struct HdrFormatInfo *hfi = data;
1316 const struct Email *e = hfi->email;
1317 if (!e || !e->env)
1318 return;
1319
1320 const struct Address *to = TAILQ_FIRST(&e->env->to);
1321 const struct Address *cc = TAILQ_FIRST(&e->env->cc);
1322
1323 char tmp[128] = { 0 };
1324
1325 if (!check_for_mailing_list(&e->env->to, "To ", tmp, sizeof(tmp)) &&
1326 !check_for_mailing_list(&e->env->cc, "Cc ", tmp, sizeof(tmp)))
1327 {
1328 if (to)
1329 snprintf(tmp, sizeof(tmp), "To %s", mutt_get_name(to));
1330 else if (cc)
1331 snprintf(tmp, sizeof(tmp), "Cc %s", mutt_get_name(cc));
1332 else
1333 {
1334 tmp[0] = '\0';
1335 }
1336 }
1337
1338 buf_strcpy(buf, tmp);
1339}
1340
1344void index_T(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1345 int max_cols, struct Buffer *buf)
1346{
1347 const struct HdrFormatInfo *hfi = data;
1348 struct Email *e = hfi->email;
1349 if (!e)
1350 return;
1351
1352 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1353
1354 int i;
1355 const char *s = (c_to_chars && ((i = user_is_recipient(e))) < c_to_chars->len) ?
1356 c_to_chars->chars[i] :
1357 " ";
1358
1359 buf_strcpy(buf, s);
1360}
1361
1365void index_tree(const struct ExpandoNode *node, void *data,
1366 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
1367{
1368 const struct HdrFormatInfo *hfi = data;
1369 const struct Email *e = hfi->email;
1370 if (!e || !e->env)
1371 return;
1372
1373 if (!(flags & MUTT_FORMAT_TREE) || e->collapsed)
1374 return;
1375
1377 node_expando_set_has_tree(node, true);
1378 buf_strcpy(buf, e->tree);
1379}
1380
1384void index_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1385 int max_cols, struct Buffer *buf)
1386{
1387 const struct HdrFormatInfo *hfi = data;
1388 const struct Email *e = hfi->email;
1389 if (!e || !e->env)
1390 return;
1391
1392 const struct Address *from = TAILQ_FIRST(&e->env->from);
1393 if (!from || !from->mailbox)
1394 return;
1395
1396 char tmp[128] = { 0 };
1397 char *p = NULL;
1398
1399 mutt_str_copy(tmp, mutt_addr_for_display(from), sizeof(tmp));
1400 p = strpbrk(tmp, "%@");
1401 if (p)
1402 {
1403 *p = '\0';
1404 }
1405
1406 buf_strcpy(buf, tmp);
1407}
1408
1412void index_v(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1413 int max_cols, struct Buffer *buf)
1414{
1415 const struct HdrFormatInfo *hfi = data;
1416 const struct Email *e = hfi->email;
1417 if (!e || !e->env)
1418 return;
1419
1420 const struct Address *from = TAILQ_FIRST(&e->env->from);
1421 const struct Address *to = TAILQ_FIRST(&e->env->to);
1422 const struct Address *cc = TAILQ_FIRST(&e->env->cc);
1423
1424 char tmp[128] = { 0 };
1425 char *p = NULL;
1426
1427 if (mutt_addr_is_user(from))
1428 {
1429 if (to)
1430 {
1431 const char *s = mutt_get_name(to);
1432 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1433 }
1434 else if (cc)
1435 {
1436 const char *s = mutt_get_name(cc);
1437 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1438 }
1439 }
1440 else
1441 {
1442 const char *s = mutt_get_name(from);
1443 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1444 }
1445 p = strpbrk(tmp, " %@");
1446 if (p)
1447 {
1448 *p = '\0';
1449 }
1450
1451 buf_strcpy(buf, tmp);
1452}
1453
1457void index_W(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1458 int max_cols, struct Buffer *buf)
1459{
1460 const struct HdrFormatInfo *hfi = data;
1461 const struct Email *e = hfi->email;
1462 if (!e || !e->env)
1463 return;
1464
1465 const char *s = e->env->organization;
1466 buf_strcpy(buf, s);
1467}
1468
1472void index_x(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1473 int max_cols, struct Buffer *buf)
1474{
1475 const struct HdrFormatInfo *hfi = data;
1476 const struct Email *e = hfi->email;
1477 if (!e || !e->env)
1478 return;
1479
1480 const char *s = e->env->x_comment_to;
1481 buf_strcpy(buf, s);
1482}
1483
1487long index_X_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1488{
1489 const struct HdrFormatInfo *hfi = data;
1490 struct Email *e = hfi->email;
1491 if (!e)
1492 return 0;
1493
1494 struct Mailbox *m = hfi->mailbox;
1495
1496 struct Message *msg = mx_msg_open(m, e);
1497 if (!msg)
1498 return 0;
1499
1500 const int num = mutt_count_body_parts(m, e, msg->fp);
1501 mx_msg_close(m, &msg);
1502 return num;
1503}
1504
1508void index_y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1509 int max_cols, struct Buffer *buf)
1510{
1511 const struct HdrFormatInfo *hfi = data;
1512 const struct Email *e = hfi->email;
1513 if (!e || !e->env)
1514 return;
1515
1516 if (flags & MUTT_FORMAT_INDEX)
1518
1519 const char *s = e->env->x_label;
1520 buf_strcpy(buf, s);
1521}
1522
1526void index_Y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1527 int max_cols, struct Buffer *buf)
1528{
1529 const struct HdrFormatInfo *hfi = data;
1530 const struct Email *e = hfi->email;
1531 if (!e || !e->env)
1532 return;
1533
1534 bool label = true;
1535 if (e->env->x_label)
1536 {
1537 struct Email *e_tmp = NULL;
1538 if (flags & MUTT_FORMAT_TREE && (e->thread->prev && e->thread->prev->message &&
1539 e->thread->prev->message->env->x_label))
1540 {
1541 e_tmp = e->thread->prev->message;
1542 }
1543 else if (flags & MUTT_FORMAT_TREE && (e->thread->parent && e->thread->parent->message &&
1545 {
1546 e_tmp = e->thread->parent->message;
1547 }
1548
1549 if (e_tmp && mutt_istr_equal(e->env->x_label, e_tmp->env->x_label))
1550 {
1551 label = false;
1552 }
1553 }
1554 else
1555 {
1556 label = false;
1557 }
1558
1559 if (flags & MUTT_FORMAT_INDEX)
1561
1562 if (label)
1563 {
1564 const char *s = e->env->x_label;
1565 buf_strcpy(buf, s);
1566 }
1567}
1568
1572void index_zc(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1573 int max_cols, struct Buffer *buf)
1574{
1575 const struct HdrFormatInfo *hfi = data;
1576 const struct Email *e = hfi->email;
1577 if (!e)
1578 return;
1579
1580 const struct MbTable *c_crypt_chars = cs_subset_mbtable(NeoMutt->sub, "crypt_chars");
1581
1582 const char *ch = NULL;
1583 if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1584 {
1586 }
1587 else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1588 {
1590 }
1591 else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1592 {
1593 ch = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_SIGNED);
1594 }
1595 else if (((WithCrypto & APPLICATION_PGP) != 0) && ((e->security & PGP_KEY) == PGP_KEY))
1596 {
1598 }
1599 else
1600 {
1602 }
1603
1604 if (flags & MUTT_FORMAT_INDEX)
1606 buf_strcpy(buf, ch);
1607}
1608
1612void index_zs(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1613 int max_cols, struct Buffer *buf)
1614{
1615 const struct HdrFormatInfo *hfi = data;
1616 struct Email *e = hfi->email;
1617 if (!e)
1618 return;
1619
1620 const bool threads = mutt_using_threads();
1621 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1622 const int msg_in_pager = hfi->msg_in_pager;
1623
1624 const char *ch = NULL;
1625 if (e->deleted)
1626 {
1627 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1628 }
1629 else if (e->attach_del)
1630 {
1632 }
1633 else if (threads && thread_is_new(e))
1634 {
1635 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW_THREAD);
1636 }
1637 else if (threads && thread_is_old(e))
1638 {
1639 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD_THREAD);
1640 }
1641 else if (e->read && (msg_in_pager != e->msgno))
1642 {
1643 if (e->replied)
1644 {
1645 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1646 }
1647 else
1648 {
1649 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_ZEMPTY);
1650 }
1651 }
1652 else
1653 {
1654 if (e->old)
1655 {
1656 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1657 }
1658 else
1659 {
1660 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1661 }
1662 }
1663
1664 if (flags & MUTT_FORMAT_INDEX)
1666 buf_strcpy(buf, ch);
1667}
1668
1672void index_zt(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1673 int max_cols, struct Buffer *buf)
1674{
1675 const struct HdrFormatInfo *hfi = data;
1676 struct Email *e = hfi->email;
1677 if (!e)
1678 return;
1679
1680 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1681 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1682
1683 const char *ch = NULL;
1684 if (e->tagged)
1685 {
1686 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1687 }
1688 else if (e->flagged)
1689 {
1690 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1691 }
1692 else
1693 {
1694 ch = mbtable_get_nth_wchar(c_to_chars, user_is_recipient(e));
1695 }
1696
1697 if (flags & MUTT_FORMAT_INDEX)
1699 buf_strcpy(buf, ch);
1700}
1701
1705void index_Z(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1706 int max_cols, struct Buffer *buf)
1707{
1708 const struct HdrFormatInfo *hfi = data;
1709 struct Email *e = hfi->email;
1710 if (!e)
1711 return;
1712
1713 const int msg_in_pager = hfi->msg_in_pager;
1714
1715 const struct MbTable *c_crypt_chars = cs_subset_mbtable(NeoMutt->sub, "crypt_chars");
1716 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1717 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1718 const bool threads = mutt_using_threads();
1719
1720 const char *first = NULL;
1721 if (threads && thread_is_new(e))
1722 {
1723 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW_THREAD);
1724 }
1725 else if (threads && thread_is_old(e))
1726 {
1727 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD_THREAD);
1728 }
1729 else if (e->read && (msg_in_pager != e->msgno))
1730 {
1731 if (e->replied)
1732 {
1733 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1734 }
1735 else
1736 {
1737 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_ZEMPTY);
1738 }
1739 }
1740 else
1741 {
1742 if (e->old)
1743 {
1744 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1745 }
1746 else
1747 {
1748 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1749 }
1750 }
1751
1752 /* Marked for deletion; deleted attachments; crypto */
1753 const char *second = NULL;
1754 if (e->deleted)
1755 second = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1756 else if (e->attach_del)
1757 second = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED_ATTACH);
1758 else if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1759 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_GOOD_SIGN);
1760 else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1761 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_ENCRYPTED);
1762 else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1763 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_SIGNED);
1764 else if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & PGP_KEY))
1765 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_CONTAINS_KEY);
1766 else
1767 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_NO_CRYPTO);
1768
1769 /* Tagged, flagged and recipient flag */
1770 const char *third = NULL;
1771 if (e->tagged)
1772 third = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1773 else if (e->flagged)
1774 third = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1775 else
1776 third = mbtable_get_nth_wchar(c_to_chars, user_is_recipient(e));
1777
1778 if (flags & MUTT_FORMAT_INDEX)
1780
1781 buf_printf(buf, "%s%s%s", first, second, third);
1782}
1783
1796int mutt_make_string(struct Buffer *buf, size_t max_cols,
1797 const struct Expando *exp, struct Mailbox *m, int inpgr,
1798 struct Email *e, MuttFormatFlags flags, const char *progress)
1799{
1800 if (!exp)
1801 return 0;
1802
1803 struct HdrFormatInfo hfi = { 0 };
1804
1805 hfi.email = e;
1806 hfi.mailbox = m;
1807 hfi.msg_in_pager = inpgr;
1808 hfi.pager_progress = progress;
1809
1810 return expando_filter(exp, IndexRenderData, &hfi, flags, max_cols, buf);
1811}
1812
1818const struct ExpandoRenderData IndexRenderData[] = {
1819 // clang-format off
1822 { ED_ENVELOPE, ED_ENV_FROM, index_a, NULL },
1834 { ED_ENVELOPE, ED_ENV_SENDER, index_F, NULL },
1836 { ED_EMAIL, ED_EMA_TAGS, index_g, NULL },
1838 { ED_ENVELOPE, ED_ENV_SPAM, index_H, NULL },
1843 { ED_EMAIL, ED_EMA_FROM_LIST, index_L, NULL },
1844 { ED_EMAIL, ED_EMA_LINES, NULL, index_l_num },
1847 { ED_ENVELOPE, ED_ENV_NAME, index_n, NULL },
1848 { ED_EMAIL, ED_EMA_SCORE, NULL, index_N_num },
1852 { ED_ENVELOPE, ED_ENV_CC_ALL, index_R, NULL },
1853 { ED_ENVELOPE, ED_ENV_TO_ALL, index_r, NULL },
1856 { ED_ENVELOPE, ED_ENV_TO, index_t, NULL },
1857 { ED_EMAIL, ED_EMA_TO_CHARS, index_T, NULL },
1872 { -1, -1, NULL, NULL },
1873 // clang-format on
1874};
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition: address.c:1206
const char * mutt_addr_for_display(const struct Address *a)
Convert an Address for display purposes.
Definition: address.c:1012
Email Address Handling.
Email Aliases.
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
Definition: alias.c:600
GUI display the mailboxes in a side panel.
int mutt_count_body_parts(const struct Mailbox *m, struct Email *e, FILE *fp)
Count the MIME Body parts.
Definition: attachments.c:252
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:161
bool buf_istr_equal(const struct Buffer *a, const struct Buffer *b)
Return if two buffers are equal, case insensitive.
Definition: buffer.c:697
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:291
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
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
Color and attribute parsing.
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:84
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:90
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:93
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:91
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:86
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:92
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:79
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:88
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:89
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:87
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:85
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:291
struct MbTable * cs_subset_mbtable(const struct ConfigSubset *sub, const char *name)
Get a Multibyte table config item by name.
Definition: helpers.c:119
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
@ ED_MBX_MESSAGE_COUNT
Mailbox.msg_count.
Definition: mailbox.h:158
@ ED_MBX_PERCENTAGE
HdrFormatInfo.pager_progress.
Definition: mailbox.h:159
@ ED_MBX_MAILBOX_NAME
Mailbox, mailbox_path()
Definition: mailbox.h:157
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
@ ED_ENVELOPE
Envelope ED_ENV_ ExpandoDataEnvelope.
Definition: domain.h:42
@ ED_EMAIL
Email ED_EMA_ ExpandoDataEmail.
Definition: domain.h:41
@ ED_MAILBOX
Mailbox ED_MBX_ ExpandoDataMailbox.
Definition: domain.h:47
size_t email_size(const struct Email *e)
Compute the size of an email.
Definition: email.c:127
Structs that make up an email.
@ ED_EMA_ATTACHMENT_COUNT
Email, mutt_count_body_parts()
Definition: email.h:139
@ ED_EMA_DATE_FORMAT_LOCAL
Email.date_sent.
Definition: email.h:144
@ ED_EMA_TAGS_TRANSFORMED
Email.tags, driver_tags_get_transformed()
Definition: email.h:159
@ ED_EMA_THREAD_HIDDEN_COUNT
Email.collapsed, Email.num_hidden, ...
Definition: email.h:161
@ ED_EMA_DATE_FORMAT
Email.date_sent.
Definition: email.h:143
@ ED_EMA_THREAD_TAGS
Email.tags.
Definition: email.h:163
@ ED_EMA_TAGS
Email.tags.
Definition: email.h:158
@ ED_EMA_SIZE
Body.length.
Definition: email.h:153
@ ED_EMA_FLAG_CHARS
Email.deleted, Email.attach_del, ...
Definition: email.h:145
@ ED_EMA_THREAD_NUMBER
Email, mutt_messages_in_thread()
Definition: email.h:162
@ ED_EMA_TO_CHARS
Email, User_is_recipient()
Definition: email.h:164
@ ED_EMA_BODY_CHARACTERS
Body.length.
Definition: email.h:140
@ ED_EMA_STRF
Email.date_sent, Email.zhours, Email.zminutes, Email.zoccident.
Definition: email.h:155
@ ED_EMA_COMBINED_FLAGS
Email.read, Email.old, thread_is_new(), ...
Definition: email.h:141
@ ED_EMA_THREAD_COUNT
Email, mutt_messages_in_thread()
Definition: email.h:160
@ ED_EMA_STATUS_FLAGS
Email.deleted, Email.attach_del, ...
Definition: email.h:154
@ ED_EMA_NUMBER
Email.msgno.
Definition: email.h:151
@ ED_EMA_FROM_LIST
Envelope.to, Envelope.cc.
Definition: email.h:146
@ ED_EMA_SCORE
Email.score.
Definition: email.h:152
@ ED_EMA_CRYPTO_FLAGS
Email.security, SecurityFlags.
Definition: email.h:142
@ ED_EMA_STRF_RECV_LOCAL
Email.received.
Definition: email.h:157
@ ED_EMA_STRF_LOCAL
Email.date_sent.
Definition: email.h:156
@ ED_EMA_LIST_OR_SAVE_FOLDER
Envelope.to, Envelope.cc, check_for_mailing_list()
Definition: email.h:149
@ ED_EMA_INDEX_HOOK
Mailbox, Email, mutt_idxfmt_hook()
Definition: email.h:147
@ ED_EMA_LINES
Email.lines.
Definition: email.h:148
@ ED_EMA_MESSAGE_FLAGS
Email.tagged, Email.flagged.
Definition: email.h:150
@ ED_ENV_SUBJECT
Envelope.subject, Envelope.disp_subj.
Definition: envelope.h:116
@ ED_ENV_NEWSGROUP
Envelope.newsgroups.
Definition: envelope.h:109
@ ED_ENV_INITIALS
Envelope.from (first)
Definition: envelope.h:104
@ ED_ENV_FROM_FULL
Envelope.from (all)
Definition: envelope.h:103
@ ED_ENV_X_COMMENT_TO
Envelope.x_comment_to.
Definition: envelope.h:123
@ ED_ENV_FROM
Envelope.from (first)
Definition: envelope.h:102
@ ED_ENV_LIST_ADDRESS
Envelope.to, Envelope.cc.
Definition: envelope.h:105
@ ED_ENV_SPAM
Envelope.spam.
Definition: envelope.h:115
@ ED_ENV_SENDER
Envelope, make_from()
Definition: envelope.h:113
@ ED_ENV_TO_ALL
Envelope.to (all)
Definition: envelope.h:120
@ ED_ENV_X_LABEL
Envelope.x_label.
Definition: envelope.h:124
@ ED_ENV_NAME
Envelope.from (first)
Definition: envelope.h:108
@ ED_ENV_CC_ALL
Envelope.cc.
Definition: envelope.h:100
@ ED_ENV_ORGANIZATION
Envelope.organization.
Definition: envelope.h:110
@ ED_ENV_REPLY_TO
Envelope.reply_to.
Definition: envelope.h:112
@ ED_ENV_LIST_EMPTY
Envelope.to, Envelope.cc.
Definition: envelope.h:106
@ ED_ENV_THREAD_X_LABEL
Envelope.x_label.
Definition: envelope.h:118
@ ED_ENV_MESSAGE_ID
Envelope.message_id.
Definition: envelope.h:107
@ ED_ENV_SENDER_PLAIN
Envelope, make_from()
Definition: envelope.h:114
@ ED_ENV_USERNAME
Envelope.from.
Definition: envelope.h:121
@ ED_ENV_THREAD_TREE
Email.tree.
Definition: envelope.h:117
@ ED_ENV_TO
Envelope.to, Envelope.cc (first)
Definition: envelope.h:119
@ ED_ENV_FIRST_NAME
Envelope.from, Envelope.to, Envelope.cc.
Definition: envelope.h:101
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.
long index_date_recv_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Local received date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:307
long index_M_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of hidden messages - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1114
long index_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Index number - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:665
long index_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Total number of message - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1070
long index_date_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Local date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:363
long index_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Local Date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:739
long index_c_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of bytes - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:612
long index_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Senders Date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:681
long index_X_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of MIME attachments - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1487
long index_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of lines - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1034
long index_E_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of messages thread - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:802
long index_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Sender's date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:419
long index_e_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Thread index number - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:790
long index_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Message score - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1157
void index_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Author's real name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1137
void index_L(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: List address - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1050
void index_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Author name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:828
void index_zt(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Message tag flags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1672
void index_Y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: X-Label (if different) - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1526
void index_zc(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Message crypto flags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1572
void index_B(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Email list - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:589
void index_tree(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Thread tree - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1365
void index_b(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Filename - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:555
void index_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: To field - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1312
void index_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Message tags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:870
void index_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Senders Date and time - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:694
void index_c(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Number of bytes - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:625
void index_date_recv_local(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Local received date and time - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:320
void index_T(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: $to_chars flag - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1344
void index_cr(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Number of raw bytes - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:645
void index_q(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Newsgroup name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1206
void index_Fp(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Plain author name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:849
void index_I(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Initials of author - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:941
void index_Z(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Status flags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1705
void index_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Sender - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:814
void index_H(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Spam attributes - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:912
void index_zs(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Message status flags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1612
void index_A(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Reply-to address - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:530
void index_a(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Author Address - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:506
void index_S(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Status flag - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1274
void index_G(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Individual tag - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:886
void index_v(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: First name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1412
void index_R(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Cc recipients - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1235
void index_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: User name - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1384
void index_format_hook(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: index-format-hook - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:481
void index_date_local(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Local date and time - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:376
void index_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Subject - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1249
void index_date(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Sender's date and time - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:432
void index_x(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: X-Comment-To - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1472
void index_O(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: List Name or Save folder - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1170
void index_r(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: To recipients - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1221
void index_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Message-id - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:926
void index_M(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Number of hidden messages - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1084
void index_K(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Mailing list - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1014
void index_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Local Date and time - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:752
void index_J(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Tags - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:968
void index_P(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Progress indicator - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1194
void index_y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: X-Label - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1508
void index_W(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Index: Organization - Implements ExpandoRenderData::get_string() -.
Definition: hdrline.c:1457
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:362
static const char * make_from_prefix(enum FieldType disp)
Create a prefix for an author field.
Definition: hdrline.c:101
static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool do_lists)
Create a 'from' address for a reply email.
Definition: hdrline.c:193
FieldType
Header types.
Definition: hdrline.c:84
@ DISP_PLAIN
Empty string.
Definition: hdrline.c:89
@ DISP_TO
To: string.
Definition: hdrline.c:85
@ DISP_CC
Cc: string.
Definition: hdrline.c:86
@ DISP_BCC
Bcc: string.
Definition: hdrline.c:87
@ DISP_MAX
Definition: hdrline.c:90
@ DISP_FROM
From: string.
Definition: hdrline.c:88
static bool thread_is_old(struct Email *e)
Does the email thread contain any unread emails?
Definition: hdrline.c:299
static enum ToChars user_is_recipient(struct Email *e)
Is the user a recipient of the message.
Definition: hdrline.c:237
static void make_from(struct Envelope *env, char *buf, size_t buflen, bool do_lists, MuttFormatFlags flags)
Generate a From: field (with optional prefix)
Definition: hdrline.c:137
int mutt_make_string(struct Buffer *buf, size_t max_cols, const struct Expando *exp, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
Definition: hdrline.c:1796
static bool thread_is_new(struct Email *e)
Does the email thread contain any new emails?
Definition: hdrline.c:289
static bool user_in_addr(struct AddressList *al)
Do any of the addresses refer to the user?
Definition: hdrline.c:223
const struct ExpandoRenderData IndexRenderData[]
Callbacks for Index Expandos.
Definition: hdrline.c:65
String processing routines to generate the mail index.
ToChars
Index into the $to_chars config variable.
Definition: hdrline.h:69
@ FLAG_CHAR_TO_ORIGINATOR
Character denoting that the user is originator.
Definition: hdrline.h:74
@ FLAG_CHAR_TO_UNIQUE
Character denoting that the user is unique recipient.
Definition: hdrline.h:71
@ FLAG_CHAR_TO_NOT_IN_THE_LIST
Character denoting that the user is not in list.
Definition: hdrline.h:70
@ FLAG_CHAR_TO_TO
Character denoting that the user is in the TO list.
Definition: hdrline.h:72
@ FLAG_CHAR_TO_CC
Character denoting that the user is in the CC list.
Definition: hdrline.h:73
@ FLAG_CHAR_TO_REPLY_TO
Character denoting that the user is in the Reply-To list.
Definition: hdrline.h:76
@ FLAG_CHAR_TO_SUBSCRIBED_LIST
Character denoting that the message is sent to a subscribed mailing list.
Definition: hdrline.h:75
@ FLAG_CHAR_CRYPT_CONTAINS_KEY
Character denoting a message contains a PGP key.
Definition: hdrline.h:61
@ FLAG_CHAR_CRYPT_SIGNED
Character denoting a message is signed.
Definition: hdrline.h:60
@ FLAG_CHAR_CRYPT_NO_CRYPTO
Character denoting a message has no cryptography information.
Definition: hdrline.h:62
@ FLAG_CHAR_CRYPT_GOOD_SIGN
Character denoting a message signed with a verified key.
Definition: hdrline.h:58
@ FLAG_CHAR_CRYPT_ENCRYPTED
Character denoting a message is PGP-encrypted.
Definition: hdrline.h:59
@ FLAG_CHAR_OLD
Character denoting an email that has been read.
Definition: hdrline.h:45
@ FLAG_CHAR_REPLIED
Character denoting an email that has been replied to.
Definition: hdrline.h:44
@ FLAG_CHAR_OLD_THREAD
Character denoting a thread of emails that has been read.
Definition: hdrline.h:47
@ FLAG_CHAR_ZEMPTY
Character denoting a read email, $index_format Z expando.
Definition: hdrline.h:50
@ FLAG_CHAR_TAGGED
Character denoting a tagged email.
Definition: hdrline.h:40
@ FLAG_CHAR_NEW
Character denoting an unread email.
Definition: hdrline.h:46
@ FLAG_CHAR_DELETED
Character denoting a deleted email.
Definition: hdrline.h:42
@ FLAG_CHAR_NEW_THREAD
Character denoting a thread containing at least one new email.
Definition: hdrline.h:48
@ FLAG_CHAR_DELETED_ATTACH
Character denoting a deleted attachment.
Definition: hdrline.h:43
@ FLAG_CHAR_SEMPTY
Character denoting a read email, $index_format S expando.
Definition: hdrline.h:49
@ FLAG_CHAR_IMPORTANT
Character denoting a important (flagged) email.
Definition: hdrline.h:41
const struct Expando * mutt_idxfmt_hook(const char *name, struct Mailbox *m, struct Email *e)
Get index-format-hook format string.
Definition: hook.c:983
Parse and execute user-defined hooks.
bool check_for_mailing_list(struct AddressList *al, const char *pfx, char *buf, int buflen)
Search list of addresses for a mailing list.
Definition: maillist.c:79
bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen)
Check an address list for a mailing list.
Definition: maillist.c:103
bool first_mailing_list(char *buf, size_t buflen, struct AddressList *al)
Get the first mailing list in the list of addresses.
Definition: maillist.c:125
Handle mailing lists.
const char * mbtable_get_nth_wchar(const struct MbTable *table, int index)
Extract one char from a multi-byte table.
Definition: mbtable.c:331
bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen)
Turn a name into initials.
Definition: mbyte.c:82
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
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
Definition: date.c:927
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:672
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_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:496
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
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition: mutt_thread.c:1657
Create/manipulate threading in emails.
#define mutt_using_threads()
Definition: mutt_thread.h:114
@ MIT_NUM_MESSAGES
How many messages are in the thread.
Definition: mutt_thread.h:89
@ MIT_POSITION
Our position in the thread.
Definition: mutt_thread.h:90
#define mutt_thread_contains_unread(e)
Definition: mutt_thread.h:109
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1101
Some miscellaneous functions.
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
Definition: mx.c:1180
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
Definition: mx.c:1134
API for mailboxes.
API for encryption/signing of emails.
#define SEC_GOODSIGN
Email has a valid signature.
Definition: lib.h:80
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:90
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:78
#define PGP_KEY
Definition: lib.h:99
#define WithCrypto
Definition: lib.h:116
#define SEC_SIGN
Email is signed.
Definition: lib.h:79
void node_expando_set_color(const struct ExpandoNode *node, int cid)
Set the colour for an Expando.
Definition: node_expando.c:106
void node_expando_set_has_tree(const struct ExpandoNode *node, bool has_tree)
Set the has_tree flag for an Expando.
Definition: node_expando.c:121
Notmuch virtual mailbox type.
char * nm_email_get_folder_rel_db(struct Mailbox *m, struct Email *e)
Get the folder for a Email from the same level as the notmuch database.
Definition: notmuch.c:1488
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 TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_NEXT(elm, field)
Definition: queue.h:832
#define TAILQ_EMPTY(head)
Definition: queue.h:721
#define MUTT_FORMAT_FORCESUBJ
Print the subject even if unchanged.
Definition: render.h:34
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: render.h:33
#define MUTT_FORMAT_INDEX
This is a main index entry.
Definition: render.h:38
#define MUTT_FORMAT_TREE
Draw the thread tree.
Definition: render.h:35
#define MUTT_FORMAT_PLAIN
Do not prepend DISP_TO, DISP_CC ...
Definition: render.h:39
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: render.h:32
#define ASSERT(COND)
Definition: signal2.h:58
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:134
Assorted sorting methods.
#define NONULL(x)
Definition: string2.h:37
An email address.
Definition: address.h:36
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
LOFF_T length
length (in bytes) of attachment
Definition: body.h:53
String manipulation buffer.
Definition: buffer.h:36
size_t dsize
Length of data.
Definition: buffer.h:39
char * data
Pointer to data.
Definition: buffer.h:37
The envelope/body of an email.
Definition: email.h:39
bool read
Email is read.
Definition: email.h:50
unsigned int zminutes
Minutes away from UTC.
Definition: email.h:57
bool recip_valid
Is_recipient is valid.
Definition: email.h:107
struct Envelope * env
Envelope information.
Definition: email.h:68
bool collapsed
Is this message part of a collapsed thread?
Definition: email.h:123
int lines
How many lines in the body of this message?
Definition: email.h:62
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:43
struct Body * body
List of MIME parts.
Definition: email.h:69
char * tree
Character string to print thread tree.
Definition: email.h:128
bool old
Email is seen, but unread.
Definition: email.h:49
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
Definition: email.h:126
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:58
bool attach_del
Has an attachment marked for deletion.
Definition: email.h:102
bool flagged
Marked important?
Definition: email.h:47
unsigned int zhours
Hours away from UTC.
Definition: email.h:56
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:60
bool replied
Email has been replied to.
Definition: email.h:51
struct TagList tags
For drivers that support server tagging.
Definition: email.h:72
int score
Message score.
Definition: email.h:116
int msgno
Number displayed to the user.
Definition: email.h:114
bool deleted
Email is deleted.
Definition: email.h:78
short recipient
User_is_recipient()'s return value, cached.
Definition: email.h:119
bool tagged
Email is tagged.
Definition: email.h:110
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:61
struct MuttThread * thread
Thread of Emails.
Definition: email.h:122
The header of an Email.
Definition: envelope.h:57
char *const subject
Email's subject.
Definition: envelope.h:70
struct AddressList to
Email's 'To' list.
Definition: envelope.h:60
struct AddressList reply_to
Email's 'reply-to'.
Definition: envelope.h:64
char * message_id
Message ID.
Definition: envelope.h:73
char * x_comment_to
List of 'X-comment-to' fields.
Definition: envelope.h:81
char * newsgroups
List of newsgroups.
Definition: envelope.h:78
struct AddressList cc
Email's 'Cc' list.
Definition: envelope.h:61
struct Buffer spam
Spam header.
Definition: envelope.h:82
struct AddressList bcc
Email's 'Bcc' list.
Definition: envelope.h:62
char * organization
Organisation header.
Definition: envelope.h:77
char * x_label
X-Label.
Definition: envelope.h:76
char * disp_subj
Display subject (modified copy of subject)
Definition: envelope.h:72
struct AddressList from
Email's 'From' list.
Definition: envelope.h:59
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
struct ExpandoNode * node
Parsed tree.
Definition: expando.h:43
Data passed to index_format_str()
Definition: hdrline.c:71
struct Email * email
Current Email.
Definition: hdrline.c:74
int msg_in_pager
Index of Email displayed in the Pager.
Definition: hdrline.c:73
struct Mailbox * mailbox
Current Mailbox.
Definition: hdrline.c:72
const char * pager_progress
String representing Pager position through Email.
Definition: hdrline.c:75
A mailbox.
Definition: mailbox.h:79
int msg_count
Total number of messages.
Definition: mailbox.h:88
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
Multibyte character table.
Definition: mbtable.h:36
int len
Number of characters.
Definition: mbtable.h:38
char ** chars
The array of multibyte character strings.
Definition: mbtable.h:39
A local copy of an email.
Definition: message.h:34
FILE * fp
pointer to the message data
Definition: message.h:35
struct Message::@0 flags
Flags for the Message.
struct MuttThread * parent
Parent of this Thread.
Definition: thread.h:44
struct MuttThread * prev
Previous sibling Thread.
Definition: thread.h:47
struct Email * message
Email this Thread refers to.
Definition: thread.h:49
Container for Accounts, Notifications.
Definition: neomutt.h:42
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
bool subjrx_apply_mods(struct Envelope *env)
Apply regex modifications to the subject.
Definition: subjectrx.c:133
Subject Regex handling.
struct HashTable * TagFormats
Hash Table: "inbox" -> "GI" - Tag format strings.
Definition: tags.c:42
void driver_tags_get_transformed(struct TagList *tl, struct Buffer *tags)
Get transformed tags separated by space.
Definition: tags.c:152
void driver_tags_get_transformed_for(struct TagList *tl, const char *name, struct Buffer *tags)
Get transformed tags for a tag name separated by space.
Definition: tags.c:187