From 560f734db90e73ecfe8e9e7549073dd9d10e97be Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 2 Aug 2011 12:28:14 +0000 Subject: [PATCH] * notification/email: support filter since (only check unseen mails for the last 14 days) when notify for unseen mails --- felamimail/inc/class.bofelamimail.inc.php | 2 +- notifications/inc/class.notifications_ajax.inc.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/felamimail/inc/class.bofelamimail.inc.php b/felamimail/inc/class.bofelamimail.inc.php index eb12a25652..54cd1033a3 100644 --- a/felamimail/inc/class.bofelamimail.inc.php +++ b/felamimail/inc/class.bofelamimail.inc.php @@ -454,7 +454,7 @@ case 'BEFORE': case 'ON': case 'SINCE': - $imapFilter .= $criteria .' "'. date() .'" '; + $imapFilter .= $criteria .' '. $_criterias['string'].' '; break; } #} diff --git a/notifications/inc/class.notifications_ajax.inc.php b/notifications/inc/class.notifications_ajax.inc.php index 68e1a78183..4bfa2013c7 100644 --- a/notifications/inc/class.notifications_ajax.inc.php +++ b/notifications/inc/class.notifications_ajax.inc.php @@ -153,7 +153,12 @@ class notifications_ajax { $this->session_data['notified_mail_uids'][$notify_folder] = array(); } $folder_status[$notify_folder] = $bofelamimail->getFolderStatus($notify_folder); - $headers = $bofelamimail->getHeaders($notify_folder, 1, false, 0, true, array('status'=>'UNSEEN')); + $cutoffdate = time(); + $cutoffdate = $cutoffdate - (60*60*24*14); // last 14 days + $_filter = array('status'=>'UNSEEN','type'=>"SINCE",'string'=> date("d-M-Y", $cutoffdate)); + //error_log(__METHOD__.__LINE__.' (user: '.$this->recipient->account_lid.') Mailbox:'.$notify_folder.' filter:'.array2string($_filter)); + // $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true + $headers = $bofelamimail->getHeaders($notify_folder, 1, 999, 0, true, $_filter); if(is_array($headers['header']) && count($headers['header']) > 0) { foreach($headers['header'] as $id=>$header) { // check if unseen mail has already been notified