From 2b80d5dbf2ff301b0627b3a0e3c9a61e86658fd4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 27 Dec 2012 04:25:36 -0500
Subject: [PATCH] Workaround UW-IMAP bug where hierarchy separator is added to the shared folder name (#1488879)

---
 CHANGELOG                                    |    1 +
 program/lib/Roundcube/rcube_imap_generic.php |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 02e2045..5f010ac 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Workaround UW-IMAP bug where hierarchy separator is added to the shared folder name (#1488879)
 - Fix version comparisons with -stable suffix (#1488876)
 - Add unsupported alternative parts to attachments list (#1488870)
 - Add Compose button on message view page (#1488747)
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index 59a444d..8d84bf7 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -1311,6 +1311,11 @@
                 if ($cmd == 'LIST' || $cmd == 'LSUB') {
                     list($opts, $delim, $mailbox) = $this->tokenizeResponse($line, 3);
 
+                    // Remove redundant separator at the end of folder name, UW-IMAP bug? (#1488879)
+                    if ($delim) {
+                        $mailbox = rtrim($mailbox, $delim);
+                    }
+
                     // Add to result array
                     if (!$lstatus) {
                         $folders[] = $mailbox;

--
Gitblit v1.9.1