Ring Daemon 16.0.0
|
#include <contact_list.h>
Classes | |
struct | OnChangeCallback |
Public Types | |
using | clock = std::chrono::system_clock |
using | OnAcceptConversation = std::function< void(const std::string &, const std::string &)> |
using | OnConfirmation = std::function< void(const std::string &, const std::string &)> |
using | OnContactAdded = std::function< void(const std::string &, bool)> |
using | OnContactRemoved = std::function< void(const std::string &, bool)> |
using | OnDevicesChanged = std::function< void(const std::map< dht::PkId, KnownDevice > &)> |
using | OnIncomingTrustRequest = std::function< void(const std::string &, const std::string &, const std::vector< uint8_t > &, time_t)> |
using | time_point = clock::time_point |
using | VerifyResult = dht::crypto::TrustList::VerifyResult |
Public Member Functions | |
void | acceptConversation (const std::string &convId, const std::string &deviceId="") |
bool | acceptTrustRequest (const dht::InfoHash &from) |
const std::string & | accountId () const |
bool | addContact (const dht::InfoHash &, bool confirmed=false, const std::string &conversationId="") |
ContactList (const std::string &accountId, const std::shared_ptr< crypto::Certificate > &cert, const std::filesystem::path &path, OnChangeCallback cb) | |
bool | discardTrustRequest (const dht::InfoHash &from) |
void | foundAccountDevice (const dht::PkId &device, const std::string &name={}, const time_point &last_sync=time_point::min()) |
bool | foundAccountDevice (const std::shared_ptr< dht::crypto::Certificate > &crt, const std::string &name={}, const time_point &last_sync=time_point::min(), bool notify=true) |
std::string | getAccountDeviceName (const dht::PkId &device) const |
std::vector< std::string > | getCertificatesByStatus (dhtnet::tls::TrustStore::PermissionStatus status) const |
dhtnet::tls::TrustStore::PermissionStatus | getCertificateStatus (const std::string &cert_id) const |
std::map< std::string, std::string > | getContactDetails (const dht::InfoHash &) const |
std::optional< Contact > | getContactInfo (const dht::InfoHash &) const |
const std::map< dht::InfoHash, Contact > & | getContacts () const |
const std::map< dht::PkId, KnownDevice > & | getKnownDevices () const |
DeviceSync | getSyncData () const |
std::map< std::string, std::string > | getTrustRequest (const dht::InfoHash &from) const |
std::vector< std::map< std::string, std::string > > | getTrustRequests () const |
bool | isAllowed (const crypto::Certificate &crt, bool allowPublic) |
VerifyResult | isValidAccountDevice (const crypto::Certificate &crt) const |
void | load () |
bool | onTrustRequest (const dht::InfoHash &peer_account, const std::shared_ptr< dht::crypto::PublicKey > &peer_device, time_t received, bool confirm, const std::string &conversationId, std::vector< uint8_t > &&payload) |
Inform of a new contact request. | |
const std::filesystem::path & | path () const |
bool | removeAccountDevice (const dht::PkId &device) |
bool | removeContact (const dht::InfoHash &, bool ban) |
bool | removeContactConversation (const dht::InfoHash &) |
void | save () |
void | saveContacts () const |
Should be called only after updateContact. | |
void | setAccountDeviceName (const dht::PkId &device, const std::string &name) |
bool | setCertificateStatus (const std::shared_ptr< crypto::Certificate > &cert, dhtnet::tls::TrustStore::PermissionStatus status, bool local=true) |
bool | setCertificateStatus (const std::string &cert_id, const dhtnet::tls::TrustStore::PermissionStatus status) |
void | setContacts (const std::map< dht::InfoHash, Contact > &) |
bool | syncDevice (const dht::PkId &device, const time_point &syncDate) |
void | updateContact (const dht::InfoHash &, const Contact &, bool emit=true) |
void | updateConversation (const dht::InfoHash &h, const std::string &conversationId) |
~ContactList () | |
Definition at line 31 of file contact_list.h.
using jami::ContactList::clock = std::chrono::system_clock |
Definition at line 34 of file contact_list.h.
using jami::ContactList::OnAcceptConversation = std::function<void(const std::string&, const std::string&)> |
Definition at line 42 of file contact_list.h.
using jami::ContactList::OnConfirmation = std::function<void(const std::string&, const std::string&)> |
Definition at line 43 of file contact_list.h.
using jami::ContactList::OnContactAdded = std::function<void(const std::string&, bool)> |
Definition at line 38 of file contact_list.h.
using jami::ContactList::OnContactRemoved = std::function<void(const std::string&, bool)> |
Definition at line 39 of file contact_list.h.
using jami::ContactList::OnDevicesChanged = std::function<void(const std::map<dht::PkId, KnownDevice>&)> |
Definition at line 44 of file contact_list.h.
using jami::ContactList::OnIncomingTrustRequest = std::function< void(const std::string&, const std::string&, const std::vector<uint8_t>&, time_t)> |
Definition at line 40 of file contact_list.h.
using jami::ContactList::time_point = clock::time_point |
Definition at line 35 of file contact_list.h.
using jami::ContactList::VerifyResult = dht::crypto::TrustList::VerifyResult |
Definition at line 36 of file contact_list.h.
jami::ContactList::ContactList | ( | const std::string & | accountId, |
const std::shared_ptr< crypto::Certificate > & | cert, | ||
const std::filesystem::path & | path, | ||
OnChangeCallback | cb | ||
) |
Definition at line 34 of file contact_list.cpp.
References jami::emitSignal(), and jami::Manager::instance().
jami::ContactList::~ContactList | ( | ) |
Definition at line 48 of file contact_list.cpp.
void jami::ContactList::acceptConversation | ( | const std::string & | convId, |
const std::string & | deviceId = "" |
||
) |
Definition at line 424 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::acceptConversation, and jami::emitSignal().
Definition at line 407 of file contact_list.cpp.
References addContact(), and jami::emitSignal().
|
inline |
Definition at line 62 of file contact_list.h.
bool jami::ContactList::addContact | ( | const dht::InfoHash & | h, |
bool | confirmed = false , |
||
const std::string & | conversationId = "" |
||
) |
Definition at line 86 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::contactAdded, jami::emitSignal(), JAMI_WARNING, and saveContacts().
Referenced by acceptTrustRequest().
Definition at line 431 of file contact_list.cpp.
References jami::emitSignal().
void jami::ContactList::foundAccountDevice | ( | const dht::PkId & | device, |
const std::string & | name = {} , |
||
const time_point & | last_sync = time_point::min() |
||
) |
Definition at line 486 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::devicesChanged, jami::emitSignal(), and JAMI_LOG.
bool jami::ContactList::foundAccountDevice | ( | const std::shared_ptr< dht::crypto::Certificate > & | crt, |
const std::string & | name = {} , |
||
const time_point & | last_sync = time_point::min() , |
||
bool | notify = true |
||
) |
Definition at line 509 of file contact_list.cpp.
References jami::Manager::certStore(), jami::ContactList::OnChangeCallback::devicesChanged, jami::emitSignal(), jami::Manager::instance(), JAMI_ERROR, JAMI_LOG, and JAMI_WARNING.
std::string jami::ContactList::getAccountDeviceName | ( | const dht::PkId & | device | ) | const |
Definition at line 581 of file contact_list.cpp.
|
inline |
Definition at line 90 of file contact_list.h.
|
inline |
Definition at line 85 of file contact_list.h.
References jami::emitSignal().
std::map< std::string, std::string > jami::ContactList::getContactDetails | ( | const dht::InfoHash & | h | ) | const |
Definition at line 160 of file contact_list.cpp.
References jami::emitSignal(), and JAMI_WARNING.
Definition at line 176 of file contact_list.cpp.
References JAMI_WARNING.
Definition at line 187 of file contact_list.cpp.
Referenced by getSyncData().
|
inline |
Definition at line 131 of file contact_list.h.
DeviceSync jami::ContactList::getSyncData | ( | ) | const |
Definition at line 591 of file contact_list.cpp.
References jami::DeviceSync::date, jami::TrustRequest::device, jami::emitSignal(), and getContacts().
std::map< std::string, std::string > jami::ContactList::getTrustRequest | ( | const dht::InfoHash & | from | ) | const |
Definition at line 392 of file contact_list.cpp.
References libjami::Account::TrustRequest::CONVERSATIONID, jami::emitSignal(), libjami::Account::TrustRequest::FROM, libjami::Account::TrustRequest::PAYLOAD, and libjami::Account::TrustRequest::RECEIVED.
std::vector< std::map< std::string, std::string > > jami::ContactList::getTrustRequests | ( | ) | const |
Definition at line 374 of file contact_list.cpp.
References libjami::Account::TrustRequest::CONVERSATIONID, jami::emitSignal(), libjami::Account::TrustRequest::FROM, libjami::Account::TrustRequest::PAYLOAD, and libjami::Account::TrustRequest::RECEIVED.
Definition at line 95 of file contact_list.h.
References jami::emitSignal().
|
inline |
Definition at line 100 of file contact_list.h.
References jami::emitSignal().
void jami::ContactList::load | ( | ) |
Definition at line 51 of file contact_list.cpp.
bool jami::ContactList::onTrustRequest | ( | const dht::InfoHash & | peer_account, |
const std::shared_ptr< dht::crypto::PublicKey > & | peer_device, | ||
time_t | received, | ||
bool | confirm, | ||
const std::string & | conversationId, | ||
std::vector< uint8_t > && | payload | ||
) |
Inform of a new contact request.
Returns true if the request should be immediatly accepted (already a contact)
Definition at line 306 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::contactAdded, jami::emitSignal(), JAMI_LOG, jami::ContactList::OnChangeCallback::onConfirmation, and jami::ContactList::OnChangeCallback::trustRequest.
|
inline |
Definition at line 112 of file contact_list.h.
Definition at line 558 of file contact_list.cpp.
Definition at line 119 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::contactRemoved, jami::emitSignal(), jami::Manager::instance(), JAMI_WARNING, and saveContacts().
Definition at line 149 of file contact_list.cpp.
References saveContacts().
void jami::ContactList::save | ( | ) |
Definition at line 59 of file contact_list.cpp.
References saveContacts().
void jami::ContactList::saveContacts | ( | ) | const |
Should be called only after updateContact.
Definition at line 262 of file contact_list.cpp.
References jami::emitSignal(), and JAMI_LOG.
Referenced by addContact(), removeContact(), removeContactConversation(), save(), setContacts(), and updateConversation().
Definition at line 568 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::devicesChanged.
bool jami::ContactList::setCertificateStatus | ( | const std::shared_ptr< crypto::Certificate > & | cert, |
dhtnet::tls::TrustStore::PermissionStatus | status, | ||
bool | local = true |
||
) |
Definition at line 78 of file contact_list.cpp.
References jami::emitSignal().
bool jami::ContactList::setCertificateStatus | ( | const std::string & | cert_id, |
const dhtnet::tls::TrustStore::PermissionStatus | status | ||
) |
Definition at line 67 of file contact_list.cpp.
References jami::emitSignal(), and JAMI_LOG.
Definition at line 193 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::contactAdded, JAMI_LOG, and saveContacts().
bool jami::ContactList::syncDevice | ( | const dht::PkId & | device, |
const time_point & | syncDate | ||
) |
Definition at line 635 of file contact_list.cpp.
References JAMI_LOG, and JAMI_WARNING.
void jami::ContactList::updateContact | ( | const dht::InfoHash & | id, |
const Contact & | contact, | ||
bool | emit = true |
||
) |
Definition at line 205 of file contact_list.cpp.
References jami::ContactList::OnChangeCallback::contactAdded, jami::ContactList::OnChangeCallback::contactRemoved, jami::emitSignal(), JAMI_ERROR, and jami::toString().
void jami::ContactList::updateConversation | ( | const dht::InfoHash & | h, |
const std::string & | conversationId | ||
) |
Definition at line 109 of file contact_list.cpp.
References saveContacts().