From: markus schnalke Date: Sun, 25 Oct 2015 19:42:52 +0000 (+0100) Subject: Add DCC support into whom X-Git-Tag: mmh-0.2-RC1~6 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=ca2931beaec23f8e1d2f98d15d7e9974009278b0;p=mmh Add DCC support into whom Plus a test for it. --- diff --git a/man/whom.man1 b/man/whom.man1 index b40787b..d52dbca 100644 --- a/man/whom.man1 +++ b/man/whom.man1 @@ -9,6 +9,7 @@ whom \- report to whom a message would go .na .B whom .RB [ \-tocc " | " \-notocc ] +.RB [ \-dcc " | " \-nodcc ] .RB [ \-bcc " | " \-nobcc ] .RB [ \-alias " | " \-noalias ] .RB [ \-Version ] @@ -21,20 +22,23 @@ is used to list the recipient addresses in the headers of a message. .PP Per default, .B whom -lists both, sighted and hidden, recipients. +lists sighted and hidden recipients. The .BR \-notocc -option suppresses the listing of sighted recipients. +option suppresses the listing of sighted recipients (To and Cc). +The +.BR \-nodcc +option suppresses the listing of hidden DCC recipients. The .BR \-nobcc -option suppresses the listing of hidden recipients. -If the printing of both kinds of recipients, visible and hidden, -is requested and hidden recipients are present, -they are separated by a line similar to ``\0==BCC==''. +option suppresses the listing of hidden BCC recipients. +If the printing of multiple kinds of recipients +is requested and hidden ones are present, +they are separated by a line similar to ``\0==DCC=='' or ``\0==BCC==''. The actual separator may change, but the regular expression -/^[\0\\t].*BCC/ should always match. +/^[\0\\t].*[DB]CC/ should always match. No separator is printed if only one kind of recipients is requested -for printing, or if both are requested but no hidden recipients are +for printing, or if multiple are requested but no hidden recipients are present. .PP With @@ -71,6 +75,7 @@ mh\-alias(5), spost(8) .SH DEFAULTS .nf .RB ` \-tocc ' +.RB ` \-dcc ' .RB ` \-bcc ' .RB ` \-alias ' .fi diff --git a/test/tests/whom/test-dcc-bcc b/test/tests/whom/test-dcc-bcc new file mode 100644 index 0000000..5936bbd --- /dev/null +++ b/test/tests/whom/test-dcc-bcc @@ -0,0 +1,110 @@ +# test whom + +. "$MH_TEST_COMMON" + + +draft="$MH_TEST_DIR/whom-$$.draft" + + +# to + cc headers +# +cat >"$draft" <"$draft" <"$draft" <"$draft" <m_next) { + /* skip unless both are resent or neither one is */ + if (resent != (mp->m_type&HRESENT)) { + continue; + } + if (mp->m_type & HDCC) { + if (!naddrs && (toccsw || bccsw)) { + puts(dccsep); + } + naddrs++; + printone(mp); + } + } + return naddrs; +} + +/* +** Walk through the list of addresses and print the right ones. +*/ +static int printbcc(void) { int naddrs = 0; @@ -312,8 +372,8 @@ printbcc(void) continue; } if (mp->m_type & HBCC) { - if (!naddrs && toccsw) { - puts(separator); + if (!naddrs && (toccsw || dccsw)) { + puts(bccsep); } naddrs++; printone(mp);