summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-01-22 14:49:50 +0000
committeralecpl <alec@alec.pl>2009-01-22 14:49:50 +0000
commitbc39ad2a22742d7d73242e9ccb0b947311ccc7f0 (patch)
treef401e593947744ad8454042995b213e9cad69461 /program
parentaa055c931a68547763f7bb89425a08e8ceecb749 (diff)
- fix r2251
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.php48
1 files changed, 23 insertions, 25 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 8511628cd..f8737e3a2 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1504,36 +1504,34 @@ 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')
- $result = iil_C_Unseen($this->conn, $this->mailbox, join(',', array_values($msg_ids)));
- else if ($flag=='UNFLAGGED')
- $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);
- }
-
+ foreach ($uids as $uid) {
+ $msg_ids[$uid] = $this->_uid2id($uid);
+ }
+
+ if ($flag=='UNDELETED')
+ $result = iil_C_Undelete($this->conn, $this->mailbox, join(',', array_values($msg_ids)));
+ else if ($flag=='UNSEEN')
+ $result = iil_C_Unseen($this->conn, $this->mailbox, join(',', array_values($msg_ids)));
+ else if ($flag=='UNFLAGGED')
+ $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) {
+ $cache_key = $this->mailbox.'.msg';
+ 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')
@@ -2940,9 +2938,9 @@ class rcube_imap
}
if (empty($result[$key]['name']))
- $result[$key]['name'] = $result[$key]['address'];
- elseif (empty($result[$key]['address']))
- $result[$key]['address'] = $result[$key]['name'];
+ $result[$key]['name'] = $result[$key]['address'];
+ elseif (empty($result[$key]['address']))
+ $result[$key]['address'] = $result[$key]['name'];
}
return $result;