செய்தி காண்பிக்கப்படும் நிலை
பொதுவாக எந்த வாடிக்கையாளர் எந்த செய்தி படித்திருக்கிறார் என்பதைக் காட்டவும், எத்தனை படிக்காத செய்திகள் உள்ளன என்பதைப் பெறவும் ஒவ்வொரு வாடிக்கையாளரும் முடியும்.
இதற்காக, டேமன் சில API களை வழங்குகிறதுஃ
காட்டப்படும் செய்தியை அமைக்கவும்
Configuration Manager பின்வருமாறு கூறுகிறதுஃ
<method name="setMessageDisplayed" tp:name-for-bindings="setMessageDisplayed">
<tp:added version="8.1.0"/>
<tp:docstring>
<p>Informs that a message have been read</p>
</tp:docstring>
<arg type="s" name="accountId" direction="in">
<tp:docstring>
The account ID
</tp:docstring>
</arg>
<arg type="s" name="conversationUri" direction="in">
<tp:docstring>
A conversation uri (swarm:xxxx or jami:xxxx)
</tp:docstring>
</arg>
<arg type="s" name="messageId" direction="in">
<tp:docstring>
The message ID
</tp:docstring>
</arg>
<arg type="i" name="status" direction="in">
<tp:docstring>
The message status, 3 for displayed
</tp:docstring>
</arg>
<arg type="b" name="success" direction="out">
<tp:docstring>
True if the message status was set, false if account, contact or message is unknown.
</tp:docstring>
</arg>
</method>
ஒரு செய்தியை காட்டப்படும்படி அமைக்க வேண்டும். தொடர்பு காட்டப்படும் போது செய்யப்பட வேண்டும் மற்றும் உரையாடல் தேர்ந்தெடுக்கப்பட்டது.
இது பின்வரும் வடிவத்தில் இணைக்கப்பட்ட சகாக்களுக்கு SIP செய்திகளை அனுப்புகிறதுஃ
std::string
getDisplayed(const std::string& conversationId, const std::string& messageId)
{
// implementing https://tools.ietf.org/rfc/rfc5438.txt
return fmt::format(
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
"<imdn><message-id>{}</message-id>\n"
"{}"
"<display-notification><status><displayed/></status></display-notification>\n"
"</imdn>",
messageId,
conversationId.empty() ? "" : "<conversation>" + conversationId + "</conversation>");
}
பின்னர், onMessageDisplayed
வழியாக இதை பியர் அறிந்து, கிளையண்டிற்கு ஒரு சமிக்ஞை அனுப்புவார் (libjami::ConfigurationSignal::AccountMessageStatusChanged
with status 3 (libjami::Account::MessageStates::DISPLAYED
))
படிக்காத செய்திகளை பெறுங்கள்
எங்கள் கணக்கிற்கான கடைசிDisplayedMessage ஐ அறிந்து கொள்வதன் மூலம், இந்த தகவலைப் பயன்படுத்தலாம் மற்றும் ConfigrationManager::countInteractionsSince
இது ஒரு குறிப்பிட்ட செய்தியைக் கடைசி செய்தியில் இருந்து தொடர்புகளை எண்ணும் (பொதுவாக கடைசியாக காட்டப்பட்ட தொடர்பு)
Configuration::getConversationMembers
இல், ஒரு உறுப்பினருக்கு கடைசியாக காண்பிக்கப்பட்ட செய்தியைப் பெற, ஒவ்வொரு உறுப்பினருக்கும் `memberInfo["lastDisplayed"] மூலம் கடைசியாக காண்பிக்கப்படும் தொடர்பு கிடைக்கும்
இந்த தகவல் எவ்வாறு சேமிக்கப்படுகிறது
src/jamidht/conversation.cpp
இல் ஒவ்வொரு உரையாடலும் ஒரு வரைபடத்தில் கடைசியாக காட்டப்பட்ட செய்திகளை சேமிக்கிறது<string, string> (uri, interactionId) மற்றும் இந்த அமைப்பு fileutils::get_data_dir()/getAccountID()/conversation_data/repository_->id()/lastDisplayed