From 3112bd98c56ef858ce7b57eaff0f51baee8618f6 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 29 Jul 2011 09:16:54 +0000 Subject: [PATCH] * eMail: (backend) introduce validator for a given eMailProfile ID. A profileID is checked for existence for the active user. If the profileID given does not exist, the next possible valid profileID is returned. This should fix problems regarding the storing of no longer existing profileIDs with the activeProfileID preference. --- notifications/inc/class.notifications_ajax.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notifications/inc/class.notifications_ajax.inc.php b/notifications/inc/class.notifications_ajax.inc.php index de1ada32b9..77599e9b75 100644 --- a/notifications/inc/class.notifications_ajax.inc.php +++ b/notifications/inc/class.notifications_ajax.inc.php @@ -159,11 +159,13 @@ class notifications_ajax { $activeProfile = (int)$GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID']; //error_log(__METHOD__.__LINE__.' (user: '.$this->recipient->account_lid.') Active Profile:'.$activeProfile); $bofelamimail = felamimail_bo::getInstance(true, $activeProfile); + $activeProfile = $GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'] = $bofelamimail->profileID; // buffer felamimail sessiondata, as they are needed for information exchange by the app itself $bufferFMailSession = $bofelamimail->sessionData; if(!$bofelamimail->openConnection($activeProfile)) { // TODO: This is ugly. Log a bit nicer! - error_log(self::_appname.' (user: '.$this->recipient->account_lid.'): cannot connect to mailbox. Please check your prefs!'); + error_log(__METHOD__.__LINE__.' #'.self::_appname.' (user: '.$this->recipient->account_lid.'): cannot connect to mailbox with Profile:'.$activeProfile.'. Please check your prefs!'); + error_log(__METHOD__.__LINE__.' # Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid']); return false; // cannot connect to mailbox } @@ -179,10 +181,12 @@ class notifications_ajax { $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,null,false); if(is_array($headers['header']) && count($headers['header']) > 0) { foreach($headers['header'] as $id=>$header) { + //error_log(__METHOD__.__LINE__.' Found Message:'.$header['uid'].' Subject:'.$header['subject']); // check if unseen mail has already been notified if(!in_array($header['uid'], $this->session_data['notified_mail_uids'][$notify_folder])) { // got a REAL recent message