mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 12:41:10 +01:00
* Mail: fix problem on not applied but possibly set status filter on all message actions for flagging
This commit is contained in:
parent
9afa8acaae
commit
d84b700517
@ -3366,100 +3366,122 @@ class emailadmin_imapbase
|
|||||||
if (self::$debug) error_log(__METHOD__." no messages Message(s): ".implode(',',$_messageUID));
|
if (self::$debug) error_log(__METHOD__." no messages Message(s): ".implode(',',$_messageUID));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
elseif ($_messageUID==='all')
|
$this->icServer->openMailbox(($_folder?$_folder:$this->sessionData['mailbox']));
|
||||||
|
$folder = $this->icServer->getCurrentMailbox();
|
||||||
|
if (is_array($_messageUID)&& count($_messageUID)>50)
|
||||||
{
|
{
|
||||||
$uidsToModify= null;
|
$count = $this->getMailBoxCounters($folder,true);
|
||||||
|
if ($count->messages == count($_messageUID)) $_messageUID='all';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_messageUID==='all')
|
||||||
|
{
|
||||||
|
$messageUIDs = array('all');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$uidsToModify = new Horde_Imap_Client_Ids();
|
|
||||||
if (!(is_object($_messageUID) || is_array($_messageUID))) $_messageUID = (array)$_messageUID;
|
if (!(is_object($_messageUID) || is_array($_messageUID))) $_messageUID = (array)$_messageUID;
|
||||||
$uidsToModify->add($_messageUID);
|
$messageUIDs = array_chunk($_messageUID,50,true);
|
||||||
}
|
}
|
||||||
|
try
|
||||||
$this->icServer->openMailbox(($_folder?$_folder:$this->sessionData['mailbox']));
|
{
|
||||||
$folder = $this->icServer->getCurrentMailbox();;
|
foreach($messageUIDs as $k => $uids)
|
||||||
switch($_flag) {
|
{
|
||||||
case "delete":
|
if ($uids==='all')
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('\\Deleted'), 'ids'=> $uidsToModify));
|
{
|
||||||
break;
|
$uidsToModify=null;
|
||||||
case "undelete":
|
}
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('\\Deleted'), 'ids'=> $uidsToModify));
|
else
|
||||||
break;
|
{
|
||||||
case "flagged":
|
$uidsToModify = new Horde_Imap_Client_Ids();
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('\\Flagged'), 'ids'=> $uidsToModify));
|
$uidsToModify->add($uids);
|
||||||
break;
|
}
|
||||||
case "read":
|
switch($_flag) {
|
||||||
case "seen":
|
case "delete":
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('\\Seen'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('add'=>array('\\Deleted'), 'ids'=> $uidsToModify));
|
||||||
break;
|
break;
|
||||||
case "forwarded":
|
case "undelete":
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$Forwarded'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('remove'=>array('\\Deleted'), 'ids'=> $uidsToModify));
|
||||||
case "answered":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('\\Answered'), 'ids'=> $uidsToModify));
|
case "flagged":
|
||||||
break;
|
$ret = $this->icServer->store($folder, array('add'=>array('\\Flagged'), 'ids'=> $uidsToModify));
|
||||||
case "unflagged":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('\\Flagged'), 'ids'=> $uidsToModify));
|
case "read":
|
||||||
break;
|
case "seen":
|
||||||
case "unread":
|
$ret = $this->icServer->store($folder, array('add'=>array('\\Seen'), 'ids'=> $uidsToModify));
|
||||||
case "unseen":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('\\Seen','\\Answered','$Forwarded'), 'ids'=> $uidsToModify));
|
case "forwarded":
|
||||||
break;
|
$ret = $this->icServer->store($folder, array('add'=>array('$Forwarded'), 'ids'=> $uidsToModify));
|
||||||
case "mdnsent":
|
case "answered":
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('MDNSent'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('add'=>array('\\Answered'), 'ids'=> $uidsToModify));
|
||||||
break;
|
break;
|
||||||
case "mdnnotsent":
|
case "unflagged":
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('MDNnotSent'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('remove'=>array('\\Flagged'), 'ids'=> $uidsToModify));
|
||||||
break;
|
break;
|
||||||
case "label1":
|
case "unread":
|
||||||
case "labelone":
|
case "unseen":
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$label1'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('remove'=>array('\\Seen','\\Answered','$Forwarded'), 'ids'=> $uidsToModify));
|
||||||
break;
|
break;
|
||||||
case "unlabel1":
|
case "mdnsent":
|
||||||
case "unlabelone":
|
$ret = $this->icServer->store($folder, array('add'=>array('MDNSent'), 'ids'=> $uidsToModify));
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
|
break;
|
||||||
break;
|
case "mdnnotsent":
|
||||||
case "label2":
|
$ret = $this->icServer->store($folder, array('add'=>array('MDNnotSent'), 'ids'=> $uidsToModify));
|
||||||
case "labeltwo":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$label2'), 'ids'=> $uidsToModify));
|
case "label1":
|
||||||
break;
|
case "labelone":
|
||||||
case "unlabel2":
|
$ret = $this->icServer->store($folder, array('add'=>array('$label1'), 'ids'=> $uidsToModify));
|
||||||
case "unlabeltwo":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
|
case "unlabel1":
|
||||||
break;
|
case "unlabelone":
|
||||||
case "label3":
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
|
||||||
case "labelthree":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$label3'), 'ids'=> $uidsToModify));
|
case "label2":
|
||||||
break;
|
case "labeltwo":
|
||||||
case "unlabel3":
|
$ret = $this->icServer->store($folder, array('add'=>array('$label2'), 'ids'=> $uidsToModify));
|
||||||
case "unlabelthree":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
|
case "unlabel2":
|
||||||
break;
|
case "unlabeltwo":
|
||||||
case "label4":
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
|
||||||
case "labelfour":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$label4'), 'ids'=> $uidsToModify));
|
case "label3":
|
||||||
break;
|
case "labelthree":
|
||||||
case "unlabel4":
|
$ret = $this->icServer->store($folder, array('add'=>array('$label3'), 'ids'=> $uidsToModify));
|
||||||
case "unlabelfour":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
|
case "unlabel3":
|
||||||
break;
|
case "unlabelthree":
|
||||||
case "label5":
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
|
||||||
case "labelfive":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('add'=>array('$label5'), 'ids'=> $uidsToModify));
|
case "label4":
|
||||||
break;
|
case "labelfour":
|
||||||
case "unlabel5":
|
$ret = $this->icServer->store($folder, array('add'=>array('$label4'), 'ids'=> $uidsToModify));
|
||||||
case "unlabelfive":
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
|
case "unlabel4":
|
||||||
break;
|
case "unlabelfour":
|
||||||
case "unlabel":
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
|
break;
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
|
case "label5":
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
|
case "labelfive":
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
|
$ret = $this->icServer->store($folder, array('add'=>array('$label5'), 'ids'=> $uidsToModify));
|
||||||
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
|
break;
|
||||||
break;
|
case "unlabel5":
|
||||||
|
case "unlabelfive":
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
|
||||||
|
break;
|
||||||
|
case "unlabel":
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label1'), 'ids'=> $uidsToModify));
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label2'), 'ids'=> $uidsToModify));
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label3'), 'ids'=> $uidsToModify));
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label4'), 'ids'=> $uidsToModify));
|
||||||
|
$ret = $this->icServer->store($folder, array('remove'=>array('$label5'), 'ids'=> $uidsToModify));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
error_log(__METHOD__.__LINE__.' Error, could not flag messages in folder '.$folder.' Reason:'.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$folderStatusCache[$this->profileID][(!empty($_folder)?$_folder: $this->sessionData['mailbox'])]['uidValidity'] = 0;
|
self::$folderStatusCache[$this->profileID][(!empty($_folder)?$_folder: $this->sessionData['mailbox'])]['uidValidity'] = 0;
|
||||||
|
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.'->' .$_flag." ".array2string($_messageUID).",".($_folder?$_folder:$this->sessionData['mailbox']));
|
//error_log(__METHOD__.' ('.__LINE__.') '.'->' .$_flag." ".array2string($_messageUID).",".($_folder?$_folder:$this->sessionData['mailbox']));
|
||||||
|
@ -4203,13 +4203,13 @@ class mail_ui
|
|||||||
if (count($messageListForToggle)>0)
|
if (count($messageListForToggle)>0)
|
||||||
{
|
{
|
||||||
$flag2set = (strtolower($_flag));
|
$flag2set = (strtolower($_flag));
|
||||||
//error_log(__METHOD__.__LINE__." toggle un$_flag -> $flag2set ".array2string($filter2toggle).array2string($messageListForToggle));
|
if(mail_bo::$debug) error_log(__METHOD__.__LINE__." toggle un$_flag -> $flag2set ".array2string($filter2toggle).array2string($messageListForToggle));
|
||||||
$this->mail_bo->flagMessages($flag2set, $messageListForToggle,$folder);
|
$this->mail_bo->flagMessages($flag2set, $messageListForToggle,$folder);
|
||||||
}
|
}
|
||||||
if (count($messageList)>0)
|
if (count($messageList)>0)
|
||||||
{
|
{
|
||||||
$flag2set = 'un'.$_flag;
|
$flag2set = 'un'.$_flag;
|
||||||
//error_log(__METHOD__.__LINE__." $_flag -> $flag2set ".array2string($filter).array2string($messageList));
|
if(mail_bo::$debug) error_log(__METHOD__.__LINE__." $_flag -> $flag2set ".array2string($filter).array2string($messageList));
|
||||||
$this->mail_bo->flagMessages($flag2set, $messageList,$folder);
|
$this->mail_bo->flagMessages($flag2set, $messageList,$folder);
|
||||||
}
|
}
|
||||||
$alreadyFlagged=true;
|
$alreadyFlagged=true;
|
||||||
@ -4219,6 +4219,13 @@ class mail_ui
|
|||||||
(in_array($_flag,array('read','flagged','label1','label2','label3','label4','label5')) &&
|
(in_array($_flag,array('read','flagged','label1','label2','label3','label4','label5')) &&
|
||||||
($flag2check==$query['filter'] || stripos($query['filter'],$flag2check)!==false))))
|
($flag2check==$query['filter'] || stripos($query['filter'],$flag2check)!==false))))
|
||||||
{
|
{
|
||||||
|
if ($query['filter'] && $query['filter'] !='any')
|
||||||
|
{
|
||||||
|
$filter['status'] = $query['filter'];
|
||||||
|
// since we toggle and we toggle by the filtered flag we must must change _flag
|
||||||
|
$_flag = ($query['filter']=='unseen' && $_flag=='read' ? 'read' : ($query['filter']=='seen'&& $_flag=='read'?'unread':($_flag==$query['filter']?'un'.$_flag:$_flag)));
|
||||||
|
}
|
||||||
|
if(mail_bo::$debug) error_log(__METHOD__.__LINE__." flag all with $_flag on filter used:".array2string($filter));
|
||||||
$_sR = $this->mail_bo->getSortedList(
|
$_sR = $this->mail_bo->getSortedList(
|
||||||
$folder,
|
$folder,
|
||||||
$sort=0,
|
$sort=0,
|
||||||
@ -4233,7 +4240,7 @@ class mail_ui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.__LINE__." $_flag all ".array2string($filter));
|
if(mail_bo::$debug) error_log(__METHOD__.__LINE__." $_flag all ".array2string($filter));
|
||||||
$alreadyFlagged=true;
|
$alreadyFlagged=true;
|
||||||
$uidA = self::splitRowID($_messageList['msg'][0]);
|
$uidA = self::splitRowID($_messageList['msg'][0]);
|
||||||
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
||||||
@ -4253,7 +4260,7 @@ class mail_ui
|
|||||||
$hA = self::splitRowID($rowID);
|
$hA = self::splitRowID($rowID);
|
||||||
$messageList[] = $hA['msgUID'];
|
$messageList[] = $hA['msgUID'];
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__.__LINE__." $_flag in $folder:".array2string(((isset($_messageList['all']) && $_messageList['all']) ? 'all':$messageList)));
|
if(mail_bo::$debug) error_log(__METHOD__.__LINE__." $_flag in $folder:".array2string(((isset($_messageList['all']) && $_messageList['all']) ? 'all':$messageList)));
|
||||||
$this->mail_bo->flagMessages($_flag, ((isset($_messageList['all']) && $_messageList['all']) ? 'all':$messageList),$folder);
|
$this->mail_bo->flagMessages($_flag, ((isset($_messageList['all']) && $_messageList['all']) ? 'all':$messageList),$folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user