Commit d2ae4279 d2ae4279d67a8ad549259d1cdeddf14a114899cc by Sergey Poznyakoff

Changed default format to use (rcpt) to decide

whether or not to include an address to the cc: header.
Implemented --cc/--nocc.
1 parent 37ad731c
Showing 1 changed file with 21 additions and 4 deletions
...@@ -90,10 +90,10 @@ struct mh_option mh_option[] = { ...@@ -90,10 +90,10 @@ struct mh_option mh_option[] = {
90 static char *format_str = 90 static char *format_str =
91 "%(lit)%(formataddr %<{reply-to}%?{from}%?{sender}%?{return-path}%>)" 91 "%(lit)%(formataddr %<{reply-to}%?{from}%?{sender}%?{return-path}%>)"
92 "%<(nonnull)%(void(width))%(putaddr To: )\\n%>" 92 "%<(nonnull)%(void(width))%(putaddr To: )\\n%>"
93 "%(lit)%(formataddr{to})%(formataddr{cc})%(formataddr(me))" 93 "%(lit)%<(rcpt to)%(formataddr{to})%>%<(rcpt cc)%(formataddr{cc})%>%<(rcpt me)%(formataddr(me))%>"
94 "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>" 94 "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>"
95 "%<{fcc}Fcc: %{fcc}\\n%>" 95 "%<{fcc}Fcc: %{fcc}\\n%>"
96 "%<{subject}Subject: Re: %{subject}\\n%>" 96 "%<{subject}Subject: Re: %(unre{subject})\\n%>"
97 "%<{date}In-reply-to: Your message of \"" 97 "%<{date}In-reply-to: Your message of \""
98 "%<(nodate{date})%{date}%|%(pretty{date})%>.\"%<{message-id}\n" 98 "%<(nodate{date})%{date}%|%(pretty{date})%>.\"%<{message-id}\n"
99 " %{message-id}%>\\n%>" 99 " %{message-id}%>\\n%>"
...@@ -109,6 +109,17 @@ static int build_only = 0; /* --build flag */ ...@@ -109,6 +109,17 @@ static int build_only = 0; /* --build flag */
109 static int query_mode = 0; /* --query flag */ 109 static int query_mode = 0; /* --query flag */
110 110
111 static int 111 static int
112 decode_cc_flag (const char *opt, const char *arg)
113 {
114 int rc = mh_decode_rcpt_flag (arg);
115 if (rc == RCPT_NONE)
116 {
117 mh_error (_("%s %s is unknown"), opt, arg);
118 exit (1);
119 }
120 }
121
122 static int
112 opt_handler (int key, char *arg, void *unused) 123 opt_handler (int key, char *arg, void *unused)
113 { 124 {
114 switch (key) 125 switch (key)
...@@ -117,6 +128,14 @@ opt_handler (int key, char *arg, void *unused) ...@@ -117,6 +128,14 @@ opt_handler (int key, char *arg, void *unused)
117 build_only = 1; 128 build_only = 1;
118 break; 129 break;
119 130
131 case 'c':
132 rcpt_mask |= decode_cc_flag ("-cc", arg);
133 break;
134
135 case 'n':
136 rcpt_mask ^= decode_cc_flag ("-nocc", arg);
137 break;
138
120 case 'd': 139 case 'd':
121 draft_folder = arg; 140 draft_folder = arg;
122 break; 141 break;
...@@ -149,8 +168,6 @@ opt_handler (int key, char *arg, void *unused) ...@@ -149,8 +168,6 @@ opt_handler (int key, char *arg, void *unused)
149 168
150 case 'a': 169 case 'a':
151 case 'm': 170 case 'm':
152 case 'c':
153 case 'n':
154 case 'e': 171 case 'e':
155 case ARG_NOEDIT: 172 case ARG_NOEDIT:
156 case ARG_FCC: 173 case ARG_FCC:
......