Skip to content

Commit

Permalink
Fix status() handling
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Feb 6, 2014
1 parent c952777 commit 57df2cd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions imp/lib/Imap.php
Expand Up @@ -600,6 +600,10 @@ public function status()
$args = func_get_args();
$imap_factory = $injector->getInstance('IMP_Factory_Imap');

if (!is_array($args[0])) {
return $this->__call('status', $args);
}

foreach (IMP_Mailbox::get($args[0]) as $val) {
if ($raccount = $val->remote_account) {
$accounts[strval($raccount)] = $raccount;
Expand All @@ -610,18 +614,13 @@ public function status()
foreach ($mboxes as $key => $val) {
$imap = $imap_factory->create($key);
if ($imap->init) {
$tmp = $args;
$tmp[0] = IMP_Mailbox::getImapMboxOb($val);

foreach ($imap->__call('status', $tmp) as $key2 => $val2) {
foreach ($imap->__call('status', array($val) + $args) as $key2 => $val2) {
$out[isset($accounts[$key]) ? $accounts[$key]->mailbox($key2) : $key2] = $val2;
}
}
}

return is_array($args[0])
? $out
: reset($out);
return $out;
}

/**
Expand Down Expand Up @@ -667,7 +666,7 @@ public function __call($method, $params)
case 'getSyncToken':
case 'setMetadata':
case 'setQuota':
// case 'status': (Handled in status() command)
case 'status':
case 'store':
case 'subscribeMailbox':
case 'sync':
Expand Down

0 comments on commit 57df2cd

Please sign in to comment.