Skip to content

Commit

Permalink
Fix level determination for elements in non-personal namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jun 9, 2014
1 parent 8912fef commit 2fa2f97
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions imp/lib/Ftree/Element.php
Expand Up @@ -114,9 +114,20 @@ public function __get($name)
return ($this->_id == 'INBOX');

case 'level':
return ($this->base_elt)
? 0
: substr_count($this->_id, $this->namespace_info->delimiter);
if ($this->base_elt) {
return 0;
}

$i = substr_count($this->_id, $this->namespace_info->delimiter);

$elt = $this;
while ($elt = $elt->parent) {
if ($elt->namespace) {
return $i + 1;
}
}

return $i;

case 'mbox_ob':
return IMP_Mailbox::get($this->_id);
Expand Down

0 comments on commit 2fa2f97

Please sign in to comment.