Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Fix EX/RDATE parsing. Contributes to JB#4…
Browse files Browse the repository at this point in the history
…6011

RFC5545 states that the valid formats for RDATE are:
RDATE ";" "VALUE" "=" ("DATE-TIME" / "DATE" / "PERIOD") ":" <value>
RDATE ";" "TZID" "=" [tzidprefix] paramtext ":" <value>

Whereas our parsing code incorrectly omitted "VALUE=" prefix handling.
  • Loading branch information
Chris Adams committed Jun 13, 2019
1 parent 8f577a4 commit 71700de
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/google/google-calendars/googlecalendarsyncadaptor.cpp
Expand Up @@ -217,8 +217,8 @@ QList<KDateTime> datetimesFromExRDateStr(const QString &exrdatestr, bool *isDate

if (str.startsWith(';')) {
str.remove(0,1);
if (str.startsWith("DATE-TIME:", Qt::CaseInsensitive)) {
str.remove(0, 10);
if (str.startsWith("VALUE=DATE-TIME:", Qt::CaseInsensitive)) {
str.remove(0, 16);
QStringList dts = str.split(',');
Q_FOREACH (const QString &dtstr, dts) {
if (dtstr.endsWith('Z')) {
Expand All @@ -233,15 +233,15 @@ QList<KDateTime> datetimesFromExRDateStr(const QString &exrdatestr, bool *isDate
retn.append(kdt);
}
}
} else if (str.startsWith("DATE:", Qt::CaseInsensitive)) {
str.remove(0, 5);
} else if (str.startsWith("VALUE=DATE:", Qt::CaseInsensitive)) {
str.remove(0, 11);
QStringList dts = str.split(',');
Q_FOREACH(const QString &dstr, dts) {
QDate date = QLocale::c().toDate(dstr, RFC5545_QDATE_FORMAT);
KDateTime kdt(date, KDateTime::Spec::ClockTime());
retn.append(kdt);
}
} else if (str.startsWith("PERIOD:", Qt::CaseInsensitive)) {
} else if (str.startsWith("VALUE=PERIOD:", Qt::CaseInsensitive)) {
SOCIALD_LOG_ERROR("unsupported parameter in ex/rdate string:" << exrdatestr);
// TODO: support PERIOD formats, or just switch to CalDAV for Google sync...
} else if (str.startsWith("TZID=") && str.contains(':')) {
Expand Down

0 comments on commit 71700de

Please sign in to comment.