Skip to content

Commit

Permalink
IMAP::FT_PEEK removing "Seen" flag issue fixed #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Oct 20, 2020
1 parent ce24f70 commit decd810
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
### Breaking changes
- NaN

## [2.2.2] - 2020-10-20
### Fixed
- IMAP::FT_PEEK removing "Seen" flag issue fixed #33

### Affected Classes
- [Message::class](src/Message.php)

## [2.2.1] - 2020-10-19
### Fixed
- Header decoding problem fixed #31
Expand Down
9 changes: 6 additions & 3 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function __construct($msgn, $msglist, Client $client, $fetch_options = nu
$this->parseBody();
}

if ($this->getFetchFlagsOption() === true && $this->flags->count() == 0) {
if ($this->getFetchFlagsOption() === true) {
$this->parseFlags();
}
}
Expand Down Expand Up @@ -395,6 +395,10 @@ private function parseFlags() {
public function parseBody() {
$this->client->openFolder($this->folder_path);

if ($this->fetch_options == IMAP::FT_PEEK && $this->flags->count() == 0) {
$this->parseFlags();
}

$contents = $this->client->getConnection()->content([$this->msgn]);
if (!isset($contents[$this->msgn])) {
throw new MessageContentFetchingException("no content found", 0);
Expand All @@ -406,8 +410,7 @@ public function parseBody() {
$this->fetchStructure($this->structure);

if ($this->fetch_options == IMAP::FT_PEEK) {
$this->parseFlags();
if ($this->getFlags()->get("seen") !== null) {
if ($this->getFlags()->get("seen") == null) {
$this->unsetFlag("Seen");
}
}
Expand Down

0 comments on commit decd810

Please sign in to comment.