Esempio n. 1
0
 protected function actionDelete($params)
 {
     $account = \GO\Email\Model\Account::model()->findByPk($params['account_id']);
     $mailbox = new \GO\Email\Model\ImapMailbox($account, array("name" => $params["mailbox"]));
     if ($mailbox->isSpecial()) {
         throw new \Exception(\GO::t("cantDeleteSpecialFolder", "email"));
     }
     $success = $mailbox->delete();
     return array("success" => $success);
 }
Esempio n. 2
0
 protected function actionDelete($params)
 {
     $response = array();
     $account = \GO\Email\Model\Account::model()->findByPk($params['account_id']);
     $mailbox = new \GO\Email\Model\ImapMailbox($account, array("name" => $params["mailbox"]));
     if ($mailbox->isSpecial()) {
         throw new \Exception(\GO::t("cantDeleteSpecialFolder", "email"));
     }
     if (strpos($params['mailbox'], $account->trash) !== 0 && !empty($account->trash)) {
         $targetMailbox = new \GO\Email\Model\ImapMailbox($account, array("name" => $account->trash));
         if ($targetMailbox->getHasChildren()) {
             if ($counter = $this->getCounterMailboxName($targetMailbox, $mailbox->getBaseName())) {
                 $mailbox->rename($mailbox->getBaseName() . $counter);
             }
         }
         $success = $mailbox->move($targetMailbox);
     } else {
         $success = $mailbox->delete();
     }
     $success = true;
     return array("success" => $success);
 }