diff -ur w3ml-0.4-20050413/install.rb.in w3ml-0.4-20050413.new/install.rb.in --- w3ml-0.4-20050413/install.rb.in 2002-06-25 23:37:51.000000000 +0900 +++ w3ml-0.4-20050413.new/install.rb.in 2005-05-11 20:21:02.734499970 +0900 @@ -9,7 +9,7 @@ CSS_DIR = '@CSS_DIR@' BinFiles = %w(setup entry) -LibFiles = %w(attach.rb compat.rb list.rb list_ml.rb msg.rb raw.rb search.rb top.rb tree.rb umail.rb w3ml-gdbm.rb w3ml-mysql.rb w3ml.rb) +LibFiles = %w(attach.rb compat.rb list.rb list_ml.rb msg.rb raw.rb search.rb top.rb tree.rb umail.rb util.rb w3ml-gdbm.rb w3ml-mysql.rb w3ml.rb) ConfFiles = %w(w3ml.conf) CgiFiles = %w(w3ml) CssFiles = %w(w3ml.css) diff -ur w3ml-0.4-20050413/list.rb w3ml-0.4-20050413.new/list.rb --- w3ml-0.4-20050413/list.rb 2002-04-15 13:16:41.000000000 +0900 +++ w3ml-0.4-20050413.new/list.rb 2005-04-25 10:26:23.102489471 +0900 @@ -1,4 +1,6 @@ # $Id: list.rb,v 1.3 2002/04/15 04:16:41 tommy Exp $ +$:.unshift( File::dirname( __FILE__ ) ) +require 'util' def list(ml, arg) not_found if arg == nil @@ -10,7 +12,7 @@ h[n].have_attach? ? $WithAttachHTML[0] : $WithAttachHTML[1], n, h[n].time.strftime('%Y-%m-%d %H:%M'), - escapeHTML(h[n].from), + escapeHTML(hide_address(h[n].from)), escapeHTML(h[n].subject) end put_tail @@ -69,9 +71,11 @@ puts < - + + #{ml}:#{s}-#{e} diff -ur w3ml-0.4-20050413/list_ml.rb w3ml-0.4-20050413.new/list_ml.rb --- w3ml-0.4-20050413/list_ml.rb 2002-04-15 13:16:41.000000000 +0900 +++ w3ml-0.4-20050413.new/list_ml.rb 2004-07-05 22:27:15.000000000 +0900 @@ -5,9 +5,11 @@ puts < - + + W3ml diff -ur w3ml-0.4-20050413/msg.rb w3ml-0.4-20050413.new/msg.rb --- w3ml-0.4-20050413/msg.rb 2002-06-26 01:19:02.000000000 +0900 +++ w3ml-0.4-20050413.new/msg.rb 2005-04-25 10:28:33.545652393 +0900 @@ -1,4 +1,6 @@ # $Id: msg.rb,v 1.4 2002/06/25 16:19:02 tommy Exp $ +$:.unshift( File::dirname( __FILE__ ) ) +require 'util' if $Charset.downcase == 'euc-jp' then begin @@ -45,21 +47,23 @@ header = escapeHTML(m.header).gsub(/\n/, "
\n"). sub(/\A(.*\<)(.*)(\>)/){"#{$1}#{$2}#{$3}"} - body = m.body.sub(/\n+\z/, "\n") + header = hide_address(escapeHTML(m.header).gsub(/\n/, "
\n")) prev_html = m.prev ? "#{$PrevHTML}" : $PrevHTML next_html = m.next ? "#{$NextHTML}" : $NextHTML s = (n-1)/$Step*$Step+1 e = s + $Step - 1 buttons = "#{prev_html}#{next_html}#{$ListHTML}#{$ThreadHTML}" - buttons << "#{$RawHTML}" if $StoreRaw + buttons << "#{$RawHTML}" if $StoreRaw && $GetRaw puts < - + + #{ml}:#{n} @@ -75,7 +79,7 @@
-#{add_tag to_html_body(m.body), ml}
+#{add_tag to_html_body(hide_address(m.body)), ml}
 
