Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] eselect r588 - trunk/modules
Date: Sat, 20 Jun 2009 22:29:43
Message-Id: E1MI949-0002lf-CB@stork.gentoo.org
1 Author: ulm
2 Date: 2009-06-20 22:29:41 +0000 (Sat, 20 Jun 2009)
3 New Revision: 588
4
5 Modified:
6 trunk/modules/news-tng.eselect
7 Log:
8 Fix encoding of headers.
9
10 Modified: trunk/modules/news-tng.eselect
11 ===================================================================
12 --- trunk/modules/news-tng.eselect 2009-06-20 10:37:25 UTC (rev 587)
13 +++ trunk/modules/news-tng.eselect 2009-06-20 22:29:41 UTC (rev 588)
14 @@ -110,10 +110,12 @@
15 echo -n "=?UTF-8?Q?"
16 for (( i=0; i<${#s}; i++ )); do
17 c=${s:i:1}
18 - if [[ ${c} < ' ' || ${c} > '~' || ${c} =~ [=?_()\\] ]]; then
19 + if [[ ${c} =~ [-A-Za-z0-9!*+/] ]]; then
20 + echo -n "${c}"
21 + elif [[ ${c} = ' ' ]]; then
22 + echo -n '_'
23 + else
24 printf '=%02X' "'${c}"
25 - else
26 - echo -n "${c/ /_}"
27 fi
28 done
29 echo "?="
30 @@ -133,16 +135,17 @@
31 fi
32 wd=$(day_of_week "${year}" "${month}" "${day}")
33
34 - if [[ ${author} == *([^<>])\<+([^<>])\> ]]; then
35 + if [[ ${author} == *([^\<\>])\<+([^\<\>])\> ]]; then
36 # GLEP 42 says this must look like "Real Name <email@address>"
37 name=${author%%*( )<*}
38 addr=${author##*<}; addr=${addr%%>*}
39 - elif [[ ${author} == +([^<>]) ]]; then
40 + elif [[ ${author} == +([^\<\>]) ]]; then
41 addr=${author}
42 fi
43
44 - [[ ${name} == *([[:ascii:]]) ]] || name=$(rfc2047_encode ${name})
45 - [[ ${title} == *([[:ascii:]]) ]] || title=$(rfc2047_encode ${title})
46 + [[ ${name} != *([[:ascii:]]) || ${name} =~ [\]\[()\<\>\",.:\;@\\] ]] \
47 + && name=$(rfc2047_encode "${name}")
48 + [[ ${title} != *([[:ascii:]]) ]] && title=$(rfc2047_encode "${title}")
49
50 echo "From ${addr} ${wd} ${mname[month]} ${day} ${time} ${year}"
51 echo "From: ${name} <${addr}>"