Skip to content

Commit

Permalink
Use the new IMP 7 way of accessing subscribed mailbox information, if…
Browse files Browse the repository at this point in the history
… available
  • Loading branch information
slusarz committed Jan 16, 2015
1 parent 2601b07 commit 343b184
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions framework/Core/lib/Horde/Core/ActiveSync/Imap/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

class Horde_Core_ActiveSync_Imap_Factory implements Horde_ActiveSync_Interface_ImapFactory
{
const MASK_SUBSCRIBED = 8;

protected $_adapter;
protected $_mailboxlist;
protected $_specialMailboxlist;
Expand Down Expand Up @@ -72,12 +70,20 @@ public function getMailboxes($force = false)
'subscribe'
);
try {
foreach ($registry->mail->mailboxList() as $mbox) {
// @HACK. Don't like having to check for imp specific
// mailbox strings here but don't see anyway around it.
if (strpos($mbox['ob']->utf8, "impsearch\000") === false &&
(!$subscriptions || ($mbox['a'] & self::MASK_SUBSCRIBED))) {
foreach ($registry->mail->mailboxList(array('unsub' => !$subscriptions)) as $mbox) {
if (isset($mbox['subscribed'])) {
/* IMP 7. Guaranteed that return will match what was
* asked for in 'unsub' argument. */
$this->_mailboxlist[$mbox['ob']->utf8] = $mbox;
} else {
// @HACK. Don't like having to check for imp specific
// mailbox strings here but don't see anyway
// around it.
// @TODO REMOVE - deprecated in IMP 6.
if (strpos($mbox['ob']->utf8, "impsearch\000") === false &&
(!$subscriptions || ($mbox['a'] & 8))) {
$this->_mailboxlist[$mbox['ob']->utf8] = $mbox;
}
}
}
} catch (Horde_Exception $e) {
Expand Down Expand Up @@ -143,4 +149,4 @@ public function getMsgFlags()
return $msgFlags;
}

}
}

0 comments on commit 343b184

Please sign in to comment.