From fb5e2fb96f4cda26936f599f1a15a49afb53178e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 18 Aug 2014 10:46:18 -0400 Subject: [PATCH] Don't fail when trying to create and subscribe a folder that already exists --- program/lib/Roundcube/rcube_imap.php | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index ec961c8..a66d206 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -3165,6 +3165,16 @@ $result = $this->conn->createFolder($folder, $type ? array("\\" . ucfirst($type)) : null); + // it's quite often situation that we're trying to create and subscribe + // a folder that already exist, but is unsubscribed + if (!$result) { + if ($this->get_response_code() == rcube_storage::ALREADYEXISTS + || preg_match('/already exists/i', $this->get_error_str()) + ) { + $result = true; + } + } + // try to subscribe it if ($result) { // clear cache -- Gitblit v1.9.1