alecpl
2011-07-10 19869073e3e60903ee90c5e5d9404058c29679fb
- Plugin API: added folder_delete and folder_rename hooks


2 files modified
26 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/steps/settings/folders.inc 25 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -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)
program/steps/settings/folders.inc
@@ -76,8 +76,16 @@
    $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 @@
    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, '/') . '/';