Skip to content

Commit decd810

Browse files
committed
IMAP::FT_PEEK removing "Seen" flag issue fixed #33
1 parent ce24f70 commit decd810

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
1717
### Breaking changes
1818
- NaN
1919

20+
## [2.2.2] - 2020-10-20
21+
### Fixed
22+
- IMAP::FT_PEEK removing "Seen" flag issue fixed #33
23+
24+
### Affected Classes
25+
- [Message::class](src/Message.php)
26+
2027
## [2.2.1] - 2020-10-19
2128
### Fixed
2229
- Header decoding problem fixed #31

src/Message.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function __construct($msgn, $msglist, Client $client, $fetch_options = nu
227227
$this->parseBody();
228228
}
229229

230-
if ($this->getFetchFlagsOption() === true && $this->flags->count() == 0) {
230+
if ($this->getFetchFlagsOption() === true) {
231231
$this->parseFlags();
232232
}
233233
}
@@ -395,6 +395,10 @@ private function parseFlags() {
395395
public function parseBody() {
396396
$this->client->openFolder($this->folder_path);
397397

398+
if ($this->fetch_options == IMAP::FT_PEEK && $this->flags->count() == 0) {
399+
$this->parseFlags();
400+
}
401+
398402
$contents = $this->client->getConnection()->content([$this->msgn]);
399403
if (!isset($contents[$this->msgn])) {
400404
throw new MessageContentFetchingException("no content found", 0);
@@ -406,8 +410,7 @@ public function parseBody() {
406410
$this->fetchStructure($this->structure);
407411

408412
if ($this->fetch_options == IMAP::FT_PEEK) {
409-
$this->parseFlags();
410-
if ($this->getFlags()->get("seen") !== null) {
413+
if ($this->getFlags()->get("seen") == null) {
411414
$this->unsetFlag("Seen");
412415
}
413416
}

0 commit comments

Comments
 (0)