Parse an email header.
Process a line from an email header. Each line that is recognised is parsed and the information put in the Envelope or Header.
636{
637 if (!env || !name)
638 return 0;
639
640 bool matched = false;
641
642 switch (tolower(name[0]))
643 {
644 case 'a':
646 {
648 matched = true;
649 }
651 {
653 matched = true;
654 }
655#ifdef USE_AUTOCRYPT
657 {
659 if (c_autocrypt)
660 {
662 matched = true;
663 }
664 }
666 {
668 if (c_autocrypt)
669 {
671 matched = true;
672 }
673 }
674#endif
675 break;
676
677 case 'b':
679 {
681 matched = true;
682 }
683 break;
684
685 case 'c':
687 {
689 matched = true;
690 }
691 else
692 {
695 {
697 {
698 if (e)
700 matched = true;
701 }
703 {
704 if (e)
706 matched = true;
707 }
709 {
710 if (e)
712 matched = true;
713 }
715 {
716 if (e)
717 {
718 unsigned long len = 0;
720 }
721 matched = true;
722 }
724 {
725 if (e)
726 {
729 }
730 matched = true;
731 }
733 {
734 if (e)
736 matched = true;
737 }
738 }
739 }
740 break;
741
742 case 'd':
744 break;
745
747 if (e)
748 {
752 {
756 }
757 }
758 matched = true;
759 break;
760
761 case 'e':
764 {
766 }
767 break;
768
769 case 'f':
771 {
773 matched = true;
774 }
775#ifdef USE_NNTP
777 {
779 {
782 }
783 matched = true;
784 }
785#endif
786 break;
787
788 case 'i':
790 break;
791
794 matched = true;
795 break;
796
797 case 'l':
799 {
800 if (e)
801 {
802 unsigned int ui = 0;
805 }
806
807 matched = true;
808 }
810 {
811
813 {
815 if (mailto)
816 {
820 if (c_auto_subscribe)
822 }
823 }
824 matched = true;
825 }
827 {
828
830 if (mailto)
831 {
834 }
835 matched = true;
836 }
838 {
839
841 if (mailto)
842 {
845 }
846 matched = true;
847 }
848 break;
849
850 case 'm':
852 {
853 if (e)
855 matched = true;
856 }
858 {
859
862 matched = true;
863 }
864 else
865 {
868 {
870 {
871
874 matched = true;
875 }
877 {
879 matched = true;
880 }
881 }
882 }
883 break;
884
885#ifdef USE_NNTP
886 case 'n':
888 {
892 matched = true;
893 }
894 break;
895#endif
896
897 case 'o':
898
900 {
903 }
904 break;
905
906 case 'r':
908 {
911 matched = true;
912 }
914 {
916 matched = true;
917 }
919 {
921 matched = true;
922 }
924 {
926 {
927 char *d = strrchr(body, ';');
928 if (d)
929 {
932 }
933 }
934 }
935 break;
936
937 case 's':
939 {
942 matched = true;
943 }
945 {
947 matched = true;
948 }
950 {
951 if (e)
952 {
953 while (*body)
954 {
955 switch (*body)
956 {
957 case 'O':
958 {
960 break;
961 }
962 case 'R':
964 break;
965 case 'r':
967 break;
968 }
969 body++;
970 }
971 }
972 matched = true;
973 }
976 {
979 }
980 break;
981
982 case 't':
984 {
986 matched = true;
987 }
988 break;
989
990 case 'x':
992 {
993 if (e)
994 {
995 while (*body)
996 {
997 switch (*body)
998 {
999 case 'A':
1001 break;
1002 case 'D':
1004 break;
1005 case 'F':
1007 break;
1008 default:
1009 break;
1010 }
1011 body++;
1012 }
1013 }
1014 matched = true;
1015 }
1017 {
1020 matched = true;
1021 }
1022#ifdef USE_NNTP
1024 {
1027 matched = true;
1028 }
1030 {
1033 matched = true;
1034 }
1035#endif
1037 {
1039 matched = true;
1040 }
1041 break;
1042
1043 default:
1044 break;
1045 }
1046
1047
1048 if (!matched && user_hdrs)
1049 {
1051 char *dup = NULL;
1053
1055 {
1057 if (do_2047)
1058 {
1060 }
1061 }
1062 else
1063 {
1065 }
1066 }
1067
1068 return matched;
1069}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
const char * mutt_str_atoul(const char *str, unsigned long *dst)
Convert ASCII string to an unsigned long.
const char * mutt_str_atoui(const char *str, unsigned int *dst)
Convert ASCII string to an unsigned integer.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
time_t mutt_date_parse_date(const char *s, struct Tz *tz_out)
Parse a date string in RFC822 format.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
int mutt_str_asprintf(char **strp, const char *fmt,...)
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
char * mutt_str_skip_whitespace(const char *p)
Find the first non-whitespace character in a string.
void mutt_auto_subscribe(const char *mailto)
Check if user is subscribed to mailing list.
void mutt_parse_content_type(const char *s, struct Body *ct)
Parse a content type.
static struct AutocryptHeader * parse_autocrypt(struct AutocryptHeader *head, const char *s)
Parse an Autocrypt header line.
static void parse_references(struct ListHead *head, const char *s)
Parse references from an email header.
bool mutt_matches_ignore(const char *s)
Does the string match the ignore list.
static char * rfc2369_first_mailto(const char *body)
Extract the first mailto: URL from a RFC2369 list.
static void parse_content_language(const char *s, struct Body *ct)
Read the content's language.
static void parse_content_disposition(const char *s, struct Body *ct)
Parse a content disposition.
static size_t plen
Length of cached packet.
char * description
content-description
unsigned int zminutes
Minutes away from UTC.
bool mime
Has a MIME-Version header?
int lines
How many lines in the body of this message?
bool old
Email is seen, but unread.
bool zoccident
True, if west of UTC, False if east.
bool flagged
Marked important?
unsigned int zhours
Hours away from UTC.
time_t date_sent
Time when the message was sent (UTC)
bool replied
Email has been replied to.
bool expired
Already expired?
bool deleted
Email is deleted.
time_t received
Time when the message was placed in the mailbox.
struct ListHead userhdrs
user defined headers
char * supersedes
Supersedes header.
char * list_subscribe
This stores a mailto URL, or nothing.
struct AddressList return_path
Return path for the Email.
char * followup_to
List of 'followup-to' fields.
struct AddressList reply_to
Email's 'reply-to'.
char * message_id
Message ID.
char * x_comment_to
List of 'X-comment-to' fields.
struct AddressList x_original_to
Email's 'X-Orig-to'.
struct AutocryptHeader * autocrypt_gossip
Autocrypt Gossip header.
char * newsgroups
List of newsgroups.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
struct AddressList cc
Email's 'Cc' list.
struct AddressList sender
Email's sender.
struct ListHead references
message references (in reverse order)
struct AutocryptHeader * autocrypt
Autocrypt header.
struct ListHead in_reply_to
in-reply-to header content
char * subject
Email's subject.
struct AddressList bcc
Email's 'Bcc' list.
char * xref
List of cross-references.
char * organization
Organisation header.
char * list_post
This stores a mailto URL, or nothing.
char * list_unsubscribe
This stores a mailto URL, or nothing.
struct AddressList from
Email's 'From' list.
List of recognised Timezones.