From 46f7b7096450939fe03c95aa81ce06ae4bfca89d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 Mar 2016 06:51:43 -0400
Subject: [PATCH] Enable reply/reply-all/forward buttons also in preview frame of message/rfc822

---
 program/lib/Roundcube/rcube_imap_generic.php |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index caf2ebe..1800f82 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -997,7 +997,18 @@
                 return false;
             }
 
-            if (!stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
+            if (isset($this->prefs['socket_options']['ssl']['crypto_method'])) {
+                $crypto_method = $this->prefs['socket_options']['ssl']['crypto_method'];
+            }
+            else {
+                // There is no flag to enable all TLS methods. Net_SMTP
+                // handles enabling TLS similarly.
+                $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT
+                    | @STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
+                    | @STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
+            }
+
+            if (!stream_socket_enable_crypto($this->fp, true, $crypto_method)) {
                 $this->setError(self::ERROR_BAD, "Unable to negotiate TLS");
                 $this->closeConnection();
                 return false;
@@ -3725,9 +3736,9 @@
                 if (!is_numeric(($bytes = substr($str, 1, $epos - 1)))) {
                     // error
                 }
+
                 $result[] = $bytes ? substr($str, $epos + 3, $bytes) : '';
-                // Advance the string
-                $str = substr($str, $epos + 3 + $bytes);
+                $str      = substr($str, $epos + 3 + $bytes);
                 break;
 
             // Quoted string
@@ -3744,9 +3755,7 @@
                         }
                     }
                 }
-                if ($str[$pos] != '"') {
-                    // error
-                }
+
                 // we need to strip slashes for a quoted string
                 $result[] = stripslashes(substr($str, 1, $pos - 1));
                 $str      = substr($str, $pos + 1);
@@ -3754,13 +3763,13 @@
 
             // Parenthesized list
             case '(':
-                $str = substr($str, 1);
+                $str      = substr($str, 1);
                 $result[] = self::tokenizeResponse($str);
                 break;
+
             case ')':
                 $str = substr($str, 1);
                 return $result;
-                break;
 
             // String atom, number, astring, NIL, *, %
             default:
@@ -3773,7 +3782,7 @@
                 // we do not exclude [ and ] (#1489223)
                 if (preg_match('/^([^\x00-\x20\x29\x7F]+)/', $str, $m)) {
                     $result[] = $m[1] == 'NIL' ? null : $m[1];
-                    $str = substr($str, strlen($m[1]));
+                    $str      = substr($str, strlen($m[1]));
                 }
                 break;
             }

--
Gitblit v1.9.1