]> git.pld-linux.org Git - packages/cvsspam.git/blame - cvsspam-users_file_charset.patch
- add (old)
[packages/cvsspam.git] / cvsspam-users_file_charset.patch
CommitLineData
89545939
ER
1Index: cvsspam.rb
2===================================================================
3--- cvsspam.rb (revision 254)
4+++ cvsspam.rb (working copy)
5@@ -162,8 +162,9 @@
6
7 # gives a string starting "=?", and including a charset specification, that
8 # marks the start of a quoted-printable character sequence
9- def marker_start_quoted
10- "=?#{@charset}?#{@encoding}?"
11+ def marker_start_quoted(charset=nil)
12+ charset = @charset if charset.nil?
13+ "=?#{charset}?#{@encoding}?"
14 end
15
16 # test to see of the given string contains non-ASCII characters
17@@ -1243,7 +1244,7 @@
18
19 # an RFC 822 email address
20 class EmailAddress
21- def initialize(text)
22+ def initialize(text, charset=nil)
23 if text =~ /^\s*([^<]+?)\s*<\s*([^>]+?)\s*>\s*$/
24 @personal_name = $1
25 @address = $2
26@@ -1251,9 +1252,10 @@
27 @personal_name = nil
28 @address = text
29 end
30+ @charset=charset
31 end
32
33- attr_accessor :personal_name, :address
34+ attr_accessor :personal_name, :address, :charset
35
36 def has_personal_name?
37 return !@personal_name.nil?
38@@ -1284,7 +1286,7 @@
39 # rfc2047 encode the word, if it contains non-ASCII characters
40 def encode_word(word)
41 if $encoder.requires_rfc2047?(word)
42- encoded = $encoder.marker_start_quoted
43+ encoded = $encoder.marker_start_quoted(@charset)
44 $encoder.each_char_encoded(word) do |code|
45 encoded << code
46 end
47@@ -1299,6 +1301,7 @@
48 cvsroot_dir = "#{ENV['CVSROOT']}/CVSROOT"
49 $config = "#{cvsroot_dir}/cvsspam.conf"
50 $users_file = "#{cvsroot_dir}/users"
51+$users_file_charset = nil
52
53 $debug = false
54 $recipients = Array.new
55@@ -1762,7 +1765,7 @@
56 io.each_line do |line|
57 if line =~ /^([^:]+)\s*:\s*(['"]?)([^\n\r]+)(\2)/
58 if email.address == $1
59- return EmailAddress.new($3)
60+ return EmailAddress.new($3, $users_file_charset)
61 end
62 end
63 end
This page took 0.670489 seconds and 4 git commands to generate.