EOS diff -ur w3ml-0.4-20050413/search.rb w3ml-0.4-20050413.new/search.rb --- w3ml-0.4-20050413/search.rb 2002-04-15 13:16:41.000000000 +0900 +++ w3ml-0.4-20050413.new/search.rb 2004-07-05 22:27:15.000000000 +0900 @@ -24,13 +24,13 @@ limit = 50 offset = 0 - sdate = cgi['sdate'][0] if cgi.has_key? 'sdate' - edate = cgi['edate'][0] if cgi.has_key? 'edate' - subj = cgi['subject'][0] if cgi.has_key? 'subject' - from = cgi['from'][0] if cgi.has_key? 'from' - body = cgi['body'][0] if cgi.has_key? 'body' - limit = cgi['limit'][0].to_i if cgi.has_key? 'limit' - offset = cgi['offset'][0].to_i if cgi.has_key? 'offset' + sdate = cgi.params['sdate'][0] if cgi.has_key? 'sdate' + edate = cgi.params['edate'][0] if cgi.has_key? 'edate' + subj = cgi.params['subject'][0] if cgi.has_key? 'subject' + from = cgi.params['from'][0] if cgi.has_key? 'from' + body = cgi.params['body'][0] if cgi.has_key? 'body' + limit = cgi.params['limit'][0].to_i if cgi.has_key? 'limit' + offset = cgi.params['offset'][0].to_i if cgi.has_key? 'offset' if cgi.params.length > 0 then n = h.count(parse_date(sdate, 0), parse_date(edate, 24*60*60-1), parse_string(subj), parse_string(from), parse_string(body)) @@ -63,9 +63,11 @@ puts < - + + #{$mlname} diff -ur w3ml-0.4-20050413/top.rb w3ml-0.4-20050413.new/top.rb --- w3ml-0.4-20050413/top.rb 2002-04-15 11:36:21.000000000 +0900 +++ w3ml-0.4-20050413.new/top.rb 2004-07-05 22:27:15.000000000 +0900 @@ -10,9 +10,11 @@ puts < - + + #{ml}:ML diff -ur w3ml-0.4-20050413/tree.rb w3ml-0.4-20050413.new/tree.rb --- w3ml-0.4-20050413/tree.rb 2005-04-13 22:05:13.000000000 +0900 +++ w3ml-0.4-20050413.new/tree.rb 2005-04-25 10:27:52.850465404 +0900 @@ -1,4 +1,6 @@ # $Id: tree.rb,v 1.5 2005/04/13 13:05:13 tommy Exp $ +$:.unshift( File::dirname( __FILE__ ) ) +require 'util' def print_tree(path, m, del=nil, indent='', subj='', cur=nil) nsubj = m.subject.gsub(/\s+/, '').sub(/^(Re:)+/i, '') @@ -16,7 +18,7 @@ m.no, m.time.strftime('%Y-%m-%d %H:%M'), indent_s, - escapeHTML(m.from), + escapeHTML(hide_address(m.from)), if subj == nsubj then '' else escapeHTML(m.subject) end puts "" del[m.no] = true if del diff -ur w3ml-0.4-20050413/umail.rb w3ml-0.4-20050413.new/umail.rb --- w3ml-0.4-20050413/umail.rb 2002-05-06 02:34:57.000000000 +0900 +++ w3ml-0.4-20050413.new/umail.rb 2005-04-25 10:20:29.324742755 +0900 @@ -136,7 +136,7 @@ Zone['JST'] = 9 Specials = "()<>@,;:\\\".[]".split(//) - TokenDelimiterRe = /[][()<>@,;:\\.]|\s+|\"(?:[^\\\"]|\\.)*\"/ + TokenDelimiterRe = /[\[\]()<>@,;:\\.]|\s+|\"(?:[^\\\"]|\\.)*\"/ def parse() @tokens = split_array_token(@raw_body) @@ -193,7 +193,7 @@ cnt = 1 com = [m] while cnt > 0 - if s == '' then raise ParseError::new s0 end + if s == '' then raise ParseError::new(s0) end if s =~ /\A\s+|\A([^()\\\s]|\\.)*/o then com << $& s = $' #' @@ -316,7 +316,7 @@ phrase = a[0 .. i-1] if i > 0 addr = a[i+1 .. -1] addr.delete ' ' - if addr[-1] != '>' then raise ParseError::new "invalid '<'" end + if addr[-1] != '>' then raise ParseError::new("invalid '<'") end addr[-1,1] = nil else phrase = nil @@ -328,7 +328,7 @@ if strictly? then phrase.each do |p| if Specials.include? p then - raise ParseError::new "invalid phrase (#{p})" + raise ParseError::new("invalid phrase (#{p})") end end end @@ -337,7 +337,7 @@ addr.delete ' ' if strictly? then if not addr.include? '@' then - raise ParseError::new "'@' not in address" + raise ParseError::new("'@' not in address") end end @addrs << MailAddr::new(addr.join, phrase) @@ -417,7 +417,7 @@ end class CTypeH < StructH - TokenDelimiterRe = /[][()<>@,;:\\\/=.]|\s+|\"(?:[^\\\"]|\\.)*\"/ + TokenDelimiterRe = /[\[\]()<>@,;:\\\/=.]|\s+|\"(?:[^\\\"]|\\.)*\"/ def split_token(s) super(s, TokenDelimiterRe) end @@ -467,7 +467,7 @@ end class CDispositionH < StructH - TokenDelimiterRe = /[][()<>@,;:\\\/=.]|\s+|\"(?:[^\\\"]|\\.)*\"/ + TokenDelimiterRe = /[\[\]()<>@,;:\\\/=.]|\s+|\"(?:[^\\\"]|\\.)*\"/ def split_token(s) super(s, TokenDelimiterRe) end @@ -626,6 +626,10 @@ @body = NKF::nkf('-Jem0', @body) when /^shift_jis$/i @body = NKF::nkf('-Sem0', @body) + when /^utf-8$/i + @body = NKF::nkf('-Wem0', @body) + else + @body = NKF::nkf('-em0', @body) end else @body = NKF::nkf('-Jem0', @body) @@ -638,7 +642,7 @@ @epilogue = "" else b = @header['content-type'].params['boundary'] - if b == nil then raise ParseError::new "no boundary in content-type" end + if b == nil then raise ParseError::new("no boundary in content-type") end bre = Regexp::new '^'+Regexp::quote("--#{b}")+'[ \t]*\n' cre = Regexp::new '^'+Regexp::quote("--#{b}--")+'[ \t]*(\n|\Z)' a = @body_s.split(bre) @@ -646,7 +650,7 @@ a[-1] = $` epi = $' else - raise ParseError::new 'no close-delimiter' + raise ParseError::new('no close-delimiter') end pre = a.shift @body = @preamble = pre diff -ur w3ml-0.4-20050413/util.rb w3ml-0.4-20050413.new/util.rb --- w3ml-0.4-20050413/util.rb 2005-04-25 10:47:09.147438756 +0900 +++ w3ml-0.4-20050413.new/util.rb 2005-04-25 10:39:46.000000000 +0900 @@ -0,0 +1,9 @@ +def hide_address(txt) + return txt unless $HideAddress + address_regex = + /(("?)[-0-9a-zA-Z_.+?\/]+\2@[-0-9a-zA-Z]+\.[-0-9a-zA-Z.]+)/ # from quickml + txt.gsub!(address_regex){|add| add.sub(/(@.).*/, '\1...')} # from quickml + tel_regex = /(\d{2,4}-\d{2,4}-\d{4})/ + txt.gsub!(tel_regex){|tel| tel.gsub(/\d/, '?')} + txt +end diff -ur w3ml-0.4-20050413/w3ml.conf.en w3ml-0.4-20050413.new/w3ml.conf.en --- w3ml-0.4-20050413/w3ml.conf.en 2002-07-06 11:35:30.000000000 +0900 +++ w3ml-0.4-20050413.new/w3ml.conf.en 2005-04-25 10:43:39.960630537 +0900 @@ -1,5 +1,8 @@ $Step = 100 $StoreRaw = true +$GetRaw = false +$HideAddress = true +$Require = /Subject:\s*\[#{$mlname}\W\d+\]|List-Id:\s*#{$mlname}/i $Database = 'gdbm' diff -ur w3ml-0.4-20050413/w3ml.conf.in w3ml-0.4-20050413.new/w3ml.conf.in --- w3ml-0.4-20050413/w3ml.conf.in 2002-07-06 11:35:30.000000000 +0900 +++ w3ml-0.4-20050413.new/w3ml.conf.in 2005-04-25 10:42:08.226063273 +0900 @@ -1,5 +1,7 @@ $Step = 100 $StoreRaw = true +$GetRaw = false +$HideAddress = true $Require = /Subject:\s*\[#{$mlname}\W\d+\]|List-Id:\s*#{$mlname}/i $Database = 'gdbm' diff -ur w3ml-0.4-20050413/w3ml.in w3ml-0.4-20050413.new/w3ml.in --- w3ml-0.4-20050413/w3ml.in 2002-06-25 23:37:51.000000000 +0900 +++ w3ml-0.4-20050413.new/w3ml.in 2004-07-05 21:59:30.000000000 +0900 @@ -12,7 +12,7 @@ require LIB_DIR+'w3ml' require_slash end -path_info.squeeze! '/' +path_info.dup.squeeze! '/' ml, cmd, arg = path_info.split('/', 4)[1..-1] if ml == nil or ml == '' then require LIB_DIR+'w3ml' @@ -55,8 +55,12 @@ attach ml, a, b end when 'raw' - require LIB_DIR+'raw' - raw ml, arg + if $GetRaw + require LIB_DIR+'raw' + raw ml, arg + else + not_found + end else not_found end