summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-02-21 16:44:39 +0000
committerthomascube <thomas@roundcube.net>2010-02-21 16:44:39 +0000
commit47d8d39cf49310b688967f7571b0d66b5971b39c (patch)
treecad6a377f8e37bddaf8c87c4fd8b713d54d32043
parentcd8e5636d201e22139dcfa090fa949f577129ec8 (diff)
Use rcmail::imap_connect() to establish IMAP connections; always initialize rcube_imap object in mail steps
-rw-r--r--plugins/managesieve/managesieve.php2
-rw-r--r--plugins/subscriptions_option/subscriptions_option.php2
-rw-r--r--program/include/rcmail.php16
-rw-r--r--program/steps/mail/func.inc5
-rw-r--r--program/steps/settings/func.inc2
-rw-r--r--program/steps/settings/manage_folders.inc2
6 files changed, 20 insertions, 9 deletions
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 07b39767d..219c33489 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -901,7 +901,7 @@ class managesieve extends rcube_plugin
$out .= '<select id="action_mailbox' .$id. '" name="_action_mailbox[]" style="display:'
.(!isset($action) || $action['type']=='fileinto' ? 'inline' : 'none'). '">';
- $this->rc->imap_init(true);
+ $this->rc->imap_connect();
$a_folders = $this->rc->imap->list_mailboxes();
$delimiter = $this->rc->imap->get_hierarchy_delimiter();
diff --git a/plugins/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php
index ecbc4e238..4d471b8e6 100644
--- a/plugins/subscriptions_option/subscriptions_option.php
+++ b/plugins/subscriptions_option/subscriptions_option.php
@@ -65,7 +65,7 @@ class subscriptions_option extends rcube_plugin
// if the use_subscriptions preference changes, flush the folder cache
if (($use_subscriptions && !isset($_POST['_use_subscriptions'])) ||
(!$use_subscriptions && isset($_POST['_use_subscriptions']))) {
- $rcmail->imap_init(true);
+ $rcmail->imap_connect();
$rcmail->imap->clear_cache('mailboxes');
}
}
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 5d20989b2..b0d130e75 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -5,7 +5,7 @@
| program/include/rcmail.php |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2008-2010, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -374,6 +374,10 @@ class rcmail
*/
public function imap_init($connect = false)
{
+ // already initialized
+ if (is_object($this->imap))
+ return;
+
$this->imap = new rcube_imap($this->db);
$this->imap->debug_level = $this->config->get('debug_level');
$this->imap->skip_deleted = $this->config->get('skip_deleted');
@@ -404,9 +408,13 @@ class rcmail
$hook = $this->plugins->exec_hook('imap_init', array('fetch_headers' => $this->imap->fetch_add_headers));
if ($hook['fetch_headers'])
$this->imap->fetch_add_headers = $hook['fetch_headers'];
-
- if ($connect)
+
+ // support this parameter for backward compatibility but log warning
+ if ($connect) {
$this->imap_connect();
+ raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__,
+ 'message' => "rcube::imap_init(true) is deprecated, use rcube::imap_connect() instead"), true, false);
+ }
}
@@ -841,7 +849,7 @@ class rcmail
if (!$this->authenticate_session())
return;
- $this->imap_init(true);
+ $this->imap_connect();
}
if ($config['logout_purge'] && !empty($config['trash_mbox'])) {
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index f522d0dc3..da21220ff 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -5,7 +5,7 @@
| program/steps/mail/func.inc |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -24,6 +24,9 @@ $EMAIL_ADDRESS_PATTERN = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9][a-z0-9\-\.]*\\.[a-
// actions that do not require imap connection
$NOIMAP_ACTIONS = array('spell', 'addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment');
+// always instantiate imap object (but not yet connect to server)
+$RCMAIL->imap_init();
+
// log in to imap server
if (!in_array($RCMAIL->action, $NOIMAP_ACTIONS) && !$RCMAIL->imap_connect()) {
$RCMAIL->kill_session();
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index a2175b0f0..094fa5995 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -509,7 +509,7 @@ function rcmail_user_prefs($current=null)
// Configure special folders
if (!isset($no_override['default_imap_folders'])) {
- $RCMAIL->imap_init(true);
+ $RCMAIL->imap_connect();
$select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true,
'maxlength' => 30, 'exceptions' => array('INBOX')));
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index 22bd158f5..06fee7a87 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -22,7 +22,7 @@
// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
// init IMAP connection
-$RCMAIL->imap_init(true);
+$RCMAIL->imap_connect();
// subscribe to one or more mailboxes
if ($RCMAIL->action=='subscribe')