-
Notifications
You must be signed in to change notification settings - Fork 8
Added option for setting fetched emails \\seen flag to seen #7
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
base: master
Are you sure you want to change the base?
Conversation
mnapoli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution. I am not sure I understand everything here.
Will it change the behavior of the library? I.e. you set the default value for $peek as true -> is that already the case today?
And given the code, when you set it tofalse it doesn't seem to do anything different when the query is sent.
| * @param boolean $peek | ||
| */ | ||
| public function setPeek($peek) { | ||
| $this->peek = $peek; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $this->peek variable is set but it seems it's never read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure for some reasons the read method was not in the version i pushed.
| * @return Email[] | ||
| */ | ||
| public function getEmails(Query $query = null) : array | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The { should be on a new line (this is the PSR-2 coding standard). This comment applies also below on other methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok IDE auto format will sort it out.
| if ($query->getYoungerThan() !== null) { | ||
| $hordeQuery->intervalSearch( | ||
| $query->getYoungerThan(), | ||
| Horde_Imap_Client_Search_Query::INTERVAL_YOUNGER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are those lines changed? Those were formatted to follow PSR-2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please revert those changes?
src/Client.php
Outdated
| } | ||
|
|
||
| /** | ||
| * @param String $id Description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be removed (there is no additional information, the type-hint is enough)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
| /** | ||
| * @param String $id Description | ||
| * @param boolean $peek sets the peek option, "false" fetched emails' state will be set to seen "true" no change of state default is true | ||
| * @param String $folder the folder to get email from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String -> string
|
I dont know how but the get method for property peek was not in the version i pushed, As if that is not funny enough, the line 196 which is the whole point of the contribution was also not changed. fixed it. |
|
Did fix the issues, did you get some time to check it? |
| * | ||
| * @var boolean | ||
| */ | ||
| private $peek; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not store state into a property in this class. The Client class is a service, it should be stateless.
You should instead pass the $peek value in parameters of method calls.
|
|
||
| ->getQuery(); | ||
|
|
||
| $emails = $client->getEmails($query,'INBOX', false); // set to "false" fetched emails' state will be set to seen. "true" no change of state will occur. default is true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a space between $query,'INBOX'
Also could you put the comment at the start of the line above? That will be easier to read, else there will be a scrollbar on GitHub.
| const FLAG_DRAFT = 'DRAFT'; | ||
| const FLAG_FLAGED = 'FLAGGED'; | ||
| const FLAG_RECENT = 'RECENT'; | ||
| const FLAG_SEEN = 'SEEN'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
Hi
I just added option for setting fetched emails \seen flag to seen. i added an option on both the
getEmails()andgetEmailIds()methods as a second optional argument. Advise if its ok. thanks