@ -6,7 +6,7 @@
* Plugin that adds a new button to the mailbox toolbar
* Plugin that adds a new button to the mailbox toolbar
* to move messages to a (user selectable) archive folder.
* to move messages to a (user selectable) archive folder.
*
*
* @version 2.2
* @version 2.3
* @license GNU GPLv3+
* @license GNU GPLv3+
* @author Andre Rodier, Thomas Bruederli, Aleksander Machniak
* @author Andre Rodier, Thomas Bruederli, Aleksander Machniak
*/
*/
@ -111,8 +111,7 @@ class archive extends rcube_plugin
$delimiter = $storage->get_hierarchy_delimiter();
$delimiter = $storage->get_hierarchy_delimiter();
$archive_folder = $rcmail->config->get('archive_mbox');
$archive_folder = $rcmail->config->get('archive_mbox');
$archive_type = $rcmail->config->get('archive_type', '');
$archive_type = $rcmail->config->get('archive_type', '');
$current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST);
$storage->set_folder(($current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST)));
$result = array('reload' => false, 'update' => false, 'errors' => array());
$result = array('reload' => false, 'update' => false, 'errors' => array());
$folders = array();
$folders = array();
@ -121,12 +120,15 @@ class archive extends rcube_plugin
if ($uids == '*') {
if ($uids == '*') {
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
$uids = $index->get( );
$messageset = array($current_mbox => $index->get() );
}
}
else {
else {
$uids = explode(',', $uids );
$messageset = rcmail::get_uids( );
}
}
foreach ($messageset as $mbox => $uids) {
$storage->set_folder(($current_mbox = $mbox));
foreach ($uids as $uid) {
foreach ($uids as $uid) {
if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) {
if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) {
continue;
continue;
@ -199,6 +201,7 @@ class archive extends rcube_plugin
$result['errors'][] = $uid;
$result['errors'][] = $uid;
}
}
} // end for
} // end for
}
// send response
// send response
if ($result['errors']) {
if ($result['errors']) {