summaryrefslogtreecommitdiff
path: root/plugins/markasjunk
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-08-29 09:20:33 +0200
committerAleksander Machniak <alec@alec.pl>2013-08-29 09:23:52 +0200
commitc1a0b072424568957eb686a049d8419e4d96c476 (patch)
tree5eee76a7ab855bc6cbe5929fe89a61f1d874dfa7 /plugins/markasjunk
parent5df7179b32e363ad0c7c2c3d6d8b5411252c9402 (diff)
Fix setting of Junk and NonJunk flags by markasjunk plugin (#1489285)
Added possibility to register flag mappings by a plugin. Conflicts: plugins/markasjunk/markasjunk.php program/lib/Roundcube/rcube_imap_generic.php
Diffstat (limited to 'plugins/markasjunk')
-rw-r--r--plugins/markasjunk/markasjunk.php35
-rw-r--r--plugins/markasjunk/package.xml7
2 files changed, 27 insertions, 15 deletions
diff --git a/plugins/markasjunk/markasjunk.php b/plugins/markasjunk/markasjunk.php
index 4db90c1bc..4448b506c 100644
--- a/plugins/markasjunk/markasjunk.php
+++ b/plugins/markasjunk/markasjunk.php
@@ -19,6 +19,7 @@ class markasjunk extends rcube_plugin
$rcmail = rcmail::get_instance();
$this->register_action('plugin.markasjunk', array($this, 'request_action'));
+ $this->add_hook('storage_init', array($this, 'storage_init'));
if ($rcmail->action == '' || $rcmail->action == 'show') {
$skin_path = $this->local_skin_path();
@@ -38,24 +39,36 @@ class markasjunk extends rcube_plugin
}
}
+ function storage_init($args)
+ {
+ $flags = array(
+ 'JUNK' => 'Junk',
+ 'NONJUNK' => 'NonJunk',
+ );
+
+ // register message flags
+ $args['message_flags'] = array_merge((array)$args['message_flags'], $flags);
+
+ return $args;
+ }
+
function request_action()
{
$this->add_texts('localization');
- $GLOBALS['IMAP_FLAGS']['JUNK'] = 'Junk';
- $GLOBALS['IMAP_FLAGS']['NONJUNK'] = 'NonJunk';
-
- $uids = get_input_value('_uid', RCUBE_INPUT_POST);
- $mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
-
- $rcmail = rcmail::get_instance();
- $rcmail->storage->unset_flag($uids, 'NONJUNK');
- $rcmail->storage->set_flag($uids, 'JUNK');
-
+ $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');
+
if (($junk_mbox = $rcmail->config->get('junk_mbox')) && $mbox != $junk_mbox) {
$rcmail->output->command('move_messages', $junk_mbox);
}
-
+
$rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation');
$rcmail->output->send();
}
diff --git a/plugins/markasjunk/package.xml b/plugins/markasjunk/package.xml
index a5b4bf92c..95597481a 100644
--- a/plugins/markasjunk/package.xml
+++ b/plugins/markasjunk/package.xml
@@ -13,11 +13,10 @@
<email>roundcube@gmail.com</email>
<active>yes</active>
</lead>
- <date>2010-03-29</date>
- <time>13:20:00</time>
+ <date>2013-08-29</date>
<version>
- <release>1.1</release>
- <api>1.1</api>
+ <release>1.2</release>
+ <api>1.2</api>
</version>
<stability>
<release>stable</release>