Skip to content

Conversation

@katwekibs
Copy link
Contributor

Hi
I just added option for setting fetched emails \seen flag to seen. i added an option on both the getEmails() and getEmailIds() methods as a second optional argument. Advise if its ok. thanks

Copy link
Owner

@mnapoli mnapoli left a 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;
Copy link
Owner

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?

Copy link
Contributor Author

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
{
Copy link
Owner

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.

Copy link
Contributor Author

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
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE

Copy link
Owner

@mnapoli mnapoli Nov 18, 2017

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
Copy link
Owner

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)

Copy link
Contributor Author

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String -> string

@katwekibs
Copy link
Contributor Author

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.

$query->fullText([
           'peek' => $this->getPeek(),
       ]);

fixed it.

@katwekibs
Copy link
Contributor Author

Did fix the issues, did you get some time to check it?

*
* @var boolean
*/
private $peek;
Copy link
Owner

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
Copy link
Owner

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';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

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

Successfully merging this pull request may close these issues.

2 participants