data/MailAddressList.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QList> | ||
| 4 | #include <QString> | ||
| 5 | |||
| 6 | // RFC 5322 mailbox lists as shown in headers and recipient fields (Sprint 97 | ||
| 7 | // S97.5.1): `Mara Klein <mara@example.org>, "Becker, Jonas" <j@x>, x@y`. | ||
| 8 | // Commas inside quotes or angle brackets do not split; quotes around the | ||
| 9 | // display name are removed; groups ("Team: a@x, b@y;") yield their members. | ||
| 10 | // A plain address without a name gives an empty name. | ||
| 11 | namespace MailAddressList { | ||
| 12 | |||
| 13 | struct Mailbox { | ||
| 14 | 8 | QString name; | |
| 15 | 8 | QString address; | |
| 16 |
2/4✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 8 times.
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 8 times.
|
8 | bool operator==(const Mailbox &) const = default; |
| 17 | }; | ||
| 18 | |||
| 19 | Mailbox parseMailbox(const QString &text); | ||
| 20 | // "Name <address>" with the name quoted when it holds specials | ||
| 21 | // ("\"Becker, Jonas\" <j@x>"); the bare address without a name. | ||
| 22 | QString format(const Mailbox &mailbox); | ||
| 23 | QList<Mailbox> parse(const QString &header); | ||
| 24 | |||
| 25 | } // namespace MailAddressList | ||
| 26 |