From ff3eb834920e2ec04e24423b5f87bdf4d3064eeb Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Thu, 16 Jan 2014 09:50:48 -0500
Subject: [PATCH] Handle combined UID-folder identifiers in rcube_imap class

---
 program/lib/Roundcube/rcube_imap.php |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 847bcfa..698d0da 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1656,6 +1656,7 @@
     public function refresh_search()
     {
         if (!empty($this->search_string)) {
+            // FIXME: make this work with saved multi-folder searches
             $this->search('', $this->search_string, $this->search_charset, $this->search_sort_field);
         }
 
@@ -1676,6 +1677,11 @@
     {
         if (!strlen($folder)) {
             $folder = $this->folder;
+        }
+
+        // decode combined UID-folder identifier
+        if (preg_match('/^\d+-[^,]+$/', $uid)) {
+            list($uid, $folder) = explode('-', $uid);
         }
 
         // get cached headers
@@ -1709,6 +1715,11 @@
             $folder = $this->folder;
         }
 
+        // decode combined UID-folder identifier
+        if (preg_match('/^\d+-[^,]+$/', $uid)) {
+            list($uid, $folder) = explode('-', $uid);
+        }
+
         // Check internal cache
         if (!empty($this->icache['message'])) {
             if (($headers = $this->icache['message']) && $headers->uid == $uid) {

--
Gitblit v1.9.1