SOURCES: cvsspam-users_file_charset.patch (NEW) - from mailinglist

glen glen at pld-linux.org
Sat Feb 17 17:44:37 CET 2007


Author: glen                         Date: Sat Feb 17 16:44:37 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- from mailinglist

---- Files affected:
SOURCES:
   cvsspam-users_file_charset.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/cvsspam-users_file_charset.patch
diff -u /dev/null SOURCES/cvsspam-users_file_charset.patch:1.1
--- /dev/null	Sat Feb 17 17:44:37 2007
+++ SOURCES/cvsspam-users_file_charset.patch	Sat Feb 17 17:44:32 2007
@@ -0,0 +1,63 @@
+Index: cvsspam.rb
+===================================================================
+--- cvsspam.rb	(revision 254)
++++ cvsspam.rb	(working copy)
+@@ -162,8 +162,9 @@
+ 
+   # gives a string starting "=?", and including a charset specification, that
+   # marks the start of a quoted-printable character sequence
+-  def marker_start_quoted
+-    "=?#{@charset}?#{@encoding}?"
++  def marker_start_quoted(charset=nil)
++    charset = @charset if charset.nil?
++    "=?#{charset}?#{@encoding}?"
+   end
+ 
+   # test to see of the given string contains non-ASCII characters
+@@ -1243,7 +1244,7 @@
+ 
+ # an RFC 822 email address
+ class EmailAddress
+-  def initialize(text)
++  def initialize(text, charset=nil)
+     if text =~ /^\s*([^<]+?)\s*<\s*([^>]+?)\s*>\s*$/
+       @personal_name = $1
+       @address = $2
+@@ -1251,9 +1252,10 @@
+       @personal_name = nil
+       @address = text
+     end
++    @charset=charset
+   end
+ 
+-  attr_accessor :personal_name, :address
++  attr_accessor :personal_name, :address, :charset
+ 
+   def has_personal_name?
+     return !@personal_name.nil?
+@@ -1284,7 +1286,7 @@
+   # rfc2047 encode the word, if it contains non-ASCII characters
+   def encode_word(word)
+     if $encoder.requires_rfc2047?(word)
+-      encoded = $encoder.marker_start_quoted
++      encoded = $encoder.marker_start_quoted(@charset)
+       $encoder.each_char_encoded(word) do |code|
+ 	encoded << code
+       end
+@@ -1299,6 +1301,7 @@
+ cvsroot_dir = "#{ENV['CVSROOT']}/CVSROOT"
+ $config = "#{cvsroot_dir}/cvsspam.conf"
+ $users_file = "#{cvsroot_dir}/users"
++$users_file_charset = nil
+ 
+ $debug = false
+ $recipients = Array.new
+@@ -1762,7 +1765,7 @@
+       io.each_line do |line|
+         if line =~ /^([^:]+)\s*:\s*(['"]?)([^\n\r]+)(\2)/
+           if email.address == $1
+-            return EmailAddress.new($3)
++            return EmailAddress.new($3, $users_file_charset)
+           end
+         end
+       end
================================================================


More information about the pld-cvs-commit mailing list