Skip to content

Commit

Permalink
Legacy methods (headers, content, flags) fixed #125
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Jun 19, 2021
1 parent 4d02761 commit ea51bd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- Fix setting default mask from config #133 (thanks @shacky)
- Chunked fetch fails in case of less available mails than page size #114
- Protocol::createStream() exception information fixed #137
- Legacy methods (headers, content, flags) fixed #125

### Added
- Disable rfc822 header parsing via config option #115
Expand Down
12 changes: 6 additions & 6 deletions src/Connection/Protocols/LegacyProtocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ public function examineFolder($folder = 'INBOX') {
public function content($uids, $rfc = "RFC822", $uid = false) {
$result = [];
$uids = is_array($uids) ? $uids : [$uids];
foreach ($uids as $uid) {
$result[$uid] = \imap_fetchbody($this->stream, $uid, "", $uid ? IMAP::FT_UID : IMAP::NIL);
foreach ($uids as $id) {
$result[$id] = \imap_fetchbody($this->stream, $id, "", $uid ? IMAP::FT_UID : IMAP::NIL);
}
return $result;
}
Expand All @@ -223,8 +223,8 @@ public function content($uids, $rfc = "RFC822", $uid = false) {
public function headers($uids, $rfc = "RFC822", $uid = false){
$result = [];
$uids = is_array($uids) ? $uids : [$uids];
foreach ($uids as $uid) {
$result[$uid] = \imap_fetchheader($this->stream, $uid, $uid ? IMAP::FT_UID : IMAP::NIL);
foreach ($uids as $id) {
$result[$id] = \imap_fetchheader($this->stream, $id, $uid ? IMAP::FT_UID : IMAP::NIL);
}
return $result;
}
Expand All @@ -239,8 +239,8 @@ public function headers($uids, $rfc = "RFC822", $uid = false){
public function flags($uids, $uid = false){
$result = [];
$uids = is_array($uids) ? $uids : [$uids];
foreach ($uids as $uid) {
$raw_flags = \imap_fetch_overview($this->stream, $uid, $uid ? IMAP::FT_UID : IMAP::NIL);
foreach ($uids as $id) {
$raw_flags = \imap_fetch_overview($this->stream, $id, $uid ? IMAP::FT_UID : IMAP::NIL);
$flags = [];
if (is_array($raw_flags) && isset($raw_flags[0])) {
$raw_flags = (array) $raw_flags[0];
Expand Down

0 comments on commit ea51bd7

Please sign in to comment.