summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_imap_generic.php
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 /program/lib/Roundcube/rcube_imap_generic.php
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 'program/lib/Roundcube/rcube_imap_generic.php')
-rw-r--r--program/lib/Roundcube/rcube_imap_generic.php40
1 files changed, 29 insertions, 11 deletions
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index 3ed2d957c..1b28c3bd7 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -702,18 +702,11 @@ class rcube_imap_generic
*/
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);
- $result = false;
+ $auth_method = $this->prefs['auth_type'];
+ $result = false;
// initialize connection
$this->error = '';
@@ -892,6 +885,31 @@ class rcube_imap_generic
}
/**
+ * 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';
+ }
+
+ // 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.