- Use improved get_capability() syntax, saves CAPABILITY call in some cases

release-0.6
alecpl 14 years ago
parent eabd44876c
commit 600bb156f7

@ -470,12 +470,12 @@ class rcube_imap
{ {
$this->threading = false; $this->threading = false;
if ($enable) { if ($enable && ($caps = $this->get_capability('THREAD'))) {
if ($this->get_capability('THREAD=REFS')) if (in_array('REFS', $caps))
$this->threading = 'REFS'; $this->threading = 'REFS';
else if ($this->get_capability('THREAD=REFERENCES')) else if (in_array('REFERENCES', $caps))
$this->threading = 'REFERENCES'; $this->threading = 'REFERENCES';
else if ($this->get_capability('THREAD=ORDEREDSUBJECT')) else if (in_array('ORDEREDSUBJECT', $caps))
$this->threading = 'ORDEREDSUBJECT'; $this->threading = 'ORDEREDSUBJECT';
} }

@ -764,18 +764,14 @@ class rcube_imap_generic
// check for supported auth methods // check for supported auth methods
if ($auth_method == 'CHECK') { if ($auth_method == 'CHECK') {
if ($this->getCapability('AUTH=DIGEST-MD5')) { if ($auth_caps = $this->getCapability('AUTH')) {
$auth_methods[] = 'DIGEST-MD5'; $auth_methods = $auth_caps;
}
if ($this->getCapability('AUTH=CRAM-MD5') || $this->getCapability('AUTH=CRAM_MD5')) {
$auth_methods[] = 'CRAM-MD5';
}
if ($this->getCapability('AUTH=PLAIN')) {
$auth_methods[] = 'PLAIN';
} }
// RFC 2595 (LOGINDISABLED) LOGIN disabled when connection is not secure // RFC 2595 (LOGINDISABLED) LOGIN disabled when connection is not secure
if (!$this->getCapability('LOGINDISABLED')) { if (($key = array_search('LOGIN', $auth_methods)) !== false
$auth_methods[] = 'LOGIN'; && $this->getCapability('LOGINDISABLED')
) {
unset($auth_methods[$key]);
} }
} }
else { else {
@ -795,8 +791,10 @@ class rcube_imap_generic
// Authenticate // Authenticate
foreach ($auth_methods as $method) { foreach ($auth_methods as $method) {
switch ($method) { switch ($method) {
case 'DIGEST-MD5': case 'CRAM_MD5':
$method = 'CRAM-MD5';
case 'CRAM-MD5': case 'CRAM-MD5':
case 'DIGEST-MD5':
case 'PLAIN': case 'PLAIN':
$result = $this->authenticate($user, $password, $method); $result = $this->authenticate($user, $password, $method);
break; break;

@ -102,14 +102,10 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
// set current mailbox and some other vars in client environment // set current mailbox and some other vars in client environment
$OUTPUT->set_env('mailbox', $mbox_name); $OUTPUT->set_env('mailbox', $mbox_name);
$OUTPUT->set_env('pagesize', $IMAP->page_size); $OUTPUT->set_env('pagesize', $IMAP->page_size);
$OUTPUT->set_env('quota', $IMAP->get_capability('quota')); $OUTPUT->set_env('quota', $IMAP->get_capability('QUOTA'));
$OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter()); $OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter());
$OUTPUT->set_env('threading', (bool) $IMAP->threading); $OUTPUT->set_env('threading', (bool) $IMAP->threading);
$OUTPUT->set_env('threads', $IMAP->threading $OUTPUT->set_env('threads', $IMAP->threading || $IMAP->get_capability('THREAD'));
|| $IMAP->get_capability('thread=references')
|| $IMAP->get_capability('thread=orderedsubject')
|| $IMAP->get_capability('thread=refs')
);
if ($CONFIG['flag_for_deletion']) if ($CONFIG['flag_for_deletion'])
$OUTPUT->set_env('flag_for_deletion', true); $OUTPUT->set_env('flag_for_deletion', true);

@ -39,9 +39,7 @@ function rcube_folder_form($attrib)
$delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
$special = (strlen($mbox_imap) && in_array($mbox_imap, (array) $RCMAIL->config->get('default_imap_folders'))); $special = (strlen($mbox_imap) && in_array($mbox_imap, (array) $RCMAIL->config->get('default_imap_folders')));
$protected = ($special && $RCMAIL->config->get('protect_default_folders')); $protected = ($special && $RCMAIL->config->get('protect_default_folders'));
$threading_supported = $RCMAIL->imap->get_capability('thread=references') $threading_supported = $RCMAIL->imap->get_capability('THREAD');
|| $RCMAIL->imap->get_capability('thread=orderedsubject')
|| $RCMAIL->imap->get_capability('thread=refs');
// Get mailbox stats (messages count, etc.), mailbox name and parent // Get mailbox stats (messages count, etc.), mailbox name and parent
if (strlen($mbox)) { if (strlen($mbox)) {

@ -334,9 +334,7 @@ function rcmail_user_prefs($current=null)
} }
$RCMAIL->imap_connect(); $RCMAIL->imap_connect();
$threading_supported = $RCMAIL->imap->get_capability('thread=references') $threading_supported = $RCMAIL->imap->get_capability('THREAD');
|| $RCMAIL->imap->get_capability('thread=orderedsubject')
|| $RCMAIL->imap->get_capability('thread=refs');
if (!isset($no_override['autoexpand_threads']) && $threading_supported) { if (!isset($no_override['autoexpand_threads']) && $threading_supported) {
$field_id = 'rcmfd_autoexpand_threads'; $field_id = 'rcmfd_autoexpand_threads';
@ -346,8 +344,8 @@ function rcmail_user_prefs($current=null)
$select_autoexpand_threads->add(rcube_label('expand_only_unread'), 2); $select_autoexpand_threads->add(rcube_label('expand_only_unread'), 2);
$blocks['main']['options']['autoexpand_threads'] = array( $blocks['main']['options']['autoexpand_threads'] = array(
'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))), 'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))),
'content' => $select_autoexpand_threads->show($config['autoexpand_threads']), 'content' => $select_autoexpand_threads->show($config['autoexpand_threads']),
); );
} }

Loading…
Cancel
Save