From 42b11351497ce67e96a0465c76694632cdfb3ecb Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 07 Oct 2005 10:17:08 -0400
Subject: [PATCH] Several bugfixes and feature improvements

---
 program/include/rcube_imap.inc |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 127409d..2143416 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -24,9 +24,6 @@
 require_once('lib/imap.inc');
 require_once('lib/mime.inc');
 
-// check for Open-SSL support in PHP build
-//$ICL_SSL = TRUE;
-//$ICL_PORT = 993;
 
 class rcube_imap
   {
@@ -75,15 +72,29 @@
     }
 
 
-  function connect($host, $user, $pass, $port=143)
+  function connect($host, $user, $pass, $port=143, $use_ssl=FALSE)
     {
-    global $ICL_PORT;
+    global $ICL_PORT, $CONFIG;
+    
+    // check for Open-SSL support in PHP build
+    if ($use_ssl && in_array('openssl', get_loaded_extensions()))
+      $ICL_SSL = TRUE;
 
     $ICL_PORT = $port;
-    $this->conn = iil_Connect($host, $user, $pass);
+    $this->conn = iil_Connect($host, $user, $pass, array('imap' => 'check'));
     $this->host = $host;
     $this->user = $user;
     $this->pass = $pass;
+    
+    if ($this->conn && ($CONFIG['debug_level'] & 8))
+      print $this->conn->message;
+      
+    else if (!$this->conn && $GLOBALS['iil_error'])
+      {
+      raise_error(array('code' => 403,
+                       'type' => 'imap',
+                       'message' => $GLOBALS['iil_error']), TRUE, FALSE);
+      }
 
     return $this->conn ? TRUE : FALSE;
     }

--
Gitblit v1.9.1