diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/steps/settings/folders.inc | 25 |
2 files changed, 22 insertions, 4 deletions
@@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Plugin API: added folder_delete and folder_rename hooks - Added possibility to undo last contact delete operation - Fix sorting of contact groups after group create (#1487747) - Add optional textual upload progress indicator (#1486039) diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 239413f1a..cc149bc79 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -76,8 +76,16 @@ else if ($RCMAIL->action == 'delete-folder') $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); - if (strlen($mbox)) - $deleted = $IMAP->delete_mailbox($mbox); + if (strlen($mbox)) { + $plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox)); + + if (!$plugin['abort']) { + $deleted = $IMAP->delete_mailbox($plugin['name']); + } + else { + $deleted = $plugin['result']; + } + } if ($OUTPUT->ajax_call && $deleted) { // Remove folder and subfolders rows @@ -340,10 +348,19 @@ function rcmail_rename_folder($oldname, $newname) global $RCMAIL; $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); - $rename = $RCMAIL->imap->rename_mailbox($oldname, $newname); + + $plugin = $RCMAIL->plugins->exec_hook('folder_rename', array( + 'oldname' => $oldname, 'newname' => $newname)); + + if (!$plugin['abort']) { + $renamed = $RCMAIL->imap->rename_mailbox($oldname, $newname); + } + else { + $renamed = $plugin['result']; + } // update per-folder options for modified folder and its subfolders - if ($rename !== false) { + if ($renamed) { $a_threaded = (array) $RCMAIL->config->get('message_threading', array()); $oldprefix = '/^' . preg_quote($oldname . $delimiter, '/') . '/'; |