diff options
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcmail.php | 9 | ||||
-rw-r--r-- | program/include/rcube_imap_generic.php | 11 |
2 files changed, 14 insertions, 6 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index ddbe5c9d6..652dbd00c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -428,10 +428,11 @@ class rcmail // can save time detecting them using NAMESPACE and LIST $options = array( 'auth_method' => $this->config->get('imap_auth_type', 'check'), - 'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'), - 'rootdir' => isset($_SESSION['imap_root']) ? $_SESSION['imap_root'] : $this->config->get('imap_root'), - 'debug_mode' => (bool) $this->config->get('imap_debug', 0), - 'force_caps' => (bool) $this->config->get('imap_force_caps'), + 'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'), + 'rootdir' => isset($_SESSION['imap_root']) ? $_SESSION['imap_root'] : $this->config->get('imap_root'), + 'debug_mode' => (bool) $this->config->get('imap_debug', 0), + 'force_caps' => (bool) $this->config->get('imap_force_caps'), + 'timeout' => (int) $this->config->get('imap_timeout', 0), ); $this->imap->set_options($options); diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index d159b903c..7796e0a11 100644 --- a/program/include/rcube_imap_generic.php +++ b/program/include/rcube_imap_generic.php @@ -611,14 +611,21 @@ class rcube_imap_generic $host = $this->prefs['ssl_mode'] . '://' . $host; } - $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr, 10); + // Connect + if ($this->prefs['timeout'] > 0) + $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr, $this->prefs['timeout']); + else + $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr); + if (!$this->fp) { $this->error = sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr); $this->errornum = -2; return false; } - stream_set_timeout($this->fp, 10); + if ($this->prefs['timeout'] > 0) + stream_set_timeout($this->fp, $this->prefs['timeout']); + $line = trim(fgets($this->fp, 8192)); if ($this->prefs['debug_mode'] && $line) { |