summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-07-30 19:38:06 +0000
committerthomascube <thomas@roundcube.net>2006-07-30 19:38:06 +0000
commitf9c107afbe9bb01627a9e6de48efdfbbda8e56e6 (patch)
treec9758b06f319953e2491c601d8fc09bf859e295a /program/include/rcube_imap.inc
parentfe79b1bcf828b6b9f947c4b32d5e7bf297438be4 (diff)
Fixed folder renaming; added confirmation after deleting a folder
Diffstat (limited to 'program/include/rcube_imap.inc')
-rw-r--r--program/include/rcube_imap.inc31
1 files changed, 16 insertions, 15 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index c98c480a9..4137d109a 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -1245,28 +1245,29 @@ class rcube_imap
// set a new name to an existing mailbox
- function rename_mailbox($mbox_name, $new_name, $subscribe=TRUE)
+ function rename_mailbox($mbox_name, $new_name)
{
$result = FALSE;
// replace backslashes
$name = preg_replace('/[\\\]+/', '-', $new_name);
+
+ // encode mailbox name and reduce it to 100 chars
+ $name_enc = substr(UTF7EncodeString($new_name), 0, 100);
- $name_enc = UTF7EncodeString($new_name);
-
- // reduce mailbox name to 100 chars
- $name_enc = substr($name_enc, 0, 100);
-
+ // make absolute path
+ $mailbox = $this->_mod_mailbox($mbox_name);
$abs_name = $this->_mod_mailbox($name_enc);
- $a_mailbox_cache = $this->get_cache('mailboxes');
-
- if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache)))
- $result = iil_C_RenameFolder($this->conn, $mbox_name, $abs_name);
-
- // update mailboxlist cache
- if ($result && $subscribe)
- $this->unsubscribe($mbox_name);
- $this->subscribe($name_enc);
+
+ if (strlen($abs_name))
+ $result = iil_C_RenameFolder($this->conn, $mailbox, $abs_name);
+
+ // clear cache
+ if ($result)
+ {
+ $this->clear_message_cache($mailbox.'.msg');
+ $this->clear_cache('mailboxes');
+ }
return $result ? $name : FALSE;
}