diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php index b2e10be9..9a6d323e 100644 --- a/inc/caldav-REPORT-sync-collection.php +++ b/inc/caldav-REPORT-sync-collection.php @@ -80,13 +80,17 @@ if ( $sync_token == $new_token ) { $responses[] = new XMLElement( 'sync-token', 'data:,'.$new_token ); } else { + $hide_older = ''; + if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) + $hide_older = " AND (CASE WHEN caldav_data.caldav_type<>'VEVENT' THEN true ELSE calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') END)"; + if ( $sync_token == 0 ) { $sql = <<= (SELECT modification_time FROM sync_tokens WHERE sync_token = :sync_token) EOSQL; if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) {