Adapt archive and markasjunk plugins to work with multi-folder search results
| | |
| | | /** |
| | | * Archive plugin script |
| | | * @version 2.2 |
| | | * @version 2.3 |
| | | */ |
| | | |
| | | function rcmail_archive(prop) |
| | |
| | | * Plugin that adds a new button to the mailbox toolbar |
| | | * to move messages to a (user selectable) archive folder. |
| | | * |
| | | * @version 2.2 |
| | | * @version 2.3 |
| | | * @license GNU GPLv3+ |
| | | * @author Andre Rodier, Thomas Bruederli, Aleksander Machniak |
| | | */ |
| | |
| | | $delimiter = $storage->get_hierarchy_delimiter(); |
| | | $archive_folder = $rcmail->config->get('archive_mbox'); |
| | | $archive_type = $rcmail->config->get('archive_type', ''); |
| | | |
| | | $storage->set_folder(($current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST))); |
| | | $current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST); |
| | | |
| | | $result = array('reload' => false, 'update' => false, 'errors' => array()); |
| | | $folders = array(); |
| | |
| | | |
| | | if ($uids == '*') { |
| | | $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); |
| | | $uids = $index->get(); |
| | | $messageset = array($current_mbox => $index->get()); |
| | | } |
| | | else { |
| | | $uids = explode(',', $uids); |
| | | $messageset = rcmail::get_uids(); |
| | | } |
| | | |
| | | foreach ($messageset as $mbox => $uids) { |
| | | $storage->set_folder(($current_mbox = $mbox)); |
| | | |
| | | foreach ($uids as $uid) { |
| | | if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) { |
| | |
| | | $result['errors'][] = $uid; |
| | | } |
| | | } // end for |
| | | } |
| | | |
| | | // send response |
| | | if ($result['errors']) { |
| | |
| | | "type": "roundcube-plugin", |
| | | "description": "This adds a button to move the selected messages to an archive folder. The folder (and the optional structure of subfolders) can be selected in the settings panel.", |
| | | "license": "GNU GPLv3+", |
| | | "version": "2.1", |
| | | "version": "2.3", |
| | | "authors": [ |
| | | { |
| | | "name": "Thomas Bruederli", |
| | |
| | | <email>alec@alec.pl</email> |
| | | <active>yes</active> |
| | | </lead> |
| | | <date>2013-10-30</date> |
| | | <date>2014-04-07</date> |
| | | <version> |
| | | <release>2.1</release> |
| | | <release>2.3</release> |
| | | <api>2.0</api> |
| | | </version> |
| | | <stability> |
| | |
| | | { |
| | | $this->add_texts('localization'); |
| | | |
| | | $uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); |
| | | $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $storage = $rcmail->get_storage(); |
| | | |
| | | $storage->unset_flag($uids, 'NONJUNK'); |
| | | $storage->set_flag($uids, 'JUNK'); |
| | | foreach (rcmail::get_uids() as $mbox => $uids) { |
| | | $storage->unset_flag($uids, 'NONJUNK', $mbox); |
| | | $storage->set_flag($uids, 'JUNK', $mbox); |
| | | } |
| | | |
| | | if (($junk_mbox = $rcmail->config->get('junk_mbox')) && $mbox != $junk_mbox) { |
| | | if (($junk_mbox = $rcmail->config->get('junk_mbox'))) { |
| | | $rcmail->output->command('move_messages', $junk_mbox); |
| | | } |
| | | |