From d8c440c03f3c66b93793c40e54d3c9329d9b5ea9 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 24 Mar 2010 10:45:49 -0400 Subject: [PATCH] - Added 'imap_force_caps' option for after-login CAPABILITY checking (#1485750) --- program/lib/imap.inc | 38 +++++++++++++++++--------------------- 1 files changed, 17 insertions(+), 21 deletions(-) diff --git a/program/lib/imap.inc b/program/lib/imap.inc index d877470..a8f318c 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -389,7 +389,7 @@ return false; } -function iil_ClearCapability() +function iil_C_ClearCapability($conn) { $conn->capability = array(); $conn->capability_readed = false; @@ -550,26 +550,19 @@ $iil_error = ''; $iil_errornum = 0; - // set some imap options + // set options if (is_array($options)) { - foreach($options as $optkey => $optval) { - if ($optkey == 'auth_method') { - $auth_method = strtoupper($optval); - } else if ($optkey == 'rootdir') { - $my_prefs['rootdir'] = $optval; - } else if ($optkey == 'delimiter') { - $my_prefs['delimiter'] = $optval; - } else if ($optkey == 'debug_mode') { - $my_prefs['debug_mode'] = $optval; - } - } - } - - if (empty($auth_method)) + $my_prefs = $options; + } + // set auth method + if (!empty($my_prefs['auth_method'])) { + $auth_method = strtoupper($my_prefs['auth_method']); + } else { $auth_method = 'CHECK'; - + } + $message = "INITIAL: $auth_method\n"; - + $result = false; // initialize connection @@ -579,13 +572,13 @@ $conn->selected = ''; $conn->user = $user; $conn->host = $host; - + if ($my_prefs['sort_field'] == 'INTERNALDATE') { $IMAP_USE_INTERNAL_DATE = true; } else if ($my_prefs['sort_field'] == 'DATE') { $IMAP_USE_INTERNAL_DATE = false; } - + //check input if (empty($host)) { $iil_error = "Empty host"; @@ -660,7 +653,7 @@ } // Now we're authenticated, capabilities need to be reread - iil_ClearCapability(); + iil_C_ClearCapability($conn); } } @@ -705,6 +698,9 @@ } if (is_resource($result)) { + if ($my_prefs['force_caps']) { + iil_C_ClearCapability($conn); + } iil_C_Namespace($conn); return $conn; } else { -- Gitblit v1.9.1