git subrepo commit (merge) mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "02ae5285"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "649a5c01"
git-subrepo: version: "0.4.3"
origin: "???"
commit: "???"
Change-Id: I870ad468fba026cc5abf3c5699ed1e12ff28b32b
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/ddeboer/imap/src/Mailbox.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/ddeboer/imap/src/Mailbox.php
index 1544aff..2f77799 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/ddeboer/imap/src/Mailbox.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/ddeboer/imap/src/Mailbox.php
@@ -18,20 +18,9 @@
*/
final class Mailbox implements MailboxInterface
{
- /**
- * @var ImapResourceInterface
- */
- private $resource;
-
- /**
- * @var string
- */
- private $name;
-
- /**
- * @var \stdClass
- */
- private $info;
+ private ImapResourceInterface $resource;
+ private string $name;
+ private \stdClass $info;
/**
* Constructor.
@@ -47,17 +36,11 @@
$this->info = $info;
}
- /**
- * Get mailbox decoded name.
- */
public function getName(): string
{
return $this->name;
}
- /**
- * Get mailbox encoded path.
- */
public function getEncodedName(): string
{
/** @var string $name */
@@ -66,35 +49,21 @@
return (string) \preg_replace('/^{.+}/', '', $name);
}
- /**
- * Get mailbox encoded full name.
- */
public function getFullEncodedName(): string
{
return $this->info->name;
}
- /**
- * Get mailbox attributes.
- */
public function getAttributes(): int
{
return $this->info->attributes;
}
- /**
- * Get mailbox delimiter.
- */
public function getDelimiter(): string
{
return $this->info->delimiter;
}
- /**
- * Get number of messages in this mailbox.
- *
- * @return int
- */
public function count()
{
$return = \imap_num_msg($this->resource->getStream());
@@ -106,9 +75,6 @@
return $return;
}
- /**
- * Get Mailbox status.
- */
public function getStatus(int $flags = null): \stdClass
{
$return = \imap_status($this->resource->getStream(), $this->getFullEncodedName(), $flags ?? \SA_ALL);
@@ -120,33 +86,16 @@
return $return;
}
- /**
- * Bulk Set Flag for Messages.
- *
- * @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
- * @param array|MessageIterator|string $numbers Message numbers
- */
public function setFlag(string $flag, $numbers): bool
{
return \imap_setflag_full($this->resource->getStream(), $this->prepareMessageIds($numbers), $flag, \ST_UID);
}
- /**
- * Bulk Clear Flag for Messages.
- *
- * @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
- * @param array|MessageIterator|string $numbers Message numbers
- */
public function clearFlag(string $flag, $numbers): bool
{
return \imap_clearflag_full($this->resource->getStream(), $this->prepareMessageIds($numbers), $flag, \ST_UID);
}
- /**
- * Get message ids.
- *
- * @param ConditionInterface $search Search expression (optional)
- */
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface
{
if (null === $search) {
@@ -199,11 +148,6 @@
return new MessageIterator($this->resource, $messageNumbers);
}
- /**
- * Get message iterator for a sequence.
- *
- * @param string $sequence Message numbers
- */
public function getMessageSequence(string $sequence): MessageIteratorInterface
{
\imap_errors();
@@ -223,54 +167,38 @@
return new MessageIterator($this->resource, $messageNumbers);
}
- /**
- * Get a message by message number.
- *
- * @param int $number Message number
- */
public function getMessage(int $number): MessageInterface
{
return new Message($this->resource, $number);
}
- /**
- * Get messages in this mailbox.
- */
public function getIterator(): MessageIteratorInterface
{
return $this->getMessages();
}
- /**
- * Add a message to the mailbox.
- */
public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool
{
$arguments = [
$this->resource->getStream(),
$this->getFullEncodedName(),
$message,
+ $options ?? '',
];
- if (null !== $options) {
- $arguments[] = $options;
- if (null !== $internalDate) {
- $arguments[] = $internalDate->format('d-M-Y H:i:s O');
- }
+ if (null !== $internalDate) {
+ $arguments[] = $internalDate->format('d-M-Y H:i:s O');
}
return \imap_append(...$arguments);
}
- /**
- * Returns a tree of threaded message for the current Mailbox.
- */
public function getThread(): array
{
\set_error_handler(static function (): bool {
return true;
});
- /** @var array|false $tree */
+ /** @var array<string, int>|false $tree */
$tree = \imap_thread($this->resource->getStream(), \SE_UID);
\restore_error_handler();
@@ -278,29 +206,13 @@
return false !== $tree ? $tree : [];
}
- /**
- * Bulk move messages.
- *
- * @param array|MessageIterator|string $numbers Message numbers
- * @param MailboxInterface $mailbox Destination Mailbox to move the messages to
- *
- * @throws \Ddeboer\Imap\Exception\MessageMoveException
- */
public function move($numbers, MailboxInterface $mailbox): void
{
- if (!\imap_mail_move($this->resource->getStream(), $this->prepareMessageIds($numbers), $mailbox->getEncodedName(), \CP_UID)) {
+ if (!\imap_mail_copy($this->resource->getStream(), $this->prepareMessageIds($numbers), $mailbox->getEncodedName(), \CP_UID | \CP_MOVE)) {
throw new MessageMoveException(\sprintf('Messages cannot be moved to "%s"', $mailbox->getName()));
}
}
- /**
- * Bulk copy messages.
- *
- * @param array|MessageIterator|string $numbers Message numbers
- * @param MailboxInterface $mailbox Destination Mailbox to copy the messages to
- *
- * @throws \Ddeboer\Imap\Exception\MessageCopyException
- */
public function copy($numbers, MailboxInterface $mailbox): void
{
if (!\imap_mail_copy($this->resource->getStream(), $this->prepareMessageIds($numbers), $mailbox->getEncodedName(), \CP_UID)) {
@@ -311,7 +223,7 @@
/**
* Prepare message ids for the use with bulk functions.
*
- * @param array|MessageIterator|string $messageIds Message numbers
+ * @param array<int, int|string>|MessageIterator|string $messageIds Message numbers
*/
private function prepareMessageIds($messageIds): string
{