mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-06 10:39:21 +03:00
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:
parent
68af0ad11f
commit
f35a06935d
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user