/** * @param Array $messageIndexSet * @param bool $indexAsUid * @param Folder $folder * @param int $flags * @param short $action * @return bool */ function SetMessagesFlags(&$messageIndexSet, $indexAsUid, &$folder, $flags, $action) { if ($this->_imapMail->open_mailbox($folder->FullName, false)) { $flagsStr = ''; if (($flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen) { $flagsStr .= ' \\Seen'; } if (($flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged) { $flagsStr .= ' \\Flagged'; } if (($flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted) { $flagsStr .= ' \\Deleted'; } if (($flags & MESSAGEFLAGS_Answered) == MESSAGEFLAGS_Answered) { $flagsStr .= ' \\Answered'; } $messageIndexes = $actionName = null; switch ($action) { case ACTION_Set: $actionName = '+FLAGS'; break; case ACTION_Remove: $actionName = '-FLAGS'; break; } if ($messageIndexSet == null) { $messageIndexes = '1:*'; $indexAsUid = false; if ($this->isMailBoxEmpty()) { return true; } } else { $messageIndexes = implode(',', $messageIndexSet); } if (null !== $actionName && '' !== $flagsStr) { if ($indexAsUid) { return $this->_imapMail->uid_store_mail_flag($messageIndexes, $actionName, $flagsStr); } else { return $this->_imapMail->store_mail_flag($messageIndexes, $actionName, $flagsStr); } } } return false; }