message: update references() implementation

Clean up the implementation at bit, and filter out 'fake' message-ids,
such as the ones from protonmail.

Update documentation.

Add Mu::Message::thread_id().

This fixes #2312.
This commit is contained in:
Dirk-Jan C. Binnema
2022-08-11 23:01:29 +03:00
parent 317fe53ff7
commit fc88158357
4 changed files with 86 additions and 19 deletions

View File

@ -301,10 +301,11 @@ public:
size_t size() const { return static_cast<size_t>(document().integer_value(Field::Id::Size)); }
/**
* get the list of references (consisting of both the References and
* In-Reply-To fields), with the oldest first and the direct parent as
* the last one. Note, any reference (message-id) will appear at most
* once, duplicates are filtered out.
* Get the (possibly empty) list of references (consisting of both the
* References and In-Reply-To fields), with the oldest first and the
* direct parent as the last one. Note, any reference (message-id) will
* appear at most once, duplicates and fake-message-id (see impls) are
* filtered out.
*
* @return a vec with the references for this msg.
*/
@ -312,6 +313,17 @@ public:
return document().string_vec_value(Field::Id::References);
}
/**
* Get the thread-id for this message. This is the message-id of the
* oldest-known (grand) parent, or the message-id of this message if
* none.
*
* @return the thread id.
*/
std::string thread_id() const {
return document().string_value(Field::Id::ThreadId);
}
/**
* get the list of tags (ie., X-Label)
*
@ -409,7 +421,6 @@ public:
using Part = MessagePart;
const std::vector<Part>& parts() const;
/**
* Get the path to a cche directory for this message, which
* is useful for temporarily saving attachments