From 83370e5ff14f55f6af435807713956160f91abfa Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 18 Dec 2012 06:54:38 -0500
Subject: [PATCH] Display 'Sender' header in message preview

---
 CHANGELOG                               |    1 +
 program/steps/mail/func.inc             |   10 +++++++++-
 program/localization/en_US/labels.inc   |    1 +
 program/lib/Roundcube/rcube_storage.php |    1 +
 4 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index a89e029..8cfeaf8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Display 'Sender' header in message preview
 - Plugin API: Added message_before_send hook
 - Fix contact copy/add-to-group operations on search result (#1488862)
 - Use matching identity in MDN response (#1488864)
diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php
index 65de266..8a36f1f 100644
--- a/program/lib/Roundcube/rcube_storage.php
+++ b/program/lib/Roundcube/rcube_storage.php
@@ -53,6 +53,7 @@
     protected $all_headers = array(
         'IN-REPLY-TO',
         'BCC',
+        'SENDER',
         'MESSAGE-ID',
         'CONTENT-TRANSFER-ENCODING',
         'REFERENCES',
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index abb0dca..730e6af 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -41,6 +41,7 @@
 // message listing
 $labels['subject'] = 'Subject';
 $labels['from']    = 'From';
+$labels['sender']  = 'Sender';
 $labels['to']      = 'To';
 $labels['cc']      = 'Cc';
 $labels['bcc']     = 'Bcc';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 88391b1..f516539 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -967,7 +967,7 @@
   }
 
   // show these headers
-  $standard_headers = array('subject', 'from', 'to', 'cc', 'bcc', 'replyto',
+  $standard_headers = array('subject', 'from', 'sender', 'to', 'cc', 'bcc', 'replyto',
     'mail-reply-to', 'mail-followup-to', 'date', 'priority');
   $exclude_headers = $attrib['exclude'] ? explode(',', $attrib['exclude']) : array();
   $output_headers = array();
@@ -1018,6 +1018,14 @@
       else
         continue;
     }
+    else if ($hkey == 'sender') {
+      if ($headers['sender'] != $headers['from']) {
+        $header_value = rcmail_address_string($value, $attrib['max'], true, $attrib['addicon'], $headers['charset'], $header_title);
+        $ishtml = true;
+      }
+      else
+        continue;
+    }
     else if ($hkey == 'mail-followup-to') {
       $header_value = rcmail_address_string($value, $attrib['max'], true, $attrib['addicon'], $headers['charset'], $header_title);
       $ishtml = true;

--
Gitblit v1.9.1