Skip to content

Commit 9a666fe

Browse files
committed
Introduce peek
1 parent 838a444 commit 9a666fe

File tree

6 files changed

+66
-496
lines changed

6 files changed

+66
-496
lines changed

src/Connection/ConnectionInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public function uids(int|array $msgns): ResponseCollection;
7878
/**
7979
* Fetch message contents.
8080
*/
81-
public function contents(int|array $ids): ResponseCollection;
81+
public function contents(int|array $ids, bool $peek = true): ResponseCollection;
8282

8383
/**
8484
* Fetch message headers.
8585
*/
86-
public function headers(int|array $ids): ResponseCollection;
86+
public function headers(int|array $ids, bool $peek = true): ResponseCollection;
8787

8888
/**
8989
* Fetch message flags.

src/Connection/ImapConnection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,17 @@ public function uids(int|array $msgns): ResponseCollection
282282
/**
283283
* {@inheritDoc}
284284
*/
285-
public function contents(int|array $ids): ResponseCollection
285+
public function contents(int|array $ids, bool $peek = true): ResponseCollection
286286
{
287-
return $this->fetch(['BODY[TEXT]'], (array) $ids);
287+
return $this->fetch([$peek ? 'BODY.PEEK[TEXT]' : 'BODY[TEXT]'], (array) $ids);
288288
}
289289

290290
/**
291291
* {@inheritDoc}
292292
*/
293-
public function headers(int|array $ids): ResponseCollection
293+
public function headers(int|array $ids, bool $peek = true): ResponseCollection
294294
{
295-
return $this->fetch(['BODY[HEADER]'], (array) $ids);
295+
return $this->fetch([$peek ? 'BODY.PEEK[HEADER]' : 'BODY[HEADER]'], (array) $ids);
296296
}
297297

298298
/**

0 commit comments

Comments
 (0)