Commit 1e9fddb7 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #481 in ZP/z-push from...

Merge pull request #481 in ZP/z-push from bugfix/ZP-1167-some-new-messages-are-outdated-and to develop

* commit '0a87b2a7':
  ZP-1167 Some new messages are outdated and lost when sync. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1167 Some new messages are outdated and lost when sync. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1167 Some new messages are outdated and lost when sync.  Released under the Affero GNU General Public License (AGPL) version 3.
parents 122e59ad 0a87b2a7
......@@ -2249,6 +2249,18 @@ class BackendIMAP extends BackendDiff implements ISearchProvider {
if (is_array($overview)) {
if (isset($overview[0]->date)) {
$epoch_sent = strtotime($overview[0]->date);
if ( $epoch_sent === false ) {
$pattern1 = '/^(Sun|Mon|Tue|Wed|Thu|Fri|Sat), [0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+ [0-9]+:[0-9]+(:[0-9]+)* [+-]+[0-9]+/';
$pattern2 = '/^(Sun|Mon|Tue|Wed|Thu|Fri|Sat), [0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+ [0-9]+:[0-9]+(:[0-9]+)* /';
if (preg_match($pattern1, $overview[0]->date, $matches) == 1) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->imap_inside_cutoffdate(): date: %s, match: %s", $overview[0]->date, $matches[0]));
$epoch_sent = strtotime($matches[0]);
} else if (preg_match($pattern2, $overview[0]->date, $matches) == 1) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->imap_inside_cutoffdate(): date: %s, match: %s", $overview[0]->date, $matches[0]));
$epoch_sent = strtotime($matches[0].' UTC');
}
}
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->imap_inside_cutoffdate(): cutoffdate: %s, epoch_sent: %s", $cutoffdate, $epoch_sent));
$is_inside = ($cutoffdate <= $epoch_sent);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->imap_inside_cutoffdate(): Message is %s cutoffdate range", ($is_inside ? "INSIDE" : "OUTSIDE")));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment