From 5aeeebad5649953abf0c691add15e997a1170a13 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 15 Nov 2011 06:22:40 -0500
Subject: [PATCH] - Fix regression in setting recipient to self when replying to a Sent message (#1487074)

---
 CHANGELOG                      |    1 +
 program/steps/mail/compose.inc |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ee8cb50..49d1093 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix regression in setting recipient to self when replying to a Sent message (#1487074)
 - Fix listing of folders in hidden namespaces (#1486796)
 - Don't consider \Noselect flag when building folders tree (#1488004)
 - Fix sorting autocomplete results (#1488084)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index c527ce1..9df25f0 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -358,11 +358,13 @@
       $mailfollowup = $MESSAGE->headers->others['mail-followup-to'];
       $mailreplyto  = $MESSAGE->headers->others['mail-reply-to'];
 
+      // Reply to mailing list...
       if ($MESSAGE->reply_all == 'list' && $mailfollowup)
         $fvalue = $mailfollowup;
       else if ($MESSAGE->reply_all == 'list'
         && preg_match('/<mailto:([^>]+)>/i', $MESSAGE->headers->others['list-post'], $m))
         $fvalue = $m[1];
+      // Reply to...
       else if ($MESSAGE->reply_all && $mailfollowup)
         $fvalue = $mailfollowup;
       else if ($mailreplyto)
@@ -371,6 +373,11 @@
         $fvalue = $MESSAGE->headers->replyto;
       else if (!empty($MESSAGE->headers->from))
         $fvalue = $MESSAGE->headers->from;
+
+      // Reply to message sent by yourself (#1487074)
+      if (!empty($ident) && $fvalue == $ident['ident']) {
+        $fvalue = $MESSAGE->headers->to;
+      }
     }
     // add recipient of original message if reply to all
     else if ($header == 'cc' && !empty($MESSAGE->reply_all) && $MESSAGE->reply_all != 'list') {

--
Gitblit v1.9.1