aboutsummaryrefslogtreecommitdiffstats
path: root/src/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/types.h b/src/types.h
index cf2411d..a0f772b 100644
--- a/src/types.h
+++ b/src/types.h
@@ -62,6 +62,25 @@ struct ThreadSummary
/// file. Do not move it behind a flag by analogy with `recipients`.
QStringList firstMessageTags;
+ /// That message's sender, as a BARE ADDRESS with no display name.
+ ///
+ /// `authors` above is notmuch's own summarised string and carries display
+ /// names ONLY: measured against the real index, 'Ryanair' and 'The Hacker
+ /// News tramite LinkedIn', with no `@` anywhere. A card therefore has no
+ /// address to hash for its avatar and nothing for the business-sender list
+ /// to match, which is why this exists (item 169).
+ ///
+ /// Hashing the display name instead was rejected: notmuch BUILDS those
+ /// strings, so one sender's identity varies as the string does.
+ ///
+ /// Free, for the same reason `firstMessageId` and `firstMessageTags` are:
+ /// the walk that finds that message is already happening and From is
+ /// served from the INDEX, not the message file. Measured 2026-08-26 on the
+ /// developer's database: 1322 distinct senders in 12 ms, 5105 messages
+ /// enumerated in 76 ms. Do not move it behind a flag by analogy with
+ /// `recipients`.
+ QString firstMessageSender;
+
/// That message's file, RELATIVE to the database path, which is what says
/// which ACCOUNT it belongs to.
///
@@ -94,6 +113,18 @@ struct ThreadSummary
/// row and carries nothing.
QString recipients;
+ /// The FIRST recipient's bare address, for the avatar in a flat view.
+ ///
+ /// Filled by the same walk as `recipients` and under the same flag, so it
+ /// costs nothing extra: the To header is already parsed there.
+ ///
+ /// A Sent or Drafts card's `firstMessageSender` is the user on every row,
+ /// so every card would carry one pattern and only the initials would vary.
+ /// The avatar answers "who is this row about", and there that is the
+ /// recipient. `firstMessageSender` stays the fallback for a row with no
+ /// usable To.
+ QString firstMessageRecipient;
+
bool isUnread() const { return tags.contains(QStringLiteral("unread")); }
bool isFlagged() const { return tags.contains(QStringLiteral("flagged")); }
/// True when this message was forwarded. The Maildir "P" (passed) flag,
@@ -147,6 +178,13 @@ struct MessageNode
QString messageId;
QString threadId; ///< The thread this message belongs to.
QString from;
+
+ /// The BARE address of the message's From, with any display name
+ /// discarded, like `ThreadSummary::firstMessageSender` is for a thread
+ /// row. `from` above is the raw header and usually carries a display
+ /// name, which is what the avatar's hash and the business-senders
+ /// lookup cannot take initials or match against.
+ QString senderAddress;
QString subject;
QDateTime date;
QStringList tags;