|
|
|
@ -1504,22 +1504,19 @@ class rcube_imap
|
|
|
|
|
*
|
|
|
|
|
* @param mixed Message UIDs as array or as comma-separated string
|
|
|
|
|
* @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT
|
|
|
|
|
* @param boolean Simulate flagging (don't set flag on IMAP server)
|
|
|
|
|
* @return boolean True on success, False on failure
|
|
|
|
|
*/
|
|
|
|
|
function set_flag($uids, $flag, $fake=false)
|
|
|
|
|
function set_flag($uids, $flag)
|
|
|
|
|
{
|
|
|
|
|
$flag = strtoupper($flag);
|
|
|
|
|
$msg_ids = array();
|
|
|
|
|
if (!is_array($uids))
|
|
|
|
|
$uids = explode(',',$uids);
|
|
|
|
|
|
|
|
|
|
if (!$fake || $this->caching_enabled)
|
|
|
|
|
foreach ($uids as $uid) {
|
|
|
|
|
$msg_ids[$uid] = $this->_uid2id($uid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$fake) {
|
|
|
|
|
if ($flag=='UNDELETED')
|
|
|
|
|
$result = iil_C_Undelete($this->conn, $this->mailbox, join(',', array_values($msg_ids)));
|
|
|
|
|
else if ($flag=='UNSEEN')
|
|
|
|
@ -1528,12 +1525,13 @@ class rcube_imap
|
|
|
|
|
$result = iil_C_UnFlag($this->conn, $this->mailbox, join(',', array_values($msg_ids)), 'FLAGGED');
|
|
|
|
|
else
|
|
|
|
|
$result = iil_C_Flag($this->conn, $this->mailbox, join(',', array_values($msg_ids)), $flag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// reload message headers if cached
|
|
|
|
|
if ($this->caching_enabled) {
|
|
|
|
|
$cache_key = $this->mailbox.'.msg';
|
|
|
|
|
foreach ($msg_ids as $uid => $id) {
|
|
|
|
|
if ($this->caching_enabled)
|
|
|
|
|
{
|
|
|
|
|
foreach ($msg_ids as $uid => $id)
|
|
|
|
|
{
|
|
|
|
|
if ($cached_headers = $this->get_cached_message($cache_key, $uid))
|
|
|
|
|
{
|
|
|
|
|
$this->remove_message_cache($cache_key, $id);
|
|
|
|
@ -1547,7 +1545,7 @@ class rcube_imap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set nr of messages that were flaged
|
|
|
|
|
$count = count($uids);
|
|
|
|
|
$count = count($msg_ids);
|
|
|
|
|
|
|
|
|
|
// clear message count cache
|
|
|
|
|
if ($result && $flag=='SEEN')
|
|
|
|
|