make sure mailbox delimiter is always set with the imap server object after successful connection

This commit is contained in:
Klaus Leithoff 2012-06-08 08:12:37 +00:00
parent 8f5d18a316
commit d6bfcc3add
2 changed files with 13 additions and 6 deletions

View File

@ -1366,7 +1366,7 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi
{
static $cutdate;
if (!empty($cutoffdate) && $cutoffdate >0 && (empty($cutdate) || $cutoffdate != $cutdate)) $cutdate = $cutoffdate;
debugLog (__METHOD__.' for Folder:'.$folderid.' SINCE:'.$cutdate);
debugLog (__METHOD__.' for Folder:'.$folderid.' SINCE:'.$cutdate.'/'.date("d-M-Y", $cutdate));
if (empty($cutdate))
{
$cutdate = egw_time::to('now','ts')-(3600*24*28);
@ -1408,7 +1408,8 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi
}
if ($this->debugLevel>1) debugLog(__METHOD__.' for Folder:'.$_folderName.' Filter:'.array2string($_filter).' Ids:'.array2string($_id).'/'.$id);
if ($this->debugLevel>1) $starttime = microtime (true);
$rv_messages = $this->mail->getHeaders($_folderName, $_startMessage=1, $_numberOfMessages=9999999, $_sort=0, $_reverse=false, $_filter, $_id);
$_numberOfMessages = (empty($cutoffdate)?250:99999);
$rv_messages = $this->mail->getHeaders($_folderName, $_startMessage=1, $_numberOfMessages, $_sort=0, $_reverse=false, $_filter, $_id);
if ($this->debugLevel>1)
{
$endtime = microtime(true) - $starttime;
@ -1554,10 +1555,10 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi
$fmailFolder = $this->folders[$folder];
if (!isset($fmailFolder)) return false;
$parent = explode($fmailFolder->delimiter,$folder);
$delimiter = (isset($fmailFolder->delimiter)?$fmailFolder->delimiter:$this->mail->getHierarchyDelimiter());
$parent = explode($delimiter,$folder);
array_pop($parent);
$parent = implode($fmailFolder->delimiter,$parent);
$parent = implode($delimiter,$parent);
$id = $parent ? $this->createID($account, $parent) : '0';
if ($this->debugLevel>1) debugLog(__METHOD__."('$folder') --> parent=$parent --> $id");

View File

@ -2300,13 +2300,18 @@ class felamimail_bo
{
static $HierarchyDelimiter;
if (is_null($HierarchyDelimiter)) $HierarchyDelimiter =& egw_cache::getSession('felamimail','HierarchyDelimiter');
if (isset($HierarchyDelimiter[$this->icServer->ImapServerId])) return $HierarchyDelimiter[$this->icServer->ImapServerId];
if (isset($HierarchyDelimiter[$this->icServer->ImapServerId]))
{
$this->icServer->mailboxDelimiter = $HierarchyDelimiter[$this->icServer->ImapServerId];
return $HierarchyDelimiter[$this->icServer->ImapServerId];
}
$HierarchyDelimiter[$this->icServer->ImapServerId] = '/';
if(($this->icServer instanceof defaultimap))
{
$HierarchyDelimiter[$this->icServer->ImapServerId] = $this->icServer->getHierarchyDelimiter();
if (PEAR::isError($HierarchyDelimiter[$this->icServer->ImapServerId])) $HierarchyDelimiter[$this->icServer->ImapServerId] = '/';
}
$this->icServer->mailboxDelimiter = $HierarchyDelimiter[$this->icServer->ImapServerId];
return $HierarchyDelimiter[$this->icServer->ImapServerId];
}
@ -3477,6 +3482,7 @@ class felamimail_bo
}
if ( PEAR::isError($tretval) ) egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
//error_log(print_r($this->icServer->_connected,true));
$hD = $this->getHierarchyDelimiter();
return $tretval;
}