* message sequence number (if 'sequence' is true). Values
* of each entry:
* <pre>
- * 'base' - (integer) The UID of the base message. Is null if this is the
- * only message in the thread.
- * 'last' - (boolean) Is this the last message in a subthread?
- * 'level' - (integer) The thread level of this message (1 = base).
- * 'uid' - (integer) The UID of the message.
+ * 'b' (base) - (integer) [OPTIONAL] The ID of the base message. Is not
+ * set, this is the only message in the thread.
+ * DEFAULT: Only message in thread
+ * 'l' (level) - (integer) [OPTIONAL] The thread level of this
+ * message (1 = base).
+ * DEFAULT: 0
+ * 's' (subthread) - (boolean) [OPTIONAL] Are there more messages in this
+ * subthread?
+ * DEFAULT: No
* </pre>
* @throws Horde_Imap_Client_Exception
*/
if (is_null($tp['base']) && ($level || $cnt)) {
$tp['base'] = $val;
}
- $tp['resp'][$val] = array(
- 'base' => $tp['base'],
- 'last' => $islast,
- 'level' => $level++,
- 'id' => $val
- );
+
+ $tp['resp'][$val] = array();
+ $ptr = &$tp['resp'][$val];
+
+ if (!is_null($tp['base'])) {
+ $ptr['b'] = $tp['base'];
+ }
+
+ if (!$islast) {
+ $ptr['s'] = true;
+ }
+
+ if ($level++) {
+ $ptr['l'] = $level;
+ }
}
$islast = true;
}
*/
public function getThreadIndent($index)
{
- return isset($this->_thread[$index]['level'])
- ? $this->_thread[$index]['level']
+ return isset($this->_thread[$index])
+ ? (isset($this->_thread[$index]['l']) ? $this->_thread[$index]['l'] : 0)
: false;
}
*/
public function getThreadBase($index)
{
- return !empty($this->_thread[$index]['base'])
- ? $this->_thread[$index]['base']
+ return isset($this->_thread[$index])
+ ? (isset($this->_thread[$index]['b']) ? $this->_thread[$index]['b'] : null)
: false;
}
*/
public function lastInLevel($index)
{
- return !empty($this->_thread[$index]['last'])
- ? $this->_thread[$index]['last']
- : false;
+ return empty($this->_thread[$index]['s']);
}
/**
while (list($k, $v) = each($this->_thread)) {
if ($k == $begin) {
$in_thread = true;
- } elseif ($in_thread && ($v['base'] != $begin)) {
+ } elseif ($in_thread && ($this->getThreadBase($k) != $begin)) {
break;
}