| @@ -1,73 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/* | |
| 4 | - * This file is part of the PHP IMAP2 package. | |
| 5 | - * | |
| 6 | - * (c) Francesco Bianco <[email protected]> | |
| 7 | - * | |
| 8 | - * For the full copyright and license information, please view the LICENSE | |
| 9 | - * file that was distributed with this source code. | |
| 10 | - */ | |
| 11 | - | |
| 12 | -namespace AcyMailing\Libraries\Imap2; | |
| 13 | - | |
| 14 | -class Mail | |
| 15 | -{ | |
| 16 | - /** | |
| 17 | - * Copy specified messages to a mailbox. | |
| 18 | - * | |
| 19 | - * @param $imap | |
| 20 | - * @param $messageNums | |
| 21 | - * @param $mailbox | |
| 22 | - * @param $flags | |
| 23 | - * | |
| 24 | - * @return false|mixed | |
| 25 | - */ | |
| 26 | - public static function copy($imap, $messageNums, $mailbox, $flags = 0) | |
| 27 | - { | |
| 28 | - if (!is_a($imap, Connection::class)) { | |
| 29 | - return Errors::invalidImapConnection(debug_backtrace(), 1, false); | |
| 30 | - } | |
| 31 | - | |
| 32 | - if ($flags & CP_MOVE) { | |
| 33 | - return Mail::move($imap, $messageNums, $mailbox, $flags); | |
| 34 | - } | |
| 35 | - | |
| 36 | - $client = $imap->getClient(); | |
| 37 | - | |
| 38 | - if (!($flags & CP_UID)) { | |
| 39 | - $messageNums = ImapHelpers::idToUid($imap, $messageNums); | |
| 40 | - } | |
| 41 | - | |
| 42 | - $from = $imap->getMailboxName(); | |
| 43 | - $to = $mailbox; | |
| 44 | - | |
| 45 | - return $client->copy($messageNums, $from, $to); | |
| 46 | - } | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * Move specified messages to a mailbox. | |
| 50 | - * | |
| 51 | - * @param $imap | |
| 52 | - * @param $messageNums | |
| 53 | - * @param $mailbox | |
| 54 | - * @param $flags | |
| 55 | - * | |
| 56 | - * @return false|mixed | |
| 57 | - */ | |
| 58 | - public static function move($imap, $messageNums, $mailbox, $flags = 0) | |
| 59 | - { | |
| 60 | - if (!is_a($imap, Connection::class)) { | |
| 61 | - return Errors::invalidImapConnection(debug_backtrace(), 1, false); | |
| 62 | - } | |
| 63 | - | |
| 64 | - $client = $imap->getClient(); | |
| 65 | - #$client->setDebug(true); | |
| 66 | - | |
| 67 | - if (!($flags & CP_UID)) { | |
| 68 | - $messageNums = ImapHelpers::idToUid($imap, $messageNums); | |
| 69 | - } | |
| 70 | - | |
| 71 | - return $client->move($messageNums, $imap->getMailboxName(), $mailbox); | |
| 72 | - } | |
| 73 | -} | |