data/ComposeDraftHeader.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QString> | ||
| 4 | #include <optional> | ||
| 5 | |||
| 6 | // Sprint 108 D-21/D-30: the X-MailJD-Draft header of MailJD's server drafts, | ||
| 7 | // "v=1; session=<id>; identity=<id>; format=formatted|plain". Anything can | ||
| 8 | // write to the drafts folder, so the value is untrusted: parse() is bounded | ||
| 9 | // (512 characters), accepts only version 1, ids of [A-Za-z0-9-] (1–64) and | ||
| 10 | // the two formats, ignores unknown keys and refuses everything else. The | ||
| 11 | // header is written only into drafts (ComposeMessage::Form::Draft), never | ||
| 12 | // into sent mail. | ||
| 13 | struct ComposeDraftHeader { | ||
| 14 | static constexpr int MaxLength = 512; | ||
| 15 | 1 | QString session; | |
| 16 | 1 | QString identity; | |
| 17 | 1 | std::optional<bool> formatted; | |
| 18 | |||
| 19 | static std::optional<ComposeDraftHeader> parse(const QString &value); | ||
| 20 | QString toString() const; | ||
| 21 |
3/6✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 1 time.
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 1 time.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 1 time.
|
1 | bool operator==(const ComposeDraftHeader &) const = default; |
| 22 | }; | ||
| 23 |