From 4ea605e70b36f8a11279e3f1f9168f2b2c0e88f8 Mon Sep 17 00:00:00 2001
From: Vincent Bernat <bernat@debian.org>
Date: Thu, 2 Sep 2010 05:59:23 +0000
Subject: [PATCH] Add a patch to fix Received header to behave better with Spam
 Assassin. Closes: #595204.

---
 debian/changelog                         |  4 ++-
 debian/patches/received-headers-sa.patch | 37 ++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 debian/patches/received-headers-sa.patch

diff --git a/debian/changelog b/debian/changelog
index a331327..5705367 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,10 @@ roundcube (0.3.1-5) UNRELEASED; urgency=low
     'mime_param_folding' directive. Closes: #588295.
   * Add Danish debconf translation, thanks to Joe Dalton.
     Closes: #593271.
+  * Add a patch to fix Received header to behave better with Spam
+    Assassin. Closes: #595204.
 
- -- Vincent Bernat <bernat@debian.org>  Tue, 24 Aug 2010 20:35:54 +0200
+ -- Vincent Bernat <bernat@debian.org>  Thu, 02 Sep 2010 07:54:58 +0200
 
 roundcube (0.3.1-4) unstable; urgency=low
 
diff --git a/debian/patches/received-headers-sa.patch b/debian/patches/received-headers-sa.patch
new file mode 100644
index 0000000..740792d
--- /dev/null
+++ b/debian/patches/received-headers-sa.patch
@@ -0,0 +1,37 @@
+Fix Received headers to behave better with SpamAssassin?
+ http://trac.roundcube.net/changeset/3291
+ http://trac.roundcube.net/ticket/1486513
+
+--- a/program/steps/mail/sendmail.inc	2009-11-16 23:49:07 +0000
++++ a/program/steps/mail/sendmail.inc	2010-02-24 00:48:24 +0000
+@@ -259,8 +259,8 @@
+         $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+     } else {
+       $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+-      $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+-        '[' . $host .'])';
++      if ($host != $hostname)
++        $http_header .= ' (['. $host .'])';
+     }
+     $http_header .= $nldlm . ' via ';
+   }
+@@ -272,14 +272,14 @@
+       $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+   } else {
+     $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+-    $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+-      '[' . $host .'])';
++    if ($host != $hostname)
++      $http_header .= ' (['. $host .'])';
+   }
+   // BY
+   $http_header .= $nldlm . 'by ' . $_SERVER['HTTP_HOST'];
+   // WITH
+-  $http_header .= $nldlm . 'with ' . $_SERVER['SERVER_PROTOCOL'] .
+-      ' ('.$_SERVER['REQUEST_METHOD'] . '); ' . date('r');
++  $http_header .= $nldlm . 'with HTTP (' . $_SERVER['SERVER_PROTOCOL'] .
++      ' '.$_SERVER['REQUEST_METHOD'] . '); ' . date('r');
+   $http_header = wordwrap($http_header, 69, $nldlm);
+ 
+   $headers['Received'] = $http_header;
+
diff --git a/debian/patches/series b/debian/patches/series
index dae62da..b2874f4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ changeset_r3202.patch
 dont-limit-email-local-part.patch
 disable-dns-prefetch.patch
 default-charset-utf8.patch
+received-headers-sa.patch
-- 
2.39.5