Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder Overview #278

Closed
epocci opened this issue Sep 8, 2022 · 3 comments
Closed

Folder Overview #278

epocci opened this issue Sep 8, 2022 · 3 comments

Comments

@epocci
Copy link

epocci commented Sep 8, 2022

Describe the bug
If you call $folder->overview("10:1") we got an error.

Expected behavior
Inverted sequence of emails

Additional context
Change code into ImapProtocol.php:

public function overview(string $sequence, $uid = IMAP::ST_UID): array {
        $result = [];
        list($from, $to) = explode(":", $sequence);

to:

public function overview(string $sequence, $uid = IMAP::ST_UID): array {
        $result = [];
        list($from, $to) = explode(":", $sequence);
        if($to<$from){
            list($to, $from) = explode(":", $sequence);
        }
@epocci epocci changed the title Folder Owerview Folder Overview Sep 8, 2022
@epocci
Copy link
Author

epocci commented Sep 9, 2022

An improved i made is add flags and size.

foreach ($headers as $id => $raw_header) {
            $result[$id] = (new Header($raw_header, false))->getAttributes();
            $result[$id]["UID"]=$uids[$id];
        }
        $flags = $this->flags($ids, $uid);
        foreach ($flags as $id => $flag) {
            $result[$id]["flags"] = $flag;
        }
        $sizes = $this->sizes($ids, "RFC822", $uid);
        foreach ($sizes as $id => $size) {
            $result[$id]["size"] = $size;
        }

I added a function for size:

public function sizes($uids, string $rfc = "RFC822", $uid = IMAP::ST_UID): array {
        $result = $this->fetch(["$rfc.SIZE"], $uids, null, $uid);
        return is_array($result) ? $result : [];
    }

@Webklex
Copy link
Owner

Webklex commented Sep 9, 2022

Hi @epocci ,
thanks for your report. I'm not sure if this is a bug or rather expected behavior. If we implement your suggested change, it might cause more confusion.

Please feel free to create a pull request to implement seize method, seems like a useful extension :) However I'm not sure about the code above, is that your example code or logic you want to implement?

Best regards & happy coding,

@Webklex
Copy link
Owner

Webklex commented Mar 16, 2023

Please update to v5.1 and give it another try.
If you are currently using an older version below v5.0, please read the breaking changes leading up to v5.1 before upgrading.

Best regards,

@Webklex Webklex closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants