From aa38c512fb7634f51bfa168476105dd071f4bd35 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 08 Apr 2015 15:04:04 -0400
Subject: [PATCH] Fix lack of signature separator for plain text signatures in html mode (#1490352)

---
 program/steps/mail/compose.inc |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 4c3ecfb..ba6f334 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -448,6 +448,8 @@
 
         // #1486037: remove "mailto:" prefix
         $COMPOSE['param']['to'] = preg_replace('/^mailto:/i', '', $mailto[0]);
+        // #1490346: decode the recipient address
+        $COMPOSE['param']['to'] = urldecode($COMPOSE['param']['to']);
 
         // Supported case-insensitive tokens in mailto URL
         $url_tokens = array('to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'body');
@@ -626,21 +628,17 @@
                 $text = $html = $sql_arr['signature'];
 
                 if ($sql_arr['html_signature']) {
-                    $h2t  = new rcube_html2text($sql_arr['signature'], false, true);
+                    $h2t  = new rcube_html2text($html, false, true);
                     $text = trim($h2t->get_text());
                 }
                 else {
-                    $html = htmlentities($html, ENT_NOQUOTES, RCUBE_CHARSET);
+                    $t2h  = new rcube_text2html($text, false);
+                    $html = $t2h->get_html();
                 }
 
                 if (!preg_match('/^--[ -]\r?\n/m', $text)) {
                     $text = $separator . "\n" . $text;
                     $html = $separator . "<br>" . $html;
-                }
-
-                if (!$sql_arr['html_signature']) {
-                    $t2h  = new rcube_text2html($sql_arr['signature'], false);
-                    $html = $t2h->get_html();
                 }
 
                 $a_signatures[$identity_id]['text'] = $text;

--
Gitblit v1.9.1