संदेश प्रदर्शित स्थिति
प्रत्येक ग्राहक को आम तौर पर यह दिखाने में सक्षम होना चाहिए कि किस सहकर्मी ने कौन सा संदेश पढ़ा है और कितने अनपढ़े हुए संदेश हैं।
इसके लिए, डेमोन कुछ एपीआई प्रदान करता हैः
प्रदर्शित संदेश सेट करें
कॉन्फ़िगरेशन प्रबंधक प्रदान करता हैः
<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
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
में क्रमबद्ध की जाती है