data/ImipRequest.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Sprint 108 S108.8.4 (D-23, client mode): the iMIP REQUEST/CANCEL of a | ||
| 2 | // meeting the user organizes, and the organizer's side of a stored event | ||
| 3 | // (S108.8.8/8.9; declared in ImipInvitation.h). | ||
| 4 | #include "ImipInvitation.h" | ||
| 5 | #include "ICalTime.h" | ||
| 6 | |||
| 7 | #include <QHash> | ||
| 8 | #include <QSet> | ||
| 9 | |||
| 10 | namespace Imip { | ||
| 11 | |||
| 12 | namespace { | ||
| 13 | |||
| 14 | 205 | ICal::Property makeProperty(const QString &name, const QString &value) { | |
| 15 | 205 | ICal::Property property; | |
| 16 | 205 | property.name = name; | |
| 17 | 205 | property.value = value; | |
| 18 | 205 | return property; | |
| 19 | } | ||
| 20 | |||
| 21 | } // namespace | ||
| 22 | |||
| 23 | 16 | QByteArray buildRequest(const Meeting &meeting, const QString &method, const QDateTime &now) { | |
| 24 |
2/2✓ Branch 2 → 3 taken 16 times.
✓ Branch 3 → 4 taken 16 times.
|
16 | const QString organizer = meeting.organizerEmail.trimmed().toLower(); |
| 25 |
4/5✓ Branch 9 → 10 taken 16 times.
✓ Branch 10 → 11 taken 15 times.
✓ Branch 10 → 20 taken 1 time.
✓ Branch 12 → 13 taken 15 times.
✗ Branch 12 → 20 not taken.
|
32 | if (meeting.uid.isEmpty() || !organizer.contains(QLatin1Char('@')) || meeting.attendees.isEmpty() || |
| 26 |
10/13✓ Branch 6 → 7 taken 16 times.
✗ Branch 6 → 20 not taken.
✓ Branch 13 → 14 taken 15 times.
✓ Branch 14 → 15 taken 15 times.
✗ Branch 14 → 20 not taken.
✓ Branch 15 → 16 taken 15 times.
✓ Branch 16 → 17 taken 15 times.
✗ Branch 16 → 20 not taken.
✓ Branch 17 → 18 taken 15 times.
✓ Branch 19 → 20 taken 1 time.
✓ Branch 19 → 21 taken 14 times.
✓ Branch 22 → 23 taken 2 times.
✓ Branch 22 → 24 taken 14 times.
|
32 | !meeting.start.isValid() || !meeting.end.isValid() || meeting.end < meeting.start) |
| 27 | 2 | return {}; | |
| 28 | 14 | ICal::Component calendar; | |
| 29 | 14 | calendar.name = QStringLiteral("VCALENDAR"); | |
| 30 |
1/1✓ Branch 37 → 38 taken 14 times.
|
28 | calendar.appendProperty(makeProperty(QStringLiteral("PRODID"), QStringLiteral("-//MailJD//MailJD Calendar//EN"))); |
| 31 |
1/1✓ Branch 50 → 51 taken 14 times.
|
28 | calendar.appendProperty(makeProperty(QStringLiteral("VERSION"), QStringLiteral("2.0"))); |
| 32 |
5/7✓ Branch 58 → 59 taken 4 times.
✓ Branch 58 → 60 taken 10 times.
✓ Branch 67 → 68 taken 14 times.
✓ Branch 72 → 73 taken 10 times.
✓ Branch 72 → 74 taken 4 times.
✗ Branch 437 → 438 not taken.
✗ Branch 437 → 439 not taken.
|
38 | calendar.appendProperty(makeProperty(QStringLiteral("METHOD"), method == QLatin1String("CANCEL") ? method : QStringLiteral("REQUEST"))); |
| 33 |
1/1✓ Branch 74 → 75 taken 14 times.
|
14 | const QTimeZone zone = meeting.start.timeZone(); |
| 34 |
7/12✓ Branch 75 → 76 taken 14 times.
✓ Branch 76 → 77 taken 14 times.
✗ Branch 76 → 83 not taken.
✓ Branch 78 → 79 taken 14 times.
✗ Branch 78 → 83 not taken.
✓ Branch 79 → 80 taken 14 times.
✓ Branch 81 → 82 taken 8 times.
✓ Branch 81 → 83 taken 6 times.
✓ Branch 84 → 85 taken 14 times.
✗ Branch 84 → 86 not taken.
✗ Branch 444 → 445 not taken.
✗ Branch 444 → 446 not taken.
|
14 | const bool zoned = zone.isValid() && zone.timeSpec() == Qt::TimeZone && zone.id() != "UTC"; |
| 35 |
8/8✓ Branch 86 → 87 taken 8 times.
✓ Branch 86 → 94 taken 6 times.
✓ Branch 87 → 88 taken 7 times.
✓ Branch 87 → 94 taken 1 time.
✓ Branch 88 → 89 taken 7 times.
✓ Branch 89 → 90 taken 7 times.
✓ Branch 90 → 91 taken 7 times.
✓ Branch 91 → 92 taken 7 times.
|
14 | if (zoned && !meeting.allDay) calendar.components.append(ICalTime::vtimezoneFor(zone, meeting.start.date().year())); |
| 36 | 28 | const auto timeProperty = [&](const QString &name, const QDateTime &when) { | |
| 37 |
2/2✓ Branch 2 → 3 taken 2 times.
✓ Branch 2 → 26 taken 26 times.
|
28 | if (meeting.allDay) { |
| 38 |
2/4✓ Branch 3 → 4 taken 2 times.
✓ Branch 7 → 8 taken 2 times.
✗ Branch 84 → 85 not taken.
✗ Branch 84 → 86 not taken.
|
4 | ICal::Property property = makeProperty(name, when.date().toString(QStringLiteral("yyyyMMdd"))); |
| 39 |
1/1✓ Branch 18 → 19 taken 2 times.
|
4 | property.setParameter(QStringLiteral("VALUE"), QStringLiteral("DATE")); |
| 40 |
1/2✗ Branch 23 → 24 not taken.
✓ Branch 23 → 25 taken 2 times.
|
2 | return property; |
| 41 | ✗ | } | |
| 42 |
4/4✓ Branch 26 → 27 taken 12 times.
✓ Branch 26 → 39 taken 14 times.
✓ Branch 27 → 28 taken 12 times.
✓ Branch 31 → 32 taken 12 times.
|
38 | if (!zoned) return makeProperty(name, when.toUTC().toString(QStringLiteral("yyyyMMdd'T'HHmmss'Z'"))); |
| 43 |
2/2✓ Branch 39 → 40 taken 14 times.
✓ Branch 43 → 44 taken 14 times.
|
28 | ICal::Property property = makeProperty(name, when.toTimeZone(zone).toString(QStringLiteral("yyyyMMdd'T'HHmmss"))); |
| 44 |
3/3✓ Branch 49 → 50 taken 14 times.
✓ Branch 50 → 51 taken 14 times.
✓ Branch 54 → 55 taken 14 times.
|
28 | property.setParameter(QStringLiteral("TZID"), QString::fromUtf8(zone.id())); |
| 45 | 14 | return property; | |
| 46 | 14 | }; | |
| 47 | 14 | ICal::Component event; | |
| 48 | 14 | event.name = QStringLiteral("VEVENT"); | |
| 49 |
1/1✓ Branch 104 → 105 taken 14 times.
|
28 | event.appendProperty(makeProperty(QStringLiteral("UID"), meeting.uid)); |
| 50 |
3/3✓ Branch 108 → 109 taken 14 times.
✓ Branch 112 → 113 taken 14 times.
✓ Branch 117 → 118 taken 14 times.
|
42 | event.appendProperty(makeProperty(QStringLiteral("DTSTAMP"), now.toUTC().toString(QStringLiteral("yyyyMMdd'T'HHmmss'Z'")))); |
| 51 |
2/2✓ Branch 126 → 127 taken 14 times.
✓ Branch 131 → 132 taken 14 times.
|
28 | event.appendProperty(makeProperty(QStringLiteral("SEQUENCE"), QString::number(qMax(0, meeting.sequence)))); |
| 52 |
2/2✓ Branch 139 → 140 taken 14 times.
✓ Branch 140 → 141 taken 14 times.
|
28 | event.appendProperty(timeProperty(QStringLiteral("DTSTART"), meeting.start)); |
| 53 |
2/2✓ Branch 147 → 148 taken 14 times.
✓ Branch 148 → 149 taken 14 times.
|
28 | event.appendProperty(timeProperty(QStringLiteral("DTEND"), meeting.end)); |
| 54 |
3/3✓ Branch 152 → 153 taken 14 times.
✓ Branch 153 → 154 taken 14 times.
✓ Branch 158 → 159 taken 14 times.
|
28 | event.appendProperty(makeProperty(QStringLiteral("SUMMARY"), ICal::escapeText(meeting.summary.left(1000)))); |
| 55 |
3/3✓ Branch 164 → 165 taken 14 times.
✓ Branch 167 → 168 taken 10 times.
✓ Branch 167 → 183 taken 4 times.
|
14 | if (!meeting.location.trimmed().isEmpty()) |
| 56 |
4/4✓ Branch 168 → 169 taken 10 times.
✓ Branch 169 → 170 taken 10 times.
✓ Branch 170 → 171 taken 10 times.
✓ Branch 175 → 176 taken 10 times.
|
20 | event.appendProperty(makeProperty(QStringLiteral("LOCATION"), ICal::escapeText(meeting.location.trimmed().left(1000)))); |
| 57 |
3/3✓ Branch 183 → 184 taken 14 times.
✓ Branch 186 → 187 taken 3 times.
✓ Branch 186 → 200 taken 11 times.
|
14 | if (!meeting.description.trimmed().isEmpty()) |
| 58 |
3/3✓ Branch 187 → 188 taken 3 times.
✓ Branch 188 → 189 taken 3 times.
✓ Branch 193 → 194 taken 3 times.
|
6 | event.appendProperty(makeProperty(QStringLiteral("DESCRIPTION"), ICal::escapeText(meeting.description.left(32000)))); |
| 59 |
5/5✓ Branch 200 → 201 taken 14 times.
✓ Branch 203 → 204 taken 2 times.
✓ Branch 203 → 215 taken 12 times.
✓ Branch 204 → 205 taken 2 times.
✓ Branch 209 → 210 taken 2 times.
|
16 | if (!meeting.rrule.trimmed().isEmpty()) event.appendProperty(makeProperty(QStringLiteral("RRULE"), meeting.rrule.trimmed())); |
| 60 |
3/3✓ Branch 217 → 218 taken 4 times.
✓ Branch 217 → 232 taken 10 times.
✓ Branch 225 → 226 taken 4 times.
|
22 | if (method == QLatin1String("CANCEL")) event.appendProperty(makeProperty(QStringLiteral("STATUS"), QStringLiteral("CANCELLED"))); |
| 61 |
1/1✓ Branch 235 → 236 taken 14 times.
|
28 | ICal::Property organizerProperty = makeProperty(QStringLiteral("ORGANIZER"), QStringLiteral("mailto:") + organizer); |
| 62 |
4/5✓ Branch 245 → 246 taken 14 times.
✓ Branch 248 → 249 taken 14 times.
✗ Branch 248 → 258 not taken.
✓ Branch 249 → 250 taken 14 times.
✓ Branch 253 → 254 taken 14 times.
|
28 | if (!meeting.organizerName.trimmed().isEmpty()) organizerProperty.setParameter(QStringLiteral("CN"), meeting.organizerName.trimmed()); |
| 63 |
1/1✓ Branch 258 → 259 taken 14 times.
|
14 | event.appendProperty(organizerProperty); |
| 64 |
2/4✓ Branch 262 → 263 taken 14 times.
✓ Branch 262 → 264 taken 14 times.
✗ Branch 610 → 611 not taken.
✗ Branch 610 → 612 not taken.
|
28 | QStringList seen{organizer}; |
| 65 |
2/2✓ Branch 374 → 266 taken 30 times.
✓ Branch 374 → 375 taken 14 times.
|
44 | for (const Attendee &attendee : meeting.attendees) { |
| 66 |
2/2✓ Branch 267 → 268 taken 30 times.
✓ Branch 268 → 269 taken 30 times.
|
30 | const QString email = attendee.email.trimmed().toLower(); |
| 67 |
6/7✓ Branch 272 → 273 taken 30 times.
✓ Branch 273 → 274 taken 30 times.
✗ Branch 273 → 276 not taken.
✓ Branch 275 → 276 taken 5 times.
✓ Branch 275 → 277 taken 25 times.
✓ Branch 278 → 279 taken 5 times.
✓ Branch 278 → 280 taken 25 times.
|
30 | if (!email.contains(QLatin1Char('@')) || seen.contains(email)) continue; |
| 68 |
1/1✓ Branch 280 → 281 taken 25 times.
|
25 | seen.append(email); |
| 69 |
1/1✓ Branch 284 → 285 taken 25 times.
|
50 | ICal::Property property = makeProperty(QStringLiteral("ATTENDEE"), QStringLiteral("mailto:") + email); |
| 70 |
5/5✓ Branch 294 → 295 taken 25 times.
✓ Branch 297 → 298 taken 16 times.
✓ Branch 297 → 307 taken 9 times.
✓ Branch 298 → 299 taken 16 times.
✓ Branch 302 → 303 taken 16 times.
|
41 | if (!attendee.name.trimmed().isEmpty()) property.setParameter(QStringLiteral("CN"), attendee.name.trimmed()); |
| 71 |
1/1✓ Branch 319 → 320 taken 25 times.
|
50 | property.setParameter(QStringLiteral("ROLE"), attendee.role == QLatin1String("OPT-PARTICIPANT") |
| 72 |
6/10✓ Branch 309 → 310 taken 6 times.
✓ Branch 309 → 313 taken 19 times.
✓ Branch 323 → 324 taken 19 times.
✓ Branch 323 → 325 taken 6 times.
✓ Branch 325 → 326 taken 6 times.
✓ Branch 325 → 327 taken 19 times.
✗ Branch 649 → 650 not taken.
✗ Branch 649 → 651 not taken.
✗ Branch 653 → 654 not taken.
✗ Branch 653 → 655 not taken.
|
75 | ? QStringLiteral("OPT-PARTICIPANT") : QStringLiteral("REQ-PARTICIPANT")); |
| 73 |
1/1✓ Branch 333 → 334 taken 25 times.
|
50 | property.setParameter(QStringLiteral("PARTSTAT"), QStringLiteral("NEEDS-ACTION")); |
| 74 |
3/3✓ Branch 340 → 341 taken 18 times.
✓ Branch 340 → 353 taken 7 times.
✓ Branch 347 → 348 taken 18 times.
|
61 | if (method != QLatin1String("CANCEL")) property.setParameter(QStringLiteral("RSVP"), QStringLiteral("TRUE")); |
| 75 |
1/1✓ Branch 359 → 360 taken 25 times.
|
50 | property.setParameter(QStringLiteral("SCHEDULE-AGENT"), QStringLiteral("CLIENT")); |
| 76 |
1/1✓ Branch 364 → 365 taken 25 times.
|
25 | event.appendProperty(property); |
| 77 | 30 | } | |
| 78 |
2/2✓ Branch 376 → 377 taken 1 time.
✓ Branch 376 → 378 taken 13 times.
|
14 | if (seen.size() < 2) return {}; |
| 79 |
1/1✓ Branch 378 → 379 taken 13 times.
|
13 | calendar.components.append(event); |
| 80 |
2/2✓ Branch 379 → 380 taken 13 times.
✓ Branch 380 → 381 taken 13 times.
|
13 | return ICal::serialize(calendar).toUtf8(); |
| 81 | 30 | } | |
| 82 | |||
| 83 | 60 | std::optional<Organized> organizedBy(const QString &veventText, const QStringList &ownAddresses) { | |
| 84 |
1/1✓ Branch 5 → 6 taken 60 times.
|
60 | const ICal::Component vevent = ICal::parseFirst(veventText, QStringLiteral("VEVENT")); |
| 85 |
1/1✓ Branch 11 → 12 taken 60 times.
|
60 | const ICal::Property *organizer = vevent.property(QStringLiteral("ORGANIZER")); |
| 86 |
2/2✓ Branch 14 → 15 taken 38 times.
✓ Branch 14 → 16 taken 22 times.
|
60 | if (!organizer) return std::nullopt; |
| 87 |
1/1✓ Branch 16 → 17 taken 22 times.
|
22 | const QString email = addressOf(organizer->value); |
| 88 |
5/6✓ Branch 18 → 19 taken 22 times.
✗ Branch 18 → 21 not taken.
✓ Branch 20 → 21 taken 3 times.
✓ Branch 20 → 22 taken 19 times.
✓ Branch 23 → 24 taken 3 times.
✓ Branch 23 → 25 taken 19 times.
|
22 | if (email.isEmpty() || !ownAddresses.contains(email)) return std::nullopt; |
| 89 | 19 | Organized organized; | |
| 90 | 19 | organized.organizerEmail = email; | |
| 91 |
1/1✓ Branch 29 → 30 taken 19 times.
|
38 | organized.organizerName = organizer->parameter(QStringLiteral("CN")); |
| 92 |
3/3✓ Branch 37 → 38 taken 19 times.
✓ Branch 38 → 39 taken 19 times.
✓ Branch 39 → 40 taken 19 times.
|
19 | organized.sequence = qMax(0, vevent.value(QStringLiteral("SEQUENCE")).trimmed().toInt()); |
| 93 |
5/5✓ Branch 48 → 49 taken 19 times.
✓ Branch 51 → 52 taken 19 times.
✓ Branch 52 → 53 taken 19 times.
✓ Branch 122 → 54 taken 40 times.
✓ Branch 122 → 123 taken 19 times.
|
59 | for (const ICal::Property &property : vevent.propertiesNamed(QStringLiteral("ATTENDEE"))) { |
| 94 | 40 | Attendee attendee; | |
| 95 |
1/1✓ Branch 55 → 56 taken 40 times.
|
40 | attendee.email = addressOf(property.value); |
| 96 |
3/6✓ Branch 59 → 60 taken 40 times.
✗ Branch 59 → 62 not taken.
✗ Branch 61 → 62 not taken.
✓ Branch 61 → 63 taken 40 times.
✗ Branch 64 → 65 not taken.
✓ Branch 64 → 66 taken 40 times.
|
40 | if (attendee.email.isEmpty() || attendee.email == email) continue; |
| 97 |
1/1✓ Branch 69 → 70 taken 40 times.
|
40 | attendee.name = property.parameter(QStringLiteral("CN")); |
| 98 |
2/2✓ Branch 77 → 78 taken 40 times.
✓ Branch 78 → 79 taken 40 times.
|
40 | attendee.partstat = property.parameter(QStringLiteral("PARTSTAT")).toUpper(); |
| 99 |
1/2✗ Branch 85 → 86 not taken.
✓ Branch 85 → 93 taken 40 times.
|
40 | if (attendee.partstat.isEmpty()) attendee.partstat = QStringLiteral("NEEDS-ACTION"); |
| 100 |
2/2✓ Branch 96 → 97 taken 40 times.
✓ Branch 97 → 98 taken 40 times.
|
40 | attendee.role = property.parameter(QStringLiteral("ROLE")).toUpper(); |
| 101 |
2/2✓ Branch 106 → 107 taken 40 times.
✓ Branch 107 → 108 taken 40 times.
|
40 | attendee.scheduleStatus = property.parameter(QStringLiteral("SCHEDULE-STATUS")).left(64); |
| 102 |
1/1✓ Branch 113 → 114 taken 40 times.
|
40 | organized.attendees.append(attendee); |
| 103 | 59 | } | |
| 104 | 19 | return organized; | |
| 105 | 60 | } | |
| 106 | |||
| 107 | 9 | QString withMeetingAttendees(const QString &veventText, const QString &organizerEmail, const QString &organizerName, | |
| 108 | const QList<Attendee> &attendees, int sequence, bool serverSchedules) { | ||
| 109 |
1/1✓ Branch 5 → 6 taken 9 times.
|
9 | ICal::Component vevent = ICal::parseFirst(veventText, QStringLiteral("VEVENT")); |
| 110 |
2/2✓ Branch 9 → 10 taken 1 time.
✓ Branch 9 → 11 taken 8 times.
|
9 | if (vevent.name.isEmpty()) return {}; |
| 111 | 8 | QHash<QString, ICal::Property> previous; | |
| 112 |
5/5✓ Branch 14 → 15 taken 8 times.
✓ Branch 17 → 18 taken 8 times.
✓ Branch 18 → 19 taken 8 times.
✓ Branch 26 → 20 taken 11 times.
✓ Branch 26 → 27 taken 8 times.
|
19 | for (const ICal::Property &property : vevent.propertiesNamed(QStringLiteral("ATTENDEE"))) |
| 113 |
2/2✓ Branch 21 → 22 taken 11 times.
✓ Branch 22 → 23 taken 11 times.
|
19 | previous.insert(addressOf(property.value), property); |
| 114 |
1/1✓ Branch 31 → 32 taken 8 times.
|
8 | vevent.removeProperties(QStringLiteral("ORGANIZER")); |
| 115 |
1/1✓ Branch 37 → 38 taken 8 times.
|
8 | vevent.removeProperties(QStringLiteral("ATTENDEE")); |
| 116 |
2/2✓ Branch 41 → 42 taken 8 times.
✓ Branch 45 → 46 taken 8 times.
|
16 | vevent.setPropertyValue(QStringLiteral("SEQUENCE"), QString::number(qMax(0, sequence))); |
| 117 |
2/2✓ Branch 49 → 50 taken 8 times.
✓ Branch 50 → 51 taken 8 times.
|
8 | const QString organizer = organizerEmail.trimmed().toLower(); |
| 118 |
1/1✓ Branch 55 → 56 taken 8 times.
|
16 | ICal::Property organizerProperty = makeProperty(QStringLiteral("ORGANIZER"), QStringLiteral("mailto:") + organizer); |
| 119 |
5/5✓ Branch 65 → 66 taken 8 times.
✓ Branch 68 → 69 taken 6 times.
✓ Branch 68 → 78 taken 2 times.
✓ Branch 69 → 70 taken 6 times.
✓ Branch 73 → 74 taken 6 times.
|
14 | if (!organizerName.trimmed().isEmpty()) organizerProperty.setParameter(QStringLiteral("CN"), organizerName.trimmed()); |
| 120 |
1/1✓ Branch 78 → 79 taken 8 times.
|
8 | vevent.appendProperty(organizerProperty); |
| 121 |
2/4✓ Branch 82 → 83 taken 8 times.
✓ Branch 82 → 84 taken 8 times.
✗ Branch 276 → 277 not taken.
✗ Branch 276 → 278 not taken.
|
16 | QStringList seen{organizer}; |
| 122 |
2/2✓ Branch 205 → 86 taken 13 times.
✓ Branch 205 → 206 taken 8 times.
|
21 | for (const Attendee &attendee : attendees) { |
| 123 |
2/2✓ Branch 87 → 88 taken 13 times.
✓ Branch 88 → 89 taken 13 times.
|
13 | const QString email = attendee.email.trimmed().toLower(); |
| 124 |
4/7✓ Branch 92 → 93 taken 13 times.
✓ Branch 93 → 94 taken 13 times.
✗ Branch 93 → 96 not taken.
✗ Branch 95 → 96 not taken.
✓ Branch 95 → 97 taken 13 times.
✗ Branch 98 → 99 not taken.
✓ Branch 98 → 100 taken 13 times.
|
13 | if (!email.contains(QLatin1Char('@')) || seen.contains(email)) continue; |
| 125 |
1/1✓ Branch 100 → 101 taken 13 times.
|
13 | seen.append(email); |
| 126 |
1/1✓ Branch 104 → 105 taken 13 times.
|
26 | ICal::Property property = previous.value(email, makeProperty(QStringLiteral("ATTENDEE"), QStringLiteral("mailto:") + email)); |
| 127 |
2/2✓ Branch 117 → 118 taken 4 times.
✓ Branch 117 → 141 taken 9 times.
|
13 | if (!previous.contains(email)) { |
| 128 |
1/1✓ Branch 124 → 125 taken 4 times.
|
8 | property.setParameter(QStringLiteral("PARTSTAT"), QStringLiteral("NEEDS-ACTION")); |
| 129 |
1/1✓ Branch 135 → 136 taken 4 times.
|
8 | property.setParameter(QStringLiteral("RSVP"), QStringLiteral("TRUE")); |
| 130 | } | ||
| 131 |
5/5✓ Branch 141 → 142 taken 13 times.
✓ Branch 144 → 145 taken 8 times.
✓ Branch 144 → 154 taken 5 times.
✓ Branch 145 → 146 taken 8 times.
✓ Branch 149 → 150 taken 8 times.
|
21 | if (!attendee.name.trimmed().isEmpty()) property.setParameter(QStringLiteral("CN"), attendee.name.trimmed()); |
| 132 |
1/1✓ Branch 166 → 167 taken 13 times.
|
26 | property.setParameter(QStringLiteral("ROLE"), attendee.role == QLatin1String("OPT-PARTICIPANT") |
| 133 |
6/10✓ Branch 156 → 157 taken 1 time.
✓ Branch 156 → 160 taken 12 times.
✓ Branch 170 → 171 taken 12 times.
✓ Branch 170 → 172 taken 1 time.
✓ Branch 172 → 173 taken 1 time.
✓ Branch 172 → 174 taken 12 times.
✗ Branch 340 → 341 not taken.
✗ Branch 340 → 342 not taken.
✗ Branch 344 → 345 not taken.
✗ Branch 344 → 346 not taken.
|
39 | ? QStringLiteral("OPT-PARTICIPANT") : QStringLiteral("REQ-PARTICIPANT")); |
| 134 |
3/3✓ Branch 174 → 175 taken 1 time.
✓ Branch 174 → 182 taken 12 times.
✓ Branch 178 → 179 taken 1 time.
|
14 | if (serverSchedules) property.removeParameter(QStringLiteral("SCHEDULE-AGENT")); |
| 135 |
1/1✓ Branch 188 → 189 taken 12 times.
|
24 | else property.setParameter(QStringLiteral("SCHEDULE-AGENT"), QStringLiteral("CLIENT")); |
| 136 | 13 | property.originalLine.clear(); | |
| 137 |
1/1✓ Branch 195 → 196 taken 13 times.
|
13 | vevent.appendProperty(property); |
| 138 | 13 | } | |
| 139 |
1/1✓ Branch 206 → 207 taken 8 times.
|
8 | return ICal::serialize(vevent); |
| 140 | 17 | } | |
| 141 | |||
| 142 | 6 | Meeting meetingOf(const CalendarEvent &event, const Organized &organized) { | |
| 143 | 6 | Meeting meeting; | |
| 144 | 6 | meeting.uid = event.uid; | |
| 145 | 6 | meeting.sequence = organized.sequence; | |
| 146 | 6 | meeting.summary = event.summary; | |
| 147 | 6 | meeting.location = event.location; | |
| 148 | 6 | meeting.description = event.description; | |
| 149 | 6 | meeting.start = event.dtStart; | |
| 150 |
2/4✓ Branch 8 → 9 taken 6 times.
✓ Branch 9 → 10 taken 6 times.
✗ Branch 9 → 11 not taken.
✗ Branch 11 → 12 not taken.
|
6 | meeting.end = event.dtEnd.isValid() ? event.dtEnd : event.dtStart.addSecs(3600); |
| 151 | 6 | meeting.organizerEmail = organized.organizerEmail; | |
| 152 | 6 | meeting.organizerName = organized.organizerName; | |
| 153 | 6 | meeting.attendees = organized.attendees; | |
| 154 | 6 | meeting.rrule = event.rrule; | |
| 155 | 6 | meeting.allDay = event.allDay; | |
| 156 |
7/8✓ Branch 18 → 19 taken 1 time.
✓ Branch 18 → 23 taken 5 times.
✓ Branch 19 → 20 taken 1 time.
✓ Branch 21 → 22 taken 1 time.
✗ Branch 21 → 23 not taken.
✓ Branch 24 → 25 taken 1 time.
✓ Branch 24 → 29 taken 5 times.
✓ Branch 25 → 26 taken 1 time.
|
6 | if (event.allDay && meeting.end <= meeting.start) meeting.end = meeting.start.addDays(1); |
| 157 | 6 | return meeting; | |
| 158 | ✗ | } | |
| 159 | |||
| 160 | 5 | QList<Attendee> removedAttendees(const QList<Attendee> &before, const QList<Attendee> &after) { | |
| 161 | 5 | QSet<QString> kept; | |
| 162 |
5/5✓ Branch 6 → 7 taken 9 times.
✓ Branch 7 → 8 taken 9 times.
✓ Branch 8 → 9 taken 9 times.
✓ Branch 13 → 5 taken 9 times.
✓ Branch 13 → 14 taken 5 times.
|
14 | for (const Attendee &attendee : after) kept.insert(attendee.email.trimmed().toLower()); |
| 163 | 5 | QList<Attendee> removed; | |
| 164 |
2/2✓ Branch 26 → 16 taken 9 times.
✓ Branch 26 → 27 taken 5 times.
|
14 | for (const Attendee &attendee : before) |
| 165 |
5/5✓ Branch 17 → 18 taken 9 times.
✓ Branch 18 → 19 taken 9 times.
✓ Branch 22 → 23 taken 2 times.
✓ Branch 22 → 24 taken 7 times.
✓ Branch 23 → 24 taken 2 times.
|
9 | if (!kept.contains(attendee.email.trimmed().toLower())) removed.append(attendee); |
| 166 | 5 | return removed; | |
| 167 | 5 | } | |
| 168 | |||
| 169 | 75 | QString deliveryMode(const QString &override, bool scheduling, std::optional<bool> autoSchedule, | |
| 170 | const QStringList &addresses, const QString &organizer) { | ||
| 171 |
2/2✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 10 taken 74 times.
|
76 | if (override == QLatin1String("client")) return QStringLiteral("client"); |
| 172 | 74 | const bool forced = override == QLatin1String("server"); | |
| 173 |
4/4✓ Branch 12 → 13 taken 29 times.
✓ Branch 12 → 19 taken 45 times.
✓ Branch 13 → 14 taken 28 times.
✓ Branch 13 → 19 taken 1 time.
|
102 | if (!scheduling && !forced) return QStringLiteral("client"); |
| 174 |
12/16✓ Branch 20 → 21 taken 44 times.
✓ Branch 20 → 26 taken 2 times.
✓ Branch 21 → 22 taken 44 times.
✓ Branch 22 → 23 taken 44 times.
✓ Branch 24 → 25 taken 2 times.
✓ Branch 24 → 26 taken 42 times.
✓ Branch 27 → 28 taken 44 times.
✓ Branch 27 → 29 taken 2 times.
✓ Branch 29 → 30 taken 44 times.
✓ Branch 29 → 31 taken 2 times.
✓ Branch 31 → 32 taken 2 times.
✓ Branch 31 → 37 taken 44 times.
✗ Branch 56 → 57 not taken.
✗ Branch 56 → 58 not taken.
✗ Branch 60 → 61 not taken.
✗ Branch 60 → 62 not taken.
|
48 | if (!addresses.isEmpty() && !addresses.contains(organizer.trimmed().toLower())) return QStringLiteral("fallback"); |
| 175 |
8/8✓ Branch 37 → 38 taken 43 times.
✓ Branch 37 → 43 taken 1 time.
✓ Branch 39 → 40 taken 2 times.
✓ Branch 39 → 43 taken 41 times.
✓ Branch 41 → 42 taken 1 time.
✓ Branch 41 → 43 taken 1 time.
✓ Branch 44 → 45 taken 1 time.
✓ Branch 44 → 50 taken 43 times.
|
45 | if (!forced && autoSchedule.has_value() && !*autoSchedule) return QStringLiteral("client"); |
| 176 | 43 | return QStringLiteral("server"); | |
| 177 | } | ||
| 178 | |||
| 179 | } // namespace Imip | ||
| 180 |