summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-01-04 11:16:54 +0000
committeralecpl <alec@alec.pl>2011-01-04 11:16:54 +0000
commit600bb156f79908e0ca72a039c6ad290146a2eb4e (patch)
tree903b2d054b14b7789241638ba2132fb66eac82b9 /program/include
parenteabd44876c67239b1f27afc4acadf1d7e2001219 (diff)
- Use improved get_capability() syntax, saves CAPABILITY call in some cases
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php8
-rw-r--r--program/include/rcube_imap_generic.php20
2 files changed, 13 insertions, 15 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 24c361c3f..26975044d 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -470,12 +470,12 @@ class rcube_imap
{
$this->threading = false;
- if ($enable) {
- if ($this->get_capability('THREAD=REFS'))
+ if ($enable && ($caps = $this->get_capability('THREAD'))) {
+ if (in_array('REFS', $caps))
$this->threading = 'REFS';
- else if ($this->get_capability('THREAD=REFERENCES'))
+ else if (in_array('REFERENCES', $caps))
$this->threading = 'REFERENCES';
- else if ($this->get_capability('THREAD=ORDEREDSUBJECT'))
+ else if (in_array('ORDEREDSUBJECT', $caps))
$this->threading = 'ORDEREDSUBJECT';
}
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index b5fd96871..b11266fd7 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -764,18 +764,14 @@ class rcube_imap_generic
// check for supported auth methods
if ($auth_method == 'CHECK') {
- if ($this->getCapability('AUTH=DIGEST-MD5')) {
- $auth_methods[] = 'DIGEST-MD5';
- }
- if ($this->getCapability('AUTH=CRAM-MD5') || $this->getCapability('AUTH=CRAM_MD5')) {
- $auth_methods[] = 'CRAM-MD5';
- }
- if ($this->getCapability('AUTH=PLAIN')) {
- $auth_methods[] = 'PLAIN';
+ if ($auth_caps = $this->getCapability('AUTH')) {
+ $auth_methods = $auth_caps;
}
// RFC 2595 (LOGINDISABLED) LOGIN disabled when connection is not secure
- if (!$this->getCapability('LOGINDISABLED')) {
- $auth_methods[] = 'LOGIN';
+ if (($key = array_search('LOGIN', $auth_methods)) !== false
+ && $this->getCapability('LOGINDISABLED')
+ ) {
+ unset($auth_methods[$key]);
}
}
else {
@@ -795,8 +791,10 @@ class rcube_imap_generic
// Authenticate
foreach ($auth_methods as $method) {
switch ($method) {
- case 'DIGEST-MD5':
+ case 'CRAM_MD5':
+ $method = 'CRAM-MD5';
case 'CRAM-MD5':
+ case 'DIGEST-MD5':
case 'PLAIN':
$result = $this->authenticate($user, $password, $method);
break;