summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-14 10:22:25 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-14 10:22:25 +0000
commit68135346e77a7ddabe1d6264565a05e896400b93 (patch)
tree19b408b47e7bdfbe24873105c2061cd42d970212 /roundcubemail/program/include/rcube_imap.php
parentf3f1284d206c580e4aed4266567f019cde9abab7 (diff)
- Improved IMAP errors handling
git-svn-id: https://svn.roundcube.net/trunk@4088 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
-rw-r--r--roundcubemail/program/include/rcube_imap.php32
1 files changed, 26 insertions, 6 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php
index 0a27989b9..9d027c87c 100644
--- a/roundcubemail/program/include/rcube_imap.php
+++ b/roundcubemail/program/include/rcube_imap.php
@@ -32,7 +32,6 @@
class rcube_imap
{
public $debug_level = 1;
- public $error_code = 0;
public $skip_deleted = false;
public $root_dir = '';
public $page_size = 10;
@@ -173,7 +172,6 @@ class rcube_imap
}
// write error log
else if ($this->conn->error) {
- $this->error_code = $this->conn->errornum;
if ($pass && $user)
raise_error(array('code' => 403, 'type' => 'imap',
'file' => __FILE__, 'line' => __LINE__,
@@ -213,7 +211,29 @@ class rcube_imap
$this->conn->select($this->mailbox);
}
+
+ /**
+ * Returns code of last error
+ *
+ * @return int Error code
+ */
+ function get_error_code()
+ {
+ return ($this->conn) ? $this->conn->errornum : 0;
+ }
+
+
+ /**
+ * Returns message of last error
+ *
+ * @return string Error message
+ */
+ function get_error_str()
+ {
+ return ($this->conn) ? $this->conn->error : '';
+ }
+
/**
* Set options to be used in rcube_imap_generic::connect()
*
@@ -568,11 +588,11 @@ class rcube_imap
if (!empty($this->icache['threads']))
return count($this->icache['threads']['tree']);
- list ($thread_tree, $msg_depth, $has_children) = $this->_fetch_threads($mailbox);
-
- $msg_count = count($msg_depth);
+ if (is_array($result = $this->_fetch_threads($mailbox)))
+ $thread_tree = array_shift($result);
-// $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children);
+// list ($thread_tree, $msg_depth, $has_children) = $result;
+// $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children);
return count($thread_tree);
}