Fix setting of Junk and NonJunk flags by markasjunk plugin (#1489285)
Added possibility to register flag mappings by a plugin.
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Fix setting of Junk and NonJunk flags by markasjunk plugin (#1489285) |
| | | - Fix lack of Reply-To address in header of forwarded message body (#1489298) |
| | | - Fix bugs when invoking contact creation form when read-only addressbook is selected (#1489296) |
| | | - Fix identity selection on reply (#1489291) |
| | |
| | | $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(); |
| | |
| | | } |
| | | } |
| | | |
| | | 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 = 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(); |
| | | $rcmail->storage->unset_flag($uids, 'NONJUNK'); |
| | | $rcmail->storage->set_flag($uids, 'JUNK'); |
| | | |
| | | |
| | | $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(); |
| | | } |
| | |
| | | <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> |
| | |
| | | protected $search_sort_field = ''; |
| | | protected $search_threads = false; |
| | | protected $search_sorted = false; |
| | | protected $options = array('auth_method' => 'check'); |
| | | protected $options = array('auth_type' => 'check'); |
| | | protected $caching = false; |
| | | protected $messages_caching = false; |
| | | protected $threading = false; |
| | |
| | | public function check_permflag($flag) |
| | | { |
| | | $flag = strtoupper($flag); |
| | | $imap_flag = $this->conn->flags[$flag]; |
| | | $perm_flags = $this->get_permflags($this->folder); |
| | | $imap_flag = $this->conn->flags[$flag]; |
| | | |
| | | return in_array_nocase($imap_flag, $perm_flags); |
| | | return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags); |
| | | } |
| | | |
| | | |
| | |
| | | if (!strlen($folder)) { |
| | | return array(); |
| | | } |
| | | /* |
| | | Checking PERMANENTFLAGS is rather rare, so we disable caching of it |
| | | Re-think when we'll use it for more than only MDNSENT flag |
| | | |
| | | $cache_key = 'mailboxes.permanentflags.' . $folder; |
| | | $permflags = $this->get_cache($cache_key); |
| | | |
| | | if ($permflags !== null) { |
| | | return explode(' ', $permflags); |
| | | } |
| | | */ |
| | | if (!$this->check_connection()) { |
| | | return array(); |
| | | } |
| | |
| | | if (!is_array($permflags)) { |
| | | $permflags = array(); |
| | | } |
| | | /* |
| | | // Store permflags as string to limit cached object size |
| | | $this->update_cache($cache_key, implode(' ', $permflags)); |
| | | */ |
| | | |
| | | return $permflags; |
| | | } |
| | | |
| | |
| | | */ |
| | | function connect($host, $user, $password, $options=null) |
| | | { |
| | | // set options |
| | | if (is_array($options)) { |
| | | $this->prefs = $options; |
| | | } |
| | | // set auth method |
| | | if (!empty($this->prefs['auth_type'])) { |
| | | $auth_method = strtoupper($this->prefs['auth_type']); |
| | | } else { |
| | | $auth_method = 'CHECK'; |
| | | } |
| | | // configure |
| | | $this->set_prefs($options); |
| | | |
| | | if (!empty($this->prefs['disabled_caps'])) { |
| | | $this->prefs['disabled_caps'] = array_map('strtoupper', (array)$this->prefs['disabled_caps']); |
| | | } |
| | | |
| | | $result = false; |
| | | $auth_method = $this->prefs['auth_type']; |
| | | $result = false; |
| | | |
| | | // initialize connection |
| | | $this->error = ''; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Initializes environment |
| | | */ |
| | | protected function set_prefs($prefs) |
| | | { |
| | | // set preferences |
| | | if (is_array($prefs)) { |
| | | $this->prefs = $prefs; |
| | | } |
| | | |
| | | // set auth method |
| | | if (!empty($this->prefs['auth_type'])) { |
| | | $this->prefs['auth_type'] = strtoupper($this->prefs['auth_type']); |
| | | } |
| | | else { |
| | | $this->prefs['auth_type'] = 'CHECK'; |
| | | } |
| | | |
| | | // disabled capabilities |
| | | if (!empty($this->prefs['disabled_caps'])) { |
| | | $this->prefs['disabled_caps'] = array_map('strtoupper', (array)$this->prefs['disabled_caps']); |
| | | } |
| | | |
| | | // additional message flags |
| | | if (!empty($this->prefs['message_flags'])) { |
| | | $this->flags = array_merge($this->flags, $this->prefs['message_flags']); |
| | | unset($this->prefs['message_flags']); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Checks connection status |
| | | * |
| | | * @return bool True if connection is active and user is logged in, False otherwise. |
| | |
| | | protected $default_charset = 'ISO-8859-1'; |
| | | protected $default_folders = array('INBOX'); |
| | | protected $search_set; |
| | | protected $options = array('auth_method' => 'check'); |
| | | protected $options = array('auth_type' => 'check'); |
| | | protected $page_size = 10; |
| | | protected $threading = false; |
| | | |