diff options
author | alecpl <alec@alec.pl> | 2011-07-10 18:11:25 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-07-10 18:11:25 +0000 |
commit | 19869073e3e60903ee90c5e5d9404058c29679fb (patch) | |
tree | 539bacdf6fafce507a3fcda22ebb8bf41cbcf715 /program/steps | |
parent | 580adc82636e33314103d279f1bcd94a05dfbb7f (diff) |
- Plugin API: added folder_delete and folder_rename hooks
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/settings/folders.inc | 25 |
1 files changed, 21 insertions, 4 deletions
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, '/') . '/'; |