Message displayed status
========================
Every client generally must be able to show what peer read what message and get how many unread messages there is.
For this, the daemon provides some APIs:
## Set a message displayed
The Configuration manager provides:
```
Informs that a message have been read
The account ID
A conversation uri (swarm:xxxx or jami:xxxx)
The message ID
The message status, 3 for displayed
True if the message status was set, false if account, contact or message is unknown.
```
to set a message as displayed. Should be done when the interaction is shown and the conversation selected.
This sends a SIP messages to connected peers with the following format:
```cpp
std::string
getDisplayed(const std::string& conversationId, const std::string& messageId)
{
// implementing https://tools.ietf.org/rfc/rfc5438.txt
return fmt::format(
"\n"
"{}\n"
"{}"
"\n"
"",
messageId,
conversationId.empty() ? "" : "" + conversationId + "");
}
```
Then the peer will know this via `onMessageDisplayed` and emit a signal to the client (`libjami::ConfigurationSignal::AccountMessageStatusChanged` with status 3 (`libjami::Account::MessageStates::DISPLAYED`))
## Get unread messages
By knowing the lastDisplayedMessage for our account, we can use this informations and `ConfigrationManager::countInteractionsSince` which count interaction since last message to a given message (typically last displayed interaction)
To get last displayed message for a member, in `Configuration::getConversationMembers` each member will have the last displayed interaction available via `memberInfo["lastDisplayed"]`
## How this information is stored
In `src/jamidht/conversation.cpp` each conversation store the last displayed messages in a map (uri, interactionId) and this structure is serialized in `fileutils::get_data_dir()/getAccountID()/conversation_data/repository_->id()/lastDisplayed`