| @@ -1,59 +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 ImapHelpers | |
| 15 | -{ | |
| 16 | - /** | |
| 17 | - * Convert a string contain a sequence of message id to and equivalent with uid. | |
| 18 | - * | |
| 19 | - * @param $imap | |
| 20 | - * @param $messageNums | |
| 21 | - * | |
| 22 | - * @return string | |
| 23 | - */ | |
| 24 | - public static function idToUid($imap, $messageNums) | |
| 25 | - { | |
| 26 | - $client = $imap->getClient(); | |
| 27 | - | |
| 28 | - $messages = $client->fetch($imap->getMailboxName(), $messageNums, false, ['UID']); | |
| 29 | - | |
| 30 | - $uid = []; | |
| 31 | - foreach ($messages as $message) { | |
| 32 | - $uid[] = $message->uid; | |
| 33 | - } | |
| 34 | - | |
| 35 | - return implode(',', $uid); | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * Convert a string contain a sequence of uid(s) to an equivalent with id(s). | |
| 40 | - * | |
| 41 | - * @param $imap | |
| 42 | - * @param $messageUid | |
| 43 | - * | |
| 44 | - * @return string | |
| 45 | - */ | |
| 46 | - public static function uidToId($imap, $messageUid) | |
| 47 | - { | |
| 48 | - $client = $imap->getClient(); | |
| 49 | - | |
| 50 | - $messages = $client->fetch($imap->getMailboxName(), $messageUid, true, ['UID']); | |
| 51 | - | |
| 52 | - $id = []; | |
| 53 | - foreach ($messages as $message) { | |
| 54 | - $id[] = $message->id; | |
| 55 | - } | |
| 56 | - | |
| 57 | - return implode(',', $id); | |
| 58 | - } | |
| 59 | -} | |