Skip to content

Commit

Permalink
Attempt to subscribe to the mailbox if trying to create one and it al…
Browse files Browse the repository at this point in the history
…ready exists.
  • Loading branch information
mrubinsk committed Feb 18, 2015
1 parent 4b2108f commit 1fe7899
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,18 @@ public function createMailbox($name, $parent = null)
$imap->subscribeMailbox($mbox, true);
} catch (Horde_Imap_Client_Exception $e) {
if ($e->getCode() == Horde_Imap_Client_Exception::ALREADYEXISTS) {
throw new Horde_ActiveSync_Exception_FolderExists('Folder Exists!');
$this->_logger(sprintf(
'[%s] Mailbox %s already exists, subscribing to it.',
$this->_procid,
$name
));
try {
$imap->subscribeMailbox($mbox, true);
} catch (Horde_Imap_Client_Exception $e) {
// Exists, but could not subscribe to it, something is
// *really* wrong.
throw new Horde_ActiveSync_Exception_FolderExists('Folder Exists!');
}
}
throw new Horde_ActiveSync_Exception($e);
}
Expand Down

0 comments on commit 1fe7899

Please sign in to comment.