Killed first bug- Message class 'checkFlag' was returning wrong values if the message had been changed with setFlag

This was because the setFlag function was not setting the value stored
in the message object, just the one on the server.
This commit is contained in:
Robert Hafner 2013-12-08 22:48:25 -08:00
parent 68af0ad11f
commit f35a06935d

View File

@ -618,7 +618,7 @@ class Message
*/
public function checkFlag($flag = 'flagged')
{
return (isset($this->status[$flag]) && $this->status[$flag] == true);
return (isset($this->status[$flag]) && $this->status[$flag] === true);
}
/**
@ -634,12 +634,14 @@ class Message
if (!in_array($flag, self::$flagTypes) || $flag == 'recent')
throw new \InvalidArgumentException('Unable to set invalid flag "' . $flag . '"');
$flag = '\\' . ucfirst($flag);
$imapifiedFlag = '\\' . ucfirst($flag);
if ($enable) {
return imap_setflag_full($this->imapStream, $this->uid, $flag, ST_UID);
if ($enable === true) {
$this->status[$flag] = true;
return imap_setflag_full($this->imapStream, $this->uid, $imapifiedFlag, ST_UID);
} else {
return imap_clearflag_full($this->imapStream, $this->uid, $flag, ST_UID);
unset($this->status[$flag]);
return imap_clearflag_full($this->imapStream, $this->uid, $imapifiedFlag, ST_UID);
}
}