diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-04 19:07:29 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-04 19:07:29 +0000 |
| commit | 058d67ac713c55f4ae230c5c2079105ed4f479b8 (patch) | |
| tree | 7dcfedb679613cd8750557d8fd4cb08a9b846ba1 /roundcubemail/program | |
| parent | 58477c3eea9741a5431726ba730a98d27409d9ed (diff) | |
- performance: connect to imap server only when needed
(some mail actions do not require imap connection)
git-svn-id: https://svn.roundcube.net/trunk@2119 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/steps/mail/func.inc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc index dc0a70834..33503aec1 100644 --- a/roundcubemail/program/steps/mail/func.inc +++ b/roundcubemail/program/steps/mail/func.inc @@ -22,9 +22,25 @@ require_once('lib/enriched.inc'); require_once('include/rcube_smtp.inc'); - $EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i'; +// actions that do not require imap connection +$NOIMAP_ACTIONS = array('spell', 'addcontact', 'autocomplete', 'upload'); + + +// log in to imap server +if (!in_array($RCMAIL->action, $NOIMAP_ACTIONS) && !$RCMAIL->imap_connect()) { + $RCMAIL->kill_session(); + + if ($OUTPUT->ajax_call) + $OUTPUT->redirect(array(), 2000); + + $OUTPUT->set_env('task', 'login'); + $OUTPUT->send('login'); +} + + + // set imap properties and session vars if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)) $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox)); @@ -64,6 +80,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') $_SESSION['search'][$search_request] = $IMAP->get_search_set(); $OUTPUT->set_env('search_request', $search_request); } + + // make sure the message count is refreshed (for default view) + $IMAP->messagecount($mbox_name, 'ALL', true); } // set current mailbox in client environment |
