NeoMutt  2024-04-16-36-g75b6fb
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 <assert.h>
40#include <stdbool.h>
41#include <stdio.h>
42#include <string.h>
43#include <time.h>
44#include "mutt/lib.h"
45#include "address/lib.h"
46#include "config/lib.h"
47#include "email/lib.h"
48#include "core/lib.h"
49#include "alias/lib.h"
50#include "hdrline.h"
51#include "attach/lib.h"
52#include "color/lib.h"
53#include "expando/lib.h"
54#include "ncrypt/lib.h"
55#include "hook.h"
56#include "maillist.h"
57#include "mutt_thread.h"
58#include "muttlib.h"
59#include "mx.h"
60#include "sort.h"
61#include "subjectrx.h"
62#ifdef USE_NOTMUCH
63#include "notmuch/lib.h"
64#endif
65
67
72{
73 struct Mailbox *mailbox;
75 struct Email *email;
76 const char *pager_progress;
77};
78
85{
92};
93
102static const char *make_from_prefix(enum FieldType disp)
103{
104 /* need 2 bytes at the end, one for the space, another for NUL */
105 static char padded[8];
106 static const char *long_prefixes[DISP_MAX] = {
107 [DISP_TO] = "To ", [DISP_CC] = "Cc ", [DISP_BCC] = "Bcc ",
108 [DISP_FROM] = "", [DISP_PLAIN] = "",
109 };
110
111 const struct MbTable *c_from_chars = cs_subset_mbtable(NeoMutt->sub, "from_chars");
112
113 if (!c_from_chars || !c_from_chars->chars || (c_from_chars->len == 0))
114 return long_prefixes[disp];
115
116 const char *pchar = mbtable_get_nth_wchar(c_from_chars, disp);
117 if (mutt_str_len(pchar) == 0)
118 return "";
119
120 snprintf(padded, sizeof(padded), "%s ", pchar);
121 return padded;
122}
123
138static void make_from(struct Envelope *env, char *buf, size_t buflen,
139 bool do_lists, MuttFormatFlags flags)
140{
141 if (!env || !buf)
142 return;
143
144 bool me;
145 enum FieldType disp;
146 struct AddressList *name = NULL;
147
149
150 if (do_lists || me)
151 {
152 if (check_for_mailing_list(&env->to, make_from_prefix(DISP_TO), buf, buflen))
153 return;
154 if (check_for_mailing_list(&env->cc, make_from_prefix(DISP_CC), buf, buflen))
155 return;
156 }
157
158 if (me && !TAILQ_EMPTY(&env->to))
159 {
160 disp = (flags & MUTT_FORMAT_PLAIN) ? DISP_PLAIN : DISP_TO;
161 name = &env->to;
162 }
163 else if (me && !TAILQ_EMPTY(&env->cc))
164 {
165 disp = DISP_CC;
166 name = &env->cc;
167 }
168 else if (me && !TAILQ_EMPTY(&env->bcc))
169 {
170 disp = DISP_BCC;
171 name = &env->bcc;
172 }
173 else if (!TAILQ_EMPTY(&env->from))
174 {
175 disp = DISP_FROM;
176 name = &env->from;
177 }
178 else
179 {
180 *buf = '\0';
181 return;
182 }
183
184 snprintf(buf, buflen, "%s%s", make_from_prefix(disp), mutt_get_name(TAILQ_FIRST(name)));
185}
186
194static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool do_lists)
195{
196 if (!env || !buf)
197 return;
198
199 bool me = mutt_addr_is_user(TAILQ_FIRST(&env->from));
200
201 if (do_lists || me)
202 {
203 if (check_for_mailing_list_addr(&env->to, buf, buflen))
204 return;
205 if (check_for_mailing_list_addr(&env->cc, buf, buflen))
206 return;
207 }
208
209 if (me && !TAILQ_EMPTY(&env->to))
210 snprintf(buf, buflen, "%s", buf_string(TAILQ_FIRST(&env->to)->mailbox));
211 else if (me && !TAILQ_EMPTY(&env->cc))
212 snprintf(buf, buflen, "%s", buf_string(TAILQ_FIRST(&env->cc)->mailbox));
213 else if (!TAILQ_EMPTY(&env->from))
214 mutt_str_copy(buf, buf_string(TAILQ_FIRST(&env->from)->mailbox), buflen);
215 else
216 *buf = '\0';
217}
218
224static bool user_in_addr(struct AddressList *al)
225{
226 struct Address *a = NULL;
227 TAILQ_FOREACH(a, al, entries)
228 if (mutt_addr_is_user(a))
229 return true;
230 return false;
231}
232
238static enum ToChars user_is_recipient(struct Email *e)
239{
240 if (!e || !e->env)
242
243 struct Envelope *env = e->env;
244
245 if (!e->recip_valid)
246 {
247 e->recip_valid = true;
248
250 {
252 }
253 else if (user_in_addr(&env->to))
254 {
255 if (TAILQ_NEXT(TAILQ_FIRST(&env->to), entries) || !TAILQ_EMPTY(&env->cc))
256 e->recipient = FLAG_CHAR_TO_TO; /* non-unique recipient */
257 else
258 e->recipient = FLAG_CHAR_TO_UNIQUE; /* unique recipient */
259 }
260 else if (user_in_addr(&env->cc))
261 {
263 }
264 else if (check_for_mailing_list(&env->to, NULL, NULL, 0))
265 {
267 }
268 else if (check_for_mailing_list(&env->cc, NULL, NULL, 0))
269 {
271 }
272 else if (user_in_addr(&env->reply_to))
273 {
275 }
276 else
277 {
279 }
280 }
281
282 return e->recipient;
283}
284
290static bool thread_is_new(struct Email *e)
291{
292 return e->collapsed && (e->num_hidden > 1) && (mutt_thread_contains_unread(e) == 1);
293}
294
300static bool thread_is_old(struct Email *e)
301{
302 return e->collapsed && (e->num_hidden > 1) && (mutt_thread_contains_unread(e) == 2);
303}
304
308long index_date_recv_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
309{
310 const struct HdrFormatInfo *hfi = data;
311 const struct Email *e = hfi->email;
312 if (!e)
313 return 0;
314
315 return e->received;
316}
317
321void index_date_recv_local(const struct ExpandoNode *node, void *data,
322 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
323{
324 const struct HdrFormatInfo *hfi = data;
325 const struct Email *e = hfi->email;
326 if (!e)
327 return;
328
329 struct tm tm = mutt_date_localtime(e->received);
330
331 char tmp[128] = { 0 };
332 char tmp2[128] = { 0 };
333
334 int len = node->end - node->start;
335 const char *start = node->start;
336
337 bool use_c_locale = false;
338 if (*start == '!')
339 {
340 use_c_locale = true;
341 start++;
342 len--;
343 }
344 assert(len < sizeof(tmp2));
345 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
346
347 if (use_c_locale)
348 {
349 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
350 }
351 else
352 {
353 strftime(tmp, sizeof(tmp), tmp2, &tm);
354 }
355
356 if (flags & MUTT_FORMAT_INDEX)
358 buf_strcpy(buf, tmp);
359}
360
364long index_date_local_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
365{
366 const struct HdrFormatInfo *hfi = data;
367 const struct Email *e = hfi->email;
368 if (!e)
369 return 0;
370
371 return e->date_sent;
372}
373
377void index_date_local(const struct ExpandoNode *node, void *data,
378 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
379{
380 const struct HdrFormatInfo *hfi = data;
381 const struct Email *e = hfi->email;
382 if (!e)
383 return;
384
385 struct tm tm = mutt_date_localtime(e->date_sent);
386
387 char tmp[128] = { 0 };
388 char tmp2[128] = { 0 };
389
390 int len = node->end - node->start;
391 const char *start = node->start;
392
393 bool use_c_locale = false;
394 if (*start == '!')
395 {
396 use_c_locale = true;
397 start++;
398 len--;
399 }
400 assert(len < sizeof(tmp2));
401 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
402
403 if (use_c_locale)
404 {
405 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
406 }
407 else
408 {
409 strftime(tmp, sizeof(tmp), tmp2, &tm);
410 }
411
412 if (flags & MUTT_FORMAT_INDEX)
414 buf_strcpy(buf, tmp);
415}
416
420long index_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
421{
422 const struct HdrFormatInfo *hfi = data;
423 const struct Email *e = hfi->email;
424 if (!e)
425 return 0;
426
427 return e->date_sent;
428}
429
433void index_date(const struct ExpandoNode *node, void *data,
434 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
435{
436 const struct HdrFormatInfo *hfi = data;
437 const struct Email *e = hfi->email;
438 if (!e)
439 return;
440
441 time_t now = e->date_sent;
442 if (e->zoccident)
443 now -= (e->zhours * 3600 + e->zminutes * 60);
444 else
445 now += (e->zhours * 3600 + e->zminutes * 60);
446
447 struct tm tm = mutt_date_gmtime(now);
448
449 char tmp[128] = { 0 };
450 char tmp2[128] = { 0 };
451
452 int len = node->end - node->start;
453 const char *start = node->start;
454
455 bool use_c_locale = false;
456 if (*start == '!')
457 {
458 use_c_locale = true;
459 start++;
460 len--;
461 }
462 assert(len < sizeof(tmp2));
463 mutt_strn_copy(tmp2, start, len, sizeof(tmp2));
464
465 if (use_c_locale)
466 {
467 strftime_l(tmp, sizeof(tmp), tmp2, &tm, NeoMutt->time_c_locale);
468 }
469 else
470 {
471 strftime(tmp, sizeof(tmp), tmp2, &tm);
472 }
473
474 if (flags & MUTT_FORMAT_INDEX)
476 buf_strcpy(buf, tmp);
477}
478
482void index_format_hook(const struct ExpandoNode *node, void *data,
483 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
484{
485 const struct HdrFormatInfo *hfi = data;
486 struct Email *e = hfi->email;
487 if (!e)
488 return;
489
490 struct Mailbox *m = hfi->mailbox;
491
492 char tmp[128] = { 0 };
493 const int len = node->end - node->start;
494
495 mutt_strn_copy(tmp, node->start, len, sizeof(tmp));
496
497 const struct Expando *exp = mutt_idxfmt_hook(tmp, m, e);
498 if (!exp)
499 return;
500
502}
503
507void index_a(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
508 int max_cols, struct Buffer *buf)
509{
510 const struct HdrFormatInfo *hfi = data;
511 const struct Email *e = hfi->email;
512 if (!e || !e->env)
513 return;
514
515 const struct Address *from = TAILQ_FIRST(&e->env->from);
516
517 const char *s = NULL;
518 if (from && from->mailbox)
519 {
520 s = mutt_addr_for_display(from);
521 }
522
523 if (flags & MUTT_FORMAT_INDEX)
525 buf_strcpy(buf, s);
526}
527
531void index_A(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
532 int max_cols, struct Buffer *buf)
533{
534 const struct HdrFormatInfo *hfi = data;
535 const struct Email *e = hfi->email;
536 if (!e || !e->env)
537 return;
538
539 const struct Address *reply_to = TAILQ_FIRST(&e->env->reply_to);
540
541 if (reply_to && reply_to->mailbox)
542 {
543 if (flags & MUTT_FORMAT_INDEX)
545 const char *s = mutt_addr_for_display(reply_to);
546 buf_strcpy(buf, s);
547 return;
548 }
549
550 index_a(node, data, flags, max_cols, buf);
551}
552
556void index_b(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
557 int max_cols, struct Buffer *buf)
558{
559 const struct HdrFormatInfo *hfi = data;
560 struct Mailbox *m = hfi->mailbox;
561 if (!m)
562 {
563 buf_addstr(buf, "(null)");
564 return;
565 }
566
567 char *p = NULL;
568
569#ifdef USE_NOTMUCH
570 struct Email *e = hfi->email;
571 if (m->type == MUTT_NOTMUCH)
572 {
574 }
575#endif
576 if (!p)
577 {
578 p = strrchr(mailbox_path(m), '/');
579 if (p)
580 {
581 p++;
582 }
583 }
584 buf_addstr(buf, p ? p : mailbox_path(m));
585}
586
590void index_B(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
591 int max_cols, struct Buffer *buf)
592{
593 const struct HdrFormatInfo *hfi = data;
594 const struct Email *e = hfi->email;
595 if (!e || !e->env)
596 return;
597
598 char tmp[128] = { 0 };
599
600 if (first_mailing_list(tmp, sizeof(tmp), &e->env->to) ||
601 first_mailing_list(tmp, sizeof(tmp), &e->env->cc))
602 {
603 buf_strcpy(buf, tmp);
604 return;
605 }
606
607 index_b(node, data, flags, max_cols, buf);
608}
609
613long index_c_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
614{
615 const struct HdrFormatInfo *hfi = data;
616 const struct Email *e = hfi->email;
617 if (!e || !e->body)
618 return 0;
619
620 return e->body->length;
621}
622
626void index_c(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
627 int max_cols, struct Buffer *buf)
628{
629 const struct HdrFormatInfo *hfi = data;
630 const struct Email *e = hfi->email;
631 if (!e)
632 return;
633
634 char tmp[128] = { 0 };
635
636 if (flags & MUTT_FORMAT_INDEX)
638
639 mutt_str_pretty_size(tmp, sizeof(tmp), e->body->length);
640 buf_strcpy(buf, tmp);
641}
642
646void index_cr(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
647 int max_cols, struct Buffer *buf)
648{
649 const struct HdrFormatInfo *hfi = (const struct HdrFormatInfo *) data;
650 const struct Email *e = hfi->email;
651 if (!e)
652 return;
653
654 char tmp[128] = { 0 };
655
656 if (flags & MUTT_FORMAT_INDEX)
658
659 mutt_str_pretty_size(tmp, sizeof(tmp), email_size(e));
660 buf_strcpy(buf, tmp);
661}
662
666long index_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
667{
668 const struct HdrFormatInfo *hfi = data;
669 const struct Email *e = hfi->email;
670 if (!e)
671 return 0;
672
673 if (flags & MUTT_FORMAT_INDEX)
675
676 return e->msgno + 1;
677}
678
682long index_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
683{
684 const struct HdrFormatInfo *hfi = data;
685 const struct Email *e = hfi->email;
686 if (!e)
687 return 0;
688
689 return e->date_sent;
690}
691
695void index_d(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
696 int max_cols, struct Buffer *buf)
697{
698 const struct HdrFormatInfo *hfi = data;
699 const struct Email *e = hfi->email;
700 if (!e)
701 return;
702
703 const char *c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
704 const char *cp = NONULL(c_date_format);
705 bool use_c_locale = false;
706 if (*cp == '!')
707 {
708 use_c_locale = true;
709 cp++;
710 }
711
712 /* restore sender's time zone */
713 time_t now = e->date_sent;
714 if (e->zoccident)
715 now -= (e->zhours * 3600 + e->zminutes * 60);
716 else
717 now += (e->zhours * 3600 + e->zminutes * 60);
718
719 struct tm tm = mutt_date_gmtime(now);
720 char tmp[128] = { 0 };
721
722 if (use_c_locale)
723 {
724 strftime_l(tmp, sizeof(tmp), cp, &tm, NeoMutt->time_c_locale);
725 }
726 else
727 {
728 strftime(tmp, sizeof(tmp), cp, &tm);
729 }
730
731 if (flags & MUTT_FORMAT_INDEX)
733
734 buf_strcpy(buf, tmp);
735}
736
740long index_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
741{
742 const struct HdrFormatInfo *hfi = data;
743 const struct Email *e = hfi->email;
744 if (!e)
745 return 0;
746
747 return e->date_sent;
748}
749
753void index_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
754 int max_cols, struct Buffer *buf)
755{
756 const struct HdrFormatInfo *hfi = data;
757 const struct Email *e = hfi->email;
758 if (!e)
759 return;
760
761 const char *c_date_format = cs_subset_string(NeoMutt->sub, "date_format");
762 const char *cp = NONULL(c_date_format);
763 bool use_c_locale = false;
764 if (*cp == '!')
765 {
766 use_c_locale = true;
767 cp++;
768 }
769
770 struct tm tm = mutt_date_localtime(e->date_sent);
771 char tmp[128] = { 0 };
772
773 if (use_c_locale)
774 {
775 strftime_l(tmp, sizeof(tmp), cp, &tm, NeoMutt->time_c_locale);
776 }
777 else
778 {
779 strftime(tmp, sizeof(tmp), cp, &tm);
780 }
781
782 if (flags & MUTT_FORMAT_INDEX)
784
785 buf_strcpy(buf, tmp);
786}
787
791long index_e_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
792{
793 const struct HdrFormatInfo *hfi = data;
794 struct Email *e = hfi->email;
795 struct Mailbox *m = hfi->mailbox;
796
798}
799
803long index_E_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
804{
805 const struct HdrFormatInfo *hfi = data;
806 struct Email *e = hfi->email;
807 struct Mailbox *m = hfi->mailbox;
808
810}
811
815void index_f(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
816 int max_cols, struct Buffer *buf)
817{
818 const struct HdrFormatInfo *hfi = data;
819 struct Email *e = hfi->email;
820 if (!e || !e->env)
821 return;
822
823 mutt_addrlist_write(&e->env->from, buf, true);
824}
825
829void index_F(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
830 int max_cols, struct Buffer *buf)
831{
832 const struct HdrFormatInfo *hfi = data;
833 struct Email *e = hfi->email;
834 if (!e || !e->env)
835 return;
836
837 char tmp[128] = { 0 };
838
839 make_from(e->env, tmp, sizeof(tmp), false, MUTT_FORMAT_NO_FLAGS);
840
841 if (flags & MUTT_FORMAT_INDEX)
843
844 buf_strcpy(buf, tmp);
845}
846
850void index_Fp(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
851 int max_cols, struct Buffer *buf)
852{
853 const struct HdrFormatInfo *hfi = (const struct HdrFormatInfo *) data;
854 struct Email *e = hfi->email;
855 if (!e || !e->env)
856 return;
857
858 char tmp[128] = { 0 };
859
860 if (flags & MUTT_FORMAT_INDEX)
862
863 make_from(e->env, tmp, sizeof(tmp), false, MUTT_FORMAT_PLAIN);
864
865 buf_strcpy(buf, tmp);
866}
867
871void index_g(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
872 int max_cols, struct Buffer *buf)
873{
874 const struct HdrFormatInfo *hfi = data;
875 struct Email *e = hfi->email;
876 if (!e)
877 return;
878
879 if (flags & MUTT_FORMAT_INDEX)
882}
883
887void index_G(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
888 int max_cols, struct Buffer *buf)
889{
890 const struct HdrFormatInfo *hfi = data;
891 struct Email *e = hfi->email;
892 if (!e)
893 return;
894
895 char tag_format[3] = { 0 };
896
897 tag_format[0] = 'G';
898 tag_format[1] = node->start[1];
899 tag_format[2] = '\0';
900
901 char *tag = mutt_hash_find(TagFormats, tag_format);
902 if (!tag)
903 return;
904
905 if (flags & MUTT_FORMAT_INDEX)
908}
909
913void index_H(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
914 int max_cols, struct Buffer *buf)
915{
916 const struct HdrFormatInfo *hfi = data;
917 struct Email *e = hfi->email;
918 if (!e || !e->env)
919 return;
920
921 buf_copy(buf, &e->env->spam);
922}
923
927void index_i(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
928 int max_cols, struct Buffer *buf)
929{
930 const struct HdrFormatInfo *hfi = data;
931 struct Email *e = hfi->email;
932 if (!e || !e->env)
933 return;
934
935 const char *s = e->env->message_id ? e->env->message_id : "<no.id>";
936 buf_strcpy(buf, s);
937}
938
942void index_I(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
943 int max_cols, struct Buffer *buf)
944{
945 const struct HdrFormatInfo *hfi = data;
946 const struct Email *e = hfi->email;
947 if (!e || !e->env)
948 return;
949
950 const struct Address *from = TAILQ_FIRST(&e->env->from);
951
952 char tmp[128] = { 0 };
953
954 if (mutt_mb_get_initials(mutt_get_name(from), tmp, sizeof(tmp)))
955 {
956 if (flags & MUTT_FORMAT_INDEX)
958
959 buf_strcpy(buf, tmp);
960 return;
961 }
962
963 index_a(node, data, flags, max_cols, buf);
964}
965
969void index_J(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
970 int max_cols, struct Buffer *buf)
971{
972 const struct HdrFormatInfo *hfi = data;
973 struct Email *e = hfi->email;
974 if (!e)
975 return;
976
977 bool have_tags = true;
978 struct Buffer *tags = buf_pool_get();
980 if (!buf_is_empty(tags))
981 {
982 if (flags & MUTT_FORMAT_TREE)
983 {
984 struct Buffer *parent_tags = buf_pool_get();
985 if (e->thread->prev && e->thread->prev->message)
986 {
988 }
989 if (!parent_tags && e->thread->parent && e->thread->parent->message)
990 {
992 }
993 if (parent_tags && buf_istr_equal(tags, parent_tags))
994 have_tags = false;
995 buf_pool_release(&parent_tags);
996 }
997 }
998 else
999 {
1000 have_tags = false;
1001 }
1002
1003 if (flags & MUTT_FORMAT_INDEX)
1005
1006 const char *s = have_tags ? buf_string(tags) : "";
1007 buf_strcpy(buf, s);
1008
1009 buf_pool_release(&tags);
1010}
1011
1015void index_K(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1016 int max_cols, struct Buffer *buf)
1017{
1018 const struct HdrFormatInfo *hfi = data;
1019 const struct Email *e = hfi->email;
1020 if (!e || !e->env)
1021 return;
1022
1023 char tmp[128] = { 0 };
1024
1025 if (first_mailing_list(tmp, sizeof(tmp), &e->env->to) ||
1026 first_mailing_list(tmp, sizeof(tmp), &e->env->cc))
1027 {
1028 buf_strcpy(buf, tmp);
1029 }
1030}
1031
1035long index_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1036{
1037 const struct HdrFormatInfo *hfi = data;
1038 const struct Email *e = hfi->email;
1039 if (!e)
1040 return 0;
1041
1042 if (flags & MUTT_FORMAT_INDEX)
1044
1045 return e->lines;
1046}
1047
1051void index_L(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1052 int max_cols, struct Buffer *buf)
1053{
1054 const struct HdrFormatInfo *hfi = data;
1055 const struct Email *e = hfi->email;
1056 if (!e)
1057 return;
1058
1059 char tmp[128] = { 0 };
1060
1061 make_from(e->env, tmp, sizeof(tmp), true, flags);
1062
1063 if (flags & MUTT_FORMAT_INDEX)
1065 buf_strcpy(buf, tmp);
1066}
1067
1071long index_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1072{
1073 const struct HdrFormatInfo *hfi = data;
1074 const struct Mailbox *m = hfi->mailbox;
1075
1076 if (m)
1077 return m->msg_count;
1078
1079 return 0;
1080}
1081
1085void index_M(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1086 int max_cols, struct Buffer *buf)
1087{
1088 const struct HdrFormatInfo *hfi = data;
1089 const struct Email *e = hfi->email;
1090 if (!e)
1091 return;
1092
1093 const bool threads = mutt_using_threads();
1094 const bool is_index = (flags & MUTT_FORMAT_INDEX) != 0;
1095
1096 if (threads && is_index && e->collapsed && (e->num_hidden > 1))
1097 {
1098 if (flags & MUTT_FORMAT_INDEX)
1100 const int num = e->num_hidden;
1101 buf_printf(buf, "%d", num);
1102 }
1103 else if (is_index && threads)
1104 {
1105 if (flags & MUTT_FORMAT_INDEX)
1107 const char *s = " ";
1108 buf_strcpy(buf, s);
1109 }
1110}
1111
1115long index_M_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1116{
1117 const struct HdrFormatInfo *hfi = data;
1118 const struct Email *e = hfi->email;
1119 if (!e)
1120 return 0;
1121
1122 const bool threads = mutt_using_threads();
1123 const bool is_index = (flags & MUTT_FORMAT_INDEX) != 0;
1124
1125 if (threads && is_index && e->collapsed && (e->num_hidden > 1))
1126 {
1127 if (flags & MUTT_FORMAT_INDEX)
1129 return e->num_hidden;
1130 }
1131
1132 return 0;
1133}
1134
1138void index_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1139 int max_cols, struct Buffer *buf)
1140{
1141 const struct HdrFormatInfo *hfi = data;
1142 const struct Email *e = hfi->email;
1143 if (!e || !e->env)
1144 return;
1145
1146 const struct Address *from = TAILQ_FIRST(&e->env->from);
1147
1148 if (flags & MUTT_FORMAT_INDEX)
1150
1151 const char *s = mutt_get_name(from);
1152 buf_strcpy(buf, s);
1153}
1154
1158long index_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1159{
1160 const struct HdrFormatInfo *hfi = data;
1161 const struct Email *e = hfi->email;
1162 if (!e)
1163 return 0;
1164
1165 return e->score;
1166}
1167
1171void index_O(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1172 int max_cols, struct Buffer *buf)
1173{
1174 const struct HdrFormatInfo *hfi = data;
1175 const struct Email *e = hfi->email;
1176 if (!e || !e->env)
1177 return;
1178
1179 char tmp[128] = { 0 };
1180 char *p = NULL;
1181
1182 make_from_addr(e->env, tmp, sizeof(tmp), true);
1183 const bool c_save_address = cs_subset_bool(NeoMutt->sub, "save_address");
1184 if (!c_save_address && (p = strpbrk(tmp, "%@")))
1185 {
1186 *p = '\0';
1187 }
1188
1189 buf_strcpy(buf, tmp);
1190}
1191
1195void index_P(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1196 int max_cols, struct Buffer *buf)
1197{
1198 const struct HdrFormatInfo *hfi = data;
1199
1200 const char *s = hfi->pager_progress;
1201 buf_strcpy(buf, s);
1202}
1203
1207void index_q(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1208 int max_cols, struct Buffer *buf)
1209{
1210 const struct HdrFormatInfo *hfi = data;
1211 const struct Email *e = hfi->email;
1212 if (!e || !e->env)
1213 return;
1214
1215 const char *s = e->env->newsgroups;
1216 buf_strcpy(buf, s);
1217}
1218
1222void index_r(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1223 int max_cols, struct Buffer *buf)
1224{
1225 const struct HdrFormatInfo *hfi = data;
1226 const struct Email *e = hfi->email;
1227 if (!e || !e->env)
1228 return;
1229
1230 mutt_addrlist_write(&e->env->to, buf, true);
1231}
1232
1236void index_R(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1237 int max_cols, struct Buffer *buf)
1238{
1239 const struct HdrFormatInfo *hfi = data;
1240 const struct Email *e = hfi->email;
1241 if (!e || !e->env)
1242 return;
1243
1244 mutt_addrlist_write(&e->env->cc, buf, true);
1245}
1246
1250void index_s(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1251 int max_cols, struct Buffer *buf)
1252{
1253 const struct HdrFormatInfo *hfi = data;
1254 const struct Email *e = hfi->email;
1255 if (!e || !e->env)
1256 return;
1257
1258 if ((flags & MUTT_FORMAT_TREE) && !e->collapsed && !(flags & MUTT_FORMAT_FORCESUBJ))
1259 return;
1260
1261 if (flags & MUTT_FORMAT_INDEX)
1263
1265
1266 if (e->env->disp_subj)
1267 buf_strcpy(buf, e->env->disp_subj);
1268 else
1269 buf_strcpy(buf, e->env->subject);
1270}
1271
1275void index_S(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1276 int max_cols, struct Buffer *buf)
1277{
1278 const struct HdrFormatInfo *hfi = data;
1279 const struct Email *e = hfi->email;
1280 if (!e)
1281 return;
1282
1283 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1284 const int msg_in_pager = hfi->msg_in_pager;
1285
1286 const char *wch = NULL;
1287 if (e->deleted)
1288 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1289 else if (e->attach_del)
1291 else if (e->tagged)
1292 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1293 else if (e->flagged)
1294 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1295 else if (e->replied)
1296 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1297 else if (e->read && (msg_in_pager != e->msgno))
1298 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_SEMPTY);
1299 else if (e->old)
1300 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1301 else
1302 wch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1303
1304 if (flags & MUTT_FORMAT_INDEX)
1306
1307 buf_strcpy(buf, wch);
1308}
1309
1313void index_t(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1314 int max_cols, struct Buffer *buf)
1315{
1316 const struct HdrFormatInfo *hfi = data;
1317 const struct Email *e = hfi->email;
1318 if (!e || !e->env)
1319 return;
1320
1321 const struct Address *to = TAILQ_FIRST(&e->env->to);
1322 const struct Address *cc = TAILQ_FIRST(&e->env->cc);
1323
1324 char tmp[128] = { 0 };
1325
1326 if (!check_for_mailing_list(&e->env->to, "To ", tmp, sizeof(tmp)) &&
1327 !check_for_mailing_list(&e->env->cc, "Cc ", tmp, sizeof(tmp)))
1328 {
1329 if (to)
1330 snprintf(tmp, sizeof(tmp), "To %s", mutt_get_name(to));
1331 else if (cc)
1332 snprintf(tmp, sizeof(tmp), "Cc %s", mutt_get_name(cc));
1333 else
1334 {
1335 tmp[0] = '\0';
1336 }
1337 }
1338
1339 buf_strcpy(buf, tmp);
1340}
1341
1345void index_T(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1346 int max_cols, struct Buffer *buf)
1347{
1348 const struct HdrFormatInfo *hfi = data;
1349 struct Email *e = hfi->email;
1350 if (!e)
1351 return;
1352
1353 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1354
1355 int i;
1356 const char *s = (c_to_chars && ((i = user_is_recipient(e))) < c_to_chars->len) ?
1357 c_to_chars->chars[i] :
1358 " ";
1359
1360 buf_strcpy(buf, s);
1361}
1362
1366void index_tree(const struct ExpandoNode *node, void *data,
1367 MuttFormatFlags flags, int max_cols, struct Buffer *buf)
1368{
1369 const struct HdrFormatInfo *hfi = data;
1370 const struct Email *e = hfi->email;
1371 if (!e || !e->env)
1372 return;
1373
1374 if (!(flags & MUTT_FORMAT_TREE) || e->collapsed)
1375 return;
1376
1378 node_expando_set_has_tree(node, true);
1379 buf_strcpy(buf, e->tree);
1380}
1381
1385void index_u(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1386 int max_cols, struct Buffer *buf)
1387{
1388 const struct HdrFormatInfo *hfi = data;
1389 const struct Email *e = hfi->email;
1390 if (!e || !e->env)
1391 return;
1392
1393 const struct Address *from = TAILQ_FIRST(&e->env->from);
1394 if (!from || !from->mailbox)
1395 return;
1396
1397 char tmp[128] = { 0 };
1398 char *p = NULL;
1399
1400 mutt_str_copy(tmp, mutt_addr_for_display(from), sizeof(tmp));
1401 p = strpbrk(tmp, "%@");
1402 if (p)
1403 {
1404 *p = '\0';
1405 }
1406
1407 buf_strcpy(buf, tmp);
1408}
1409
1413void index_v(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1414 int max_cols, struct Buffer *buf)
1415{
1416 const struct HdrFormatInfo *hfi = data;
1417 const struct Email *e = hfi->email;
1418 if (!e || !e->env)
1419 return;
1420
1421 const struct Address *from = TAILQ_FIRST(&e->env->from);
1422 const struct Address *to = TAILQ_FIRST(&e->env->to);
1423 const struct Address *cc = TAILQ_FIRST(&e->env->cc);
1424
1425 char tmp[128] = { 0 };
1426 char *p = NULL;
1427
1428 if (mutt_addr_is_user(from))
1429 {
1430 if (to)
1431 {
1432 const char *s = mutt_get_name(to);
1433 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1434 }
1435 else if (cc)
1436 {
1437 const char *s = mutt_get_name(cc);
1438 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1439 }
1440 }
1441 else
1442 {
1443 const char *s = mutt_get_name(from);
1444 mutt_str_copy(tmp, NONULL(s), sizeof(tmp));
1445 }
1446 p = strpbrk(tmp, " %@");
1447 if (p)
1448 {
1449 *p = '\0';
1450 }
1451
1452 buf_strcpy(buf, tmp);
1453}
1454
1458void index_W(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1459 int max_cols, struct Buffer *buf)
1460{
1461 const struct HdrFormatInfo *hfi = data;
1462 const struct Email *e = hfi->email;
1463 if (!e || !e->env)
1464 return;
1465
1466 const char *s = e->env->organization;
1467 buf_strcpy(buf, s);
1468}
1469
1473void index_x(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1474 int max_cols, struct Buffer *buf)
1475{
1476 const struct HdrFormatInfo *hfi = data;
1477 const struct Email *e = hfi->email;
1478 if (!e || !e->env)
1479 return;
1480
1481 const char *s = e->env->x_comment_to;
1482 buf_strcpy(buf, s);
1483}
1484
1488long index_X_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
1489{
1490 const struct HdrFormatInfo *hfi = data;
1491 struct Email *e = hfi->email;
1492 if (!e)
1493 return 0;
1494
1495 struct Mailbox *m = hfi->mailbox;
1496
1497 struct Message *msg = mx_msg_open(m, e);
1498 if (!msg)
1499 return 0;
1500
1501 const int num = mutt_count_body_parts(m, e, msg->fp);
1502 mx_msg_close(m, &msg);
1503 return num;
1504}
1505
1509void index_y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1510 int max_cols, struct Buffer *buf)
1511{
1512 const struct HdrFormatInfo *hfi = data;
1513 const struct Email *e = hfi->email;
1514 if (!e || !e->env)
1515 return;
1516
1517 if (flags & MUTT_FORMAT_INDEX)
1519
1520 const char *s = e->env->x_label;
1521 buf_strcpy(buf, s);
1522}
1523
1527void index_Y(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1528 int max_cols, struct Buffer *buf)
1529{
1530 const struct HdrFormatInfo *hfi = data;
1531 const struct Email *e = hfi->email;
1532 if (!e || !e->env)
1533 return;
1534
1535 bool label = true;
1536 if (e->env->x_label)
1537 {
1538 struct Email *e_tmp = NULL;
1539 if (flags & MUTT_FORMAT_TREE && (e->thread->prev && e->thread->prev->message &&
1540 e->thread->prev->message->env->x_label))
1541 {
1542 e_tmp = e->thread->prev->message;
1543 }
1544 else if (flags & MUTT_FORMAT_TREE && (e->thread->parent && e->thread->parent->message &&
1546 {
1547 e_tmp = e->thread->parent->message;
1548 }
1549
1550 if (e_tmp && mutt_istr_equal(e->env->x_label, e_tmp->env->x_label))
1551 {
1552 label = false;
1553 }
1554 }
1555 else
1556 {
1557 label = false;
1558 }
1559
1560 if (flags & MUTT_FORMAT_INDEX)
1562
1563 if (label)
1564 {
1565 const char *s = e->env->x_label;
1566 buf_strcpy(buf, s);
1567 }
1568}
1569
1573void index_zc(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1574 int max_cols, struct Buffer *buf)
1575{
1576 const struct HdrFormatInfo *hfi = data;
1577 const struct Email *e = hfi->email;
1578 if (!e)
1579 return;
1580
1581 const struct MbTable *c_crypt_chars = cs_subset_mbtable(NeoMutt->sub, "crypt_chars");
1582
1583 const char *ch = NULL;
1584 if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1585 {
1587 }
1588 else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1589 {
1591 }
1592 else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1593 {
1594 ch = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_SIGNED);
1595 }
1596 else if (((WithCrypto & APPLICATION_PGP) != 0) && ((e->security & PGP_KEY) == PGP_KEY))
1597 {
1599 }
1600 else
1601 {
1603 }
1604
1605 if (flags & MUTT_FORMAT_INDEX)
1607 buf_strcpy(buf, ch);
1608}
1609
1613void index_zs(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1614 int max_cols, struct Buffer *buf)
1615{
1616 const struct HdrFormatInfo *hfi = data;
1617 struct Email *e = hfi->email;
1618 if (!e)
1619 return;
1620
1621 const bool threads = mutt_using_threads();
1622 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1623 const int msg_in_pager = hfi->msg_in_pager;
1624
1625 const char *ch = NULL;
1626 if (e->deleted)
1627 {
1628 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1629 }
1630 else if (e->attach_del)
1631 {
1633 }
1634 else if (threads && thread_is_new(e))
1635 {
1636 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW_THREAD);
1637 }
1638 else if (threads && thread_is_old(e))
1639 {
1640 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD_THREAD);
1641 }
1642 else if (e->read && (msg_in_pager != e->msgno))
1643 {
1644 if (e->replied)
1645 {
1646 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1647 }
1648 else
1649 {
1650 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_ZEMPTY);
1651 }
1652 }
1653 else
1654 {
1655 if (e->old)
1656 {
1657 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1658 }
1659 else
1660 {
1661 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1662 }
1663 }
1664
1665 if (flags & MUTT_FORMAT_INDEX)
1667 buf_strcpy(buf, ch);
1668}
1669
1673void index_zt(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1674 int max_cols, struct Buffer *buf)
1675{
1676 const struct HdrFormatInfo *hfi = data;
1677 struct Email *e = hfi->email;
1678 if (!e)
1679 return;
1680
1681 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1682 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1683
1684 const char *ch = NULL;
1685 if (e->tagged)
1686 {
1687 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1688 }
1689 else if (e->flagged)
1690 {
1691 ch = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1692 }
1693 else
1694 {
1695 ch = mbtable_get_nth_wchar(c_to_chars, user_is_recipient(e));
1696 }
1697
1698 if (flags & MUTT_FORMAT_INDEX)
1700 buf_strcpy(buf, ch);
1701}
1702
1706void index_Z(const struct ExpandoNode *node, void *data, MuttFormatFlags flags,
1707 int max_cols, struct Buffer *buf)
1708{
1709 const struct HdrFormatInfo *hfi = data;
1710 struct Email *e = hfi->email;
1711 if (!e)
1712 return;
1713
1714 const int msg_in_pager = hfi->msg_in_pager;
1715
1716 const struct MbTable *c_crypt_chars = cs_subset_mbtable(NeoMutt->sub, "crypt_chars");
1717 const struct MbTable *c_flag_chars = cs_subset_mbtable(NeoMutt->sub, "flag_chars");
1718 const struct MbTable *c_to_chars = cs_subset_mbtable(NeoMutt->sub, "to_chars");
1719 const bool threads = mutt_using_threads();
1720
1721 const char *first = NULL;
1722 if (threads && thread_is_new(e))
1723 {
1724 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW_THREAD);
1725 }
1726 else if (threads && thread_is_old(e))
1727 {
1728 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD_THREAD);
1729 }
1730 else if (e->read && (msg_in_pager != e->msgno))
1731 {
1732 if (e->replied)
1733 {
1734 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_REPLIED);
1735 }
1736 else
1737 {
1738 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_ZEMPTY);
1739 }
1740 }
1741 else
1742 {
1743 if (e->old)
1744 {
1745 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_OLD);
1746 }
1747 else
1748 {
1749 first = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_NEW);
1750 }
1751 }
1752
1753 /* Marked for deletion; deleted attachments; crypto */
1754 const char *second = NULL;
1755 if (e->deleted)
1756 second = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED);
1757 else if (e->attach_del)
1758 second = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_DELETED_ATTACH);
1759 else if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1760 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_GOOD_SIGN);
1761 else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1762 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_ENCRYPTED);
1763 else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1764 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_SIGNED);
1765 else if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & PGP_KEY))
1766 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_CONTAINS_KEY);
1767 else
1768 second = mbtable_get_nth_wchar(c_crypt_chars, FLAG_CHAR_CRYPT_NO_CRYPTO);
1769
1770 /* Tagged, flagged and recipient flag */
1771 const char *third = NULL;
1772 if (e->tagged)
1773 third = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_TAGGED);
1774 else if (e->flagged)
1775 third = mbtable_get_nth_wchar(c_flag_chars, FLAG_CHAR_IMPORTANT);
1776 else
1777 third = mbtable_get_nth_wchar(c_to_chars, user_is_recipient(e));
1778
1779 if (flags & MUTT_FORMAT_INDEX)
1781
1782 buf_printf(buf, "%s%s%s", first, second, third);
1783}
1784
1797int mutt_make_string(struct Buffer *buf, size_t max_cols,
1798 const struct Expando *exp, struct Mailbox *m, int inpgr,
1799 struct Email *e, MuttFormatFlags flags, const char *progress)
1800{
1801 if (!exp)
1802 return 0;
1803
1804 struct HdrFormatInfo hfi = { 0 };
1805
1806 hfi.email = e;
1807 hfi.mailbox = m;
1808 hfi.msg_in_pager = inpgr;
1809 hfi.pager_progress = progress;
1810
1811 return expando_render(exp, IndexRenderData, &hfi, flags, max_cols, buf);
1812}
1813
1819const struct ExpandoRenderData IndexRenderData[] = {
1820 // clang-format off
1823 { ED_ENVELOPE, ED_ENV_FROM, index_a, NULL },
1835 { ED_ENVELOPE, ED_ENV_SENDER, index_F, NULL },
1837 { ED_EMAIL, ED_EMA_TAGS, index_g, NULL },
1839 { ED_ENVELOPE, ED_ENV_SPAM, index_H, NULL },
1844 { ED_EMAIL, ED_EMA_FROM_LIST, index_L, NULL },
1845 { ED_EMAIL, ED_EMA_LINES, NULL, index_l_num },
1848 { ED_ENVELOPE, ED_ENV_NAME, index_n, NULL },
1849 { ED_EMAIL, ED_EMA_SCORE, NULL, index_N_num },
1853 { ED_ENVELOPE, ED_ENV_CC_ALL, index_R, NULL },
1854 { ED_ENVELOPE, ED_ENV_TO_ALL, index_r, NULL },
1857 { ED_ENVELOPE, ED_ENV_TO, index_t, NULL },
1858 { ED_EMAIL, ED_EMA_TO_CHARS, index_T, NULL },
1873 { -1, -1, NULL, NULL },
1874 // clang-format on
1875};
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:160
bool buf_istr_equal(const struct Buffer *a, const struct Buffer *b)
Return if two buffers are equal, case insensitive.
Definition: buffer.c:696
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:290
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:394
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:600
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:292
struct MbTable * cs_subset_mbtable(const struct ConfigSubset *sub, const char *name)
Get a Multibyte table config item by name.
Definition: helpers.c:120
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
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
Parse Expando string.
int expando_render(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
Definition: expando.c:109
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:308
long index_M_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of hidden messages - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1115
long index_C_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Index number - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:666
long index_m_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Total number of message - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1071
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:364
long index_D_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Local Date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:740
long index_c_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of bytes - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:613
long index_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Senders Date and time - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:682
long index_X_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of MIME attachments - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1488
long index_l_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of lines - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1035
long index_E_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Number of messages thread - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:803
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:420
long index_e_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Thread index number - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:791
long index_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Index: Message score - Implements ExpandoRenderData::get_number() -.
Definition: hdrline.c:1158
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:1138
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:1051
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:829
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:1673
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:1527
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:1573
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:590
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:1366
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:556
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:1313
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:871
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:695
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:626
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:321
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:1345
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:646
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:1207
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:850
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:942
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:1706
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:815
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:913
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:1613
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:531
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:507
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:1275
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:887
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:1413
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:1236
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:1385
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:482
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:377
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:1250
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:433
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:1473
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:1171
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:1222
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:927
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:1085
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:1015
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:753
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:969
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:1195
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:1509
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:1458
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:102
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:194
FieldType
Header types.
Definition: hdrline.c:85
@ DISP_PLAIN
Empty string.
Definition: hdrline.c:90
@ DISP_TO
To: string.
Definition: hdrline.c:86
@ DISP_CC
Cc: string.
Definition: hdrline.c:87
@ DISP_BCC
Bcc: string.
Definition: hdrline.c:88
@ DISP_MAX
Definition: hdrline.c:91
@ DISP_FROM
From: string.
Definition: hdrline.c:89
static bool thread_is_old(struct Email *e)
Does the email thread contain any unread emails?
Definition: hdrline.c:300
static enum ToChars user_is_recipient(struct Email *e)
Is the user a recipient of the message.
Definition: hdrline.c:238
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:138
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:1797
static bool thread_is_new(struct Email *e)
Does the email thread contain any new emails?
Definition: hdrline.c:290
static bool user_in_addr(struct AddressList *al)
Do any of the addresses refer to the user?
Definition: hdrline.c:224
const struct ExpandoRenderData IndexRenderData[]
Callbacks for Index Expandos.
Definition: hdrline.c:66
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:905
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
Definition: date.c:926
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:666
char * mutt_strn_copy(char *dest, const char *src, size_t len, size_t dsize)
Copy a sub-string into a buffer.
Definition: string.c:354
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:490
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:575
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition: mutt_thread.c:1658
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:1178
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
Definition: mx.c:1132
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:107
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:122
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
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:67
const char * end
End of string data.
Definition: node.h:78
const char * start
Start of string data.
Definition: node.h:77
Parsed Expando trees.
Definition: expando.h:41
Data passed to index_format_str()
Definition: hdrline.c:72
struct Email * email
Current Email.
Definition: hdrline.c:75
int msg_in_pager
Index of Email displayed in the Pager.
Definition: hdrline.c:74
struct Mailbox * mailbox
Current Mailbox.
Definition: hdrline.c:73
const char * pager_progress
String representing Pager position through Email.
Definition: hdrline.c:76
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:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
locale_t time_c_locale
Current locale but LC_TIME=C.
Definition: neomutt.h:47
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