|
Ring Daemon
|
#include <conversation.h>


Classes | |
| class | Impl |
Public Member Functions | |
| void | addGitSocket (const DeviceId &deviceId, const std::shared_ptr< dhtnet::ChannelSocket > &socket) |
| void | addKnownDevices (const std::vector< DeviceId > &devices, const std::string &memberUri) |
| Add known devices to the swarm manager. | |
| void | addMember (const std::string &contactUri, const OnDoneCb &cb={}) |
| Add conversation member. | |
| void | addSwarmChannel (std::shared_ptr< dhtnet::ChannelSocket > channel) |
| Add swarm connection to the DRT. | |
| void | bootstrap (std::function< void()> onBootstrapped, const std::vector< DeviceId > &knownDevices={}) |
| Bootstrap swarm manager to other peers. | |
| void | clearCache () |
| Clear all cached messages. | |
| void | clearFetched () |
| Reset fetched information. | |
| std::vector< std::string > | commitsEndedCalls () |
| Refresh active calls. | |
| void | connectivityChanged () |
| If we change from one network to one another, we will need to update the state of the connections. | |
| Conversation (const std::shared_ptr< JamiAccount > &account, const std::string &conversationId="") | |
| Conversation (const std::shared_ptr< JamiAccount > &account, const std::string &remoteDevice, const std::string &conversationId) | |
| Conversation (const std::shared_ptr< JamiAccount > &account, ConversationMode mode, const std::string &otherMember="") | |
| uint32_t | countInteractions (const std::string &toId, const std::string &fromId="", const std::string &authorUri="") const |
| Retrieve how many interactions there is from HEAD to interactionId. | |
| std::vector< std::map< std::string, std::string > > | currentCalls () const |
| Return current detected calls. | |
| std::shared_ptr< TransferManager > | dataTransfer () const |
| Access to transfer manager. | |
| bool | downloadFile (const std::string &interactionId, const std::string &fileId, const std::string &path, const std::string &member="", const std::string &deviceId="") |
| Adds a file to the waiting list and ask members. | |
| void | erase () |
| Erase all related datas. | |
| std::map< std::string, std::string > | generateInvitation () const |
| Generate an invitation to send to new contacts. | |
| std::optional< std::map< std::string, std::string > > | getCommit (const std::string &commitId) const |
| Retrieve one commit. | |
| std::vector< std::map< std::string, std::string > > | getConnectivity () const |
| Get connectivity information for the conversation. | |
| std::vector< jami::DeviceId > | getDeviceIdList () const |
| std::vector< std::string > | getInitialMembers () const |
| One to one util, get initial members. | |
| std::vector< std::map< std::string, std::string > > | getMembers (bool includeInvited=false, bool includeLeft=false, bool includeBanned=false) const |
| std::vector< std::map< std::string, std::string > > | getTrackedMembers () const |
| std::shared_ptr< dhtnet::ChannelSocket > | gitSocket (const DeviceId &deviceId) const |
| Git operations will need a ChannelSocket for cloning/fetching commits Because libgit2 is a C library, we store the pointer in the corresponding conversation and the GitTransport will inject to libgit2 whenever needed. | |
| bool | hasCommit (const std::string &commitId) const |
| Check if a commit exists in the repository. | |
| void | hasFetched (const std::string &deviceId, const std::string &commitId) |
| Store information about who fetch or not. | |
| bool | hasSwarmChannel (const std::string &deviceId) |
| Used to avoid multiple connections, we just check if we got a swarm channel with a specific device. | |
| void | hostConference (Json::Value &&message, OnDoneCb &&cb={}) |
| Host a conference in the conversation. | |
| std::string | id () const |
| Get conversation's id. | |
| std::map< std::string, std::string > | infos () const |
| Retrieve current infos (title, description, avatar, mode) | |
| bool | isBanned (const std::string &uri) const |
| bool | isBootstrapped () const |
| Check if we're at least connected to one node. | |
| bool | isHosting (const std::string &confId) const |
| Check if we're currently hosting this conference. | |
| bool | isInitialMember (const std::string &uri) const |
| bool | isMember (const std::string &uri, bool includeInvited=false) const |
| Test if an URI is a member. | |
| bool | isRemoving () |
| Check if we are removing the conversation. | |
| std::string | join () |
| Join a conversation. | |
| std::string | lastCommitId () const |
| Get last commit id. | |
| std::string | leave () |
| Leave a conversation. | |
| void | loadMessages (const OnLoadMessages &cb, const LogOptions &options) |
| Get a range of messages. | |
| std::set< std::string > | memberUris (std::string_view filter={}, const std::set< MemberRole > &filteredRoles={MemberRole::INVITED, MemberRole::LEFT, MemberRole::BANNED}) const |
| std::map< std::string, std::map< std::string, std::string > > | messageStatus () const |
| Retrieve last displayed and fetch status per member. | |
| ConversationMode | mode () const |
| Get conversation's mode. | |
| void | monitor () |
| Print the state of the DRT linked to the conversation. | |
| bool | onFileChannelRequest (const std::string &member, const std::string &fileId, std::filesystem::path &path, std::string &sha3sum) const |
| Choose if we can accept channel request. | |
| void | onMembersChanged (OnMembersChanged &&cb) |
| void | onMessageStatusChanged (const std::function< void(const std::map< std::string, std::map< std::string, std::string > > &)> &cb) |
| void | onNeedSocket (NeedSocketCb cb) |
| Set the callback that will be called whenever a new socket will be needed. | |
| std::vector< NodeId > | peersToSyncWith () const |
| Get peers to sync with. | |
| std::map< std::string, std::string > | preferences (bool includeLastModified) const |
| Retrieve current preferences (color, notification, etc) | |
| bool | pull (const std::string &deviceId, OnPullCb &&cb, std::string commitId="") |
| Fetch and merge from peer. | |
| void | removeActiveConference (Json::Value &&message, OnDoneCb &&cb={}) |
| Announce the end of a call. | |
| void | removeGitSocket (const DeviceId &deviceId) |
| void | removeMember (const std::string &contactUri, bool isDevice, const OnDoneCb &cb={}) |
| void | search (uint32_t req, const Filter &filter, const std::shared_ptr< std::atomic_int > &flag) const |
| Search in the conversation via a filter. | |
| void | sendMessage (Json::Value &&message, const std::string &replyTo="", OnCommitCb &&onCommit={}, OnDoneCb &&cb={}) |
| bool | setMessageDisplayed (const std::string &uri, const std::string &interactionId) |
| Store last read commit (returned in getMembers) | |
| void | setRemovingFlag () |
| Set a conversation as removing (when loading convInfo and still not sync) | |
| void | shutdownConnections () |
| Stop SwarmManager, bootstrap and gitSockets. | |
| void | sync (const std::string &member, const std::string &deviceId, OnPullCb &&cb, std::string commitId="") |
| Fetch new commits and re-ask for waiting files. | |
| std::shared_ptr< Typers > | typers () const |
| Get Typers object. | |
| void | updateInfos (const std::map< std::string, std::string > &map, const OnDoneCb &cb={}) |
| Change repository's infos. | |
| void | updateMessageStatus (const std::map< std::string, std::map< std::string, std::string > > &messageStatus) |
| Update fetch/read status. | |
| void | updatePreferences (const std::map< std::string, std::string > &map) |
| Change user's preferences. | |
| std::string | uriFromDevice (const std::string &deviceId) const |
| Retrieve the uri from a deviceId. | |
| std::vector< uint8_t > | vCard () const |
| ~Conversation () | |
Definition at line 164 of file conversation.h.
| jami::Conversation::Conversation | ( | const std::shared_ptr< JamiAccount > & | account, |
| ConversationMode | mode, | ||
| const std::string & | otherMember = "" |
||
| ) |
Definition at line 1409 of file conversation.cpp.
| jami::Conversation::Conversation | ( | const std::shared_ptr< JamiAccount > & | account, |
| const std::string & | conversationId = "" |
||
| ) |
Definition at line 1415 of file conversation.cpp.
| jami::Conversation::Conversation | ( | const std::shared_ptr< JamiAccount > & | account, |
| const std::string & | remoteDevice, | ||
| const std::string & | conversationId | ||
| ) |
Definition at line 1419 of file conversation.cpp.
| jami::Conversation::~Conversation | ( | ) |
Definition at line 1425 of file conversation.cpp.
| void jami::Conversation::addGitSocket | ( | const DeviceId & | deviceId, |
| const std::shared_ptr< dhtnet::ChannelSocket > & | socket | ||
| ) |
Definition at line 1498 of file conversation.cpp.
| void jami::Conversation::addKnownDevices | ( | const std::vector< DeviceId > & | devices, |
| const std::string & | memberUri | ||
| ) |
Add known devices to the swarm manager.
| devices | |
| memberUri |
Definition at line 2397 of file conversation.cpp.
References jami::emitSignal(), and JAMI_ERROR.

Add conversation member.
| uri | Member to add |
| cb | On done cb |
Definition at line 1434 of file conversation.cpp.
References jami::emitSignal(), getInitialMembers(), isBanned(), isMember(), JAMI_WARN, mode(), and jami::ONE_TO_ONE.

| void jami::Conversation::addSwarmChannel | ( | std::shared_ptr< dhtnet::ChannelSocket > | channel | ) |
Add swarm connection to the DRT.
| channel | Related channel |
Definition at line 2466 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::bootstrap | ( | std::function< void()> | onBootstrapped, |
| const std::vector< DeviceId > & | knownDevices = {} |
||
| ) |
Bootstrap swarm manager to other peers.
| onBootstrapped | Callback called when connection is established successfully |
| knownDevices | List of account's known devices |
Definition at line 2371 of file conversation.cpp.
References jami::emitSignal(), and JAMI_DEBUG.

| void jami::Conversation::clearCache | ( | ) |
Clear all cached messages.
Definition at line 1788 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::clearFetched | ( | ) |
Reset fetched information.
| std::vector< std::string > jami::Conversation::commitsEndedCalls | ( | ) |
Refresh active calls.
Definition at line 2415 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::connectivityChanged | ( | ) |
If we change from one network to one another, we will need to update the state of the connections.
Definition at line 1518 of file conversation.cpp.
| uint32_t jami::Conversation::countInteractions | ( | const std::string & | toId, |
| const std::string & | fromId = "", |
||
| const std::string & | authorUri = "" |
||
| ) | const |
Retrieve how many interactions there is from HEAD to interactionId.
| toId | "" for getting the whole history |
| fromId | "" => HEAD |
| authorURI | author to stop counting |
Definition at line 2487 of file conversation.cpp.
References jami::emitSignal(), and jami::LogOptions::to.

| std::vector< std::map< std::string, std::string > > jami::Conversation::currentCalls | ( | ) | const |
Return current detected calls.
Definition at line 2639 of file conversation.cpp.
References jami::emitSignal().

| std::shared_ptr< TransferManager > jami::Conversation::dataTransfer | ( | ) | const |
Access to transfer manager.
Definition at line 2094 of file conversation.cpp.
Referenced by onFileChannelRequest().
| bool jami::Conversation::downloadFile | ( | const std::string & | interactionId, |
| const std::string & | fileId, | ||
| const std::string & | path, | ||
| const std::string & | member = "", |
||
| const std::string & | deviceId = "" |
||
| ) |
Adds a file to the waiting list and ask members.
| interactionId | Related interaction id |
| fileId | Related id |
| path | Destination |
| member | Member if we know from who to pull file |
| deviceId | Device if we know from who to pull file |
Definition at line 2130 of file conversation.cpp.
References jami::emitSignal(), getCommit(), and JAMI_ERROR.

| void jami::Conversation::erase | ( | ) |
Erase all related datas.
Definition at line 1987 of file conversation.cpp.
References jami::emitSignal().

| std::map< std::string, std::string > jami::Conversation::generateInvitation | ( | ) | const |
Generate an invitation to send to new contacts.
Definition at line 1950 of file conversation.cpp.
References jami::ConversationMapKeys::CONVERSATIONID, jami::emitSignal(), id(), infos(), JAMI_WARNING, jami::ConversationMapKeys::METADATAS, and jami::json::toString().

| std::optional< std::map< std::string, std::string > > jami::Conversation::getCommit | ( | const std::string & | commitId | ) | const |
Retrieve one commit.
| commitId |
Definition at line 1764 of file conversation.cpp.
References jami::emitSignal().
Referenced by downloadFile(), and onFileChannelRequest().

| std::vector< std::map< std::string, std::string > > jami::Conversation::getConnectivity | ( | ) | const |
Get connectivity information for the conversation.
Definition at line 1537 of file conversation.cpp.
| std::vector< jami::DeviceId > jami::Conversation::getDeviceIdList | ( | ) | const |
Definition at line 1525 of file conversation.cpp.
| std::vector< std::string > jami::Conversation::getInitialMembers | ( | ) | const |
One to one util, get initial members.
Definition at line 2004 of file conversation.cpp.
Referenced by addMember(), isInitialMember(), and isMember().
| std::vector< std::map< std::string, std::string > > jami::Conversation::getMembers | ( | bool | includeInvited = false, |
| bool | includeLeft = false, |
||
| bool | includeBanned = false |
||
| ) | const |
| includeInvited | If we want invited members |
| includeLeft | If we want left members |
| includeBanned | If we want banned members |
Definition at line 1653 of file conversation.cpp.
References jami::emitSignal().

| std::vector< std::map< std::string, std::string > > jami::Conversation::getTrackedMembers | ( | ) | const |
Definition at line 1659 of file conversation.cpp.
| std::shared_ptr< dhtnet::ChannelSocket > jami::Conversation::gitSocket | ( | const DeviceId & | deviceId | ) | const |
Git operations will need a ChannelSocket for cloning/fetching commits Because libgit2 is a C library, we store the pointer in the corresponding conversation and the GitTransport will inject to libgit2 whenever needed.
Definition at line 1492 of file conversation.cpp.
Check if a commit exists in the repository.
| commitId | The commit id to check |
Definition at line 1758 of file conversation.cpp.
References jami::emitSignal().

Store information about who fetch or not.
This simplify sync (sync when a device without the last fetch is detected)
| deviceId | |
| commitId |
Definition at line 2192 of file conversation.cpp.
References jami::emitSignal(), and libjami::Account::SENT.

Used to avoid multiple connections, we just check if we got a swarm channel with a specific device.
| deviceId |
Definition at line 1543 of file conversation.cpp.
Host a conference in the conversation.
| message | message to commit |
| cb | callback triggered when committed |
Definition at line 2590 of file conversation.cpp.
References jami::emitSignal(), JAMI_ERROR, and sendMessage().

| std::string jami::Conversation::id | ( | ) | const |
Get conversation's id.
Definition at line 1428 of file conversation.cpp.
Referenced by generateInvitation(), search(), and jami::ConversationModule::Impl::sendMessageNotification().
| std::map< std::string, std::string > jami::Conversation::infos | ( | ) | const |
Retrieve current infos (title, description, avatar, mode)
Definition at line 2036 of file conversation.cpp.
Referenced by generateInvitation(), and isHosting().
Definition at line 1727 of file conversation.cpp.
Referenced by addMember().
| bool jami::Conversation::isBootstrapped | ( | ) | const |
Check if we're at least connected to one node.
Definition at line 1681 of file conversation.cpp.
Referenced by jami::ConversationModule::Impl::sendMessageNotification().
Check if we're currently hosting this conference.
| confId |
Definition at line 2609 of file conversation.cpp.
References jami::emitSignal(), and infos().

Definition at line 2010 of file conversation.cpp.
References getInitialMembers().

Test if an URI is a member.
| uri | URI to test |
Definition at line 1705 of file conversation.cpp.
References jami::MemberPath::ADMINS, jami::emitSignal(), getInitialMembers(), jami::MemberPath::INVITED, jami::MemberPath::MEMBERS, mode(), and jami::ONE_TO_ONE.
Referenced by addMember(), and onFileChannelRequest().

| bool jami::Conversation::isRemoving | ( | ) |
Check if we are removing the conversation.
Definition at line 1981 of file conversation.cpp.
| std::string jami::Conversation::join | ( | ) |
| std::string jami::Conversation::lastCommitId | ( | ) | const |
Get last commit id.
Definition at line 1802 of file conversation.cpp.
References jami::emitSignal(), and jami::LogOptions::nbOfCommits.
Referenced by jami::ConversationModule::Impl::sendMessageNotification().

| std::string jami::Conversation::leave | ( | ) |
Leave a conversation.
Definition at line 1967 of file conversation.cpp.
References jami::emitSignal(), and setRemovingFlag().

| void jami::Conversation::loadMessages | ( | const OnLoadMessages & | cb, |
| const LogOptions & | options | ||
| ) |
Get a range of messages.
| cb | The callback when loaded |
| options | The log options |
Definition at line 1773 of file conversation.cpp.
References jami::emitSignal().
Referenced by jami::Conversation::Impl::updateStatus().

| std::set< std::string > jami::Conversation::memberUris | ( | std::string_view | filter = {}, |
| const std::set< MemberRole > & | filteredRoles = {MemberRole::INVITED, MemberRole::LEFT, MemberRole::BANNED} |
||
| ) | const |
| filter | If we want to remove one member |
| filteredRoles | If we want to ignore some roles |
Definition at line 1665 of file conversation.cpp.
References jami::emitSignal().
Referenced by jami::ConversationModule::Impl::sendMessageNotification(), and jami::Conversation::Impl::setupMemberCallback().

| std::map< std::string, std::map< std::string, std::string > > jami::Conversation::messageStatus | ( | ) | const |
Retrieve last displayed and fetch status per member.
Definition at line 2296 of file conversation.cpp.
References jami::emitSignal().
Referenced by updateMessageStatus().

| ConversationMode jami::Conversation::mode | ( | ) | const |
Get conversation's mode.
Definition at line 1998 of file conversation.cpp.
Referenced by addMember(), and isMember().
| void jami::Conversation::monitor | ( | ) |
Print the state of the DRT linked to the conversation.
Definition at line 1693 of file conversation.cpp.
| bool jami::Conversation::onFileChannelRequest | ( | const std::string & | member, |
| const std::string & | fileId, | ||
| std::filesystem::path & | path, | ||
| std::string & | sha3sum | ||
| ) | const |
Choose if we can accept channel request.
| member | member to check |
| fileId | file transfer to check (needs to be waiting) |
| verifyShaSum | for debug only |
Definition at line 2100 of file conversation.cpp.
References dataTransfer(), jami::emitSignal(), getCommit(), isMember(), and JAMI_WARNING.

| void jami::Conversation::onMembersChanged | ( | OnMembersChanged && | cb | ) |
Definition at line 2431 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::onMessageStatusChanged | ( | const std::function< void(const std::map< std::string, std::map< std::string, std::string > > &)> & | cb | ) |
Definition at line 2334 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::onNeedSocket | ( | NeedSocketCb | cb | ) |
Set the callback that will be called whenever a new socket will be needed.
| cb |
Definition at line 2437 of file conversation.cpp.
References jami::emitSignal(), and JAMI_WARNING.

| std::vector< NodeId > jami::Conversation::peersToSyncWith | ( | ) | const |
Get peers to sync with.
This is mostly managed by the DRT
Definition at line 1671 of file conversation.cpp.
References _.
Referenced by jami::ConversationModule::Impl::sendMessageNotification().
| std::map< std::string, std::string > jami::Conversation::preferences | ( | bool | includeLastModified | ) | const |
Retrieve current preferences (color, notification, etc)
| includeLastModified | If we want to know when the preferences were modified |
Definition at line 2067 of file conversation.cpp.
References jami::emitSignal(), jami::LAST_MODIFIED, jami::fileutils::lastWriteTimeInSeconds(), jami::fileutils::loadFile(), and preferences().
Referenced by preferences().

| bool jami::Conversation::pull | ( | const std::string & | deviceId, |
| OnPullCb && | cb, | ||
| std::string | commitId = "" |
||
| ) |
Fetch and merge from peer.
| deviceId | Peer device |
| cb | On pulled callback |
| commitId | Commit id that triggered this fetch |
Definition at line 1821 of file conversation.cpp.
References jami::emitSignal(), and JAMI_DEBUG.
Referenced by sync().

Announce the end of a call.
| message | message to commit |
| cb | callback triggered when committed |
Definition at line 2619 of file conversation.cpp.
References jami::emitSignal(), JAMI_ERROR, and sendMessage().

Definition at line 1504 of file conversation.cpp.
| void jami::Conversation::removeMember | ( | const std::string & | contactUri, |
| bool | isDevice, | ||
| const OnDoneCb & | cb = {} |
||
| ) |
Definition at line 1587 of file conversation.cpp.
References jami::ADMIN, jami::emitSignal(), jami::INVITED, JAMI_WARN, and jami::MEMBER.

| void jami::Conversation::search | ( | uint32_t | req, |
| const Filter & | filter, | ||
| const std::shared_ptr< std::atomic_int > & | flag | ||
| ) | const |
Search in the conversation via a filter.
| req | Id of the request |
| filter | Parameters for the search |
| flag | To check when search is finished |
Definition at line 2502 of file conversation.cpp.
References jami::Break, jami::GitAuthor::email, jami::emitSignal(), id(), jami::Ok, std::regex_search(), and jami::Skip.

| void jami::Conversation::sendMessage | ( | Json::Value && | message, |
| const std::string & | replyTo = "", |
||
| OnCommitCb && | onCommit = {}, |
||
| OnDoneCb && | cb = {} |
||
| ) |
Definition at line 1733 of file conversation.cpp.
References jami::emitSignal(), and JAMI_ERR.
Referenced by hostConference(), and removeActiveConference().

| bool jami::Conversation::setMessageDisplayed | ( | const std::string & | uri, |
| const std::string & | interactionId | ||
| ) |
Store last read commit (returned in getMembers)
| uri | Of the member |
| interactionId | Last interaction displayed |
Definition at line 2277 of file conversation.cpp.
References libjami::Account::DISPLAYED, and jami::emitSignal().

| void jami::Conversation::setRemovingFlag | ( | ) |
Set a conversation as removing (when loading convInfo and still not sync)
Definition at line 1975 of file conversation.cpp.
Referenced by leave().
| void jami::Conversation::shutdownConnections | ( | ) |
Stop SwarmManager, bootstrap and gitSockets.
Definition at line 1510 of file conversation.cpp.
| void jami::Conversation::sync | ( | const std::string & | member, |
| const std::string & | deviceId, | ||
| OnPullCb && | cb, | ||
| std::string | commitId = "" |
||
| ) |
Fetch new commits and re-ask for waiting files.
Definition at line 1937 of file conversation.cpp.
References jami::emitSignal(), and pull().

| std::shared_ptr< Typers > jami::Conversation::typers | ( | ) | const |
| void jami::Conversation::updateInfos | ( | const std::map< std::string, std::string > & | map, |
| const OnDoneCb & | cb = {} |
||
| ) |
Change repository's infos.
| map | New infos (supported keys: title, description, avatar) |
| cb | On commited |
Definition at line 2017 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::updateMessageStatus | ( | const std::map< std::string, std::map< std::string, std::string > > & | messageStatus | ) |
Update fetch/read status.
| messageStatus | A map with the following structure: {uri, { {"fetch", "commitId"}, {"fetched_ts", "timestamp"}, {"read", "commitId"}, {"read_ts", "timestamp"} } } |
Definition at line 2303 of file conversation.cpp.
References libjami::Account::DISPLAYED, jami::emitSignal(), messageStatus(), and libjami::Account::SENT.

Change user's preferences.
| map | New preferences |
Definition at line 2042 of file conversation.cpp.
References jami::emitSignal(), jami::LAST_MODIFIED, and jami::fileutils::lastWriteTimeInSeconds().

| std::string jami::Conversation::uriFromDevice | ( | const std::string & | deviceId | ) | const |
Retrieve the uri from a deviceId.
| deviceId |
Definition at line 1687 of file conversation.cpp.
Referenced by jami::ConversationModule::Impl::sendMessageNotification().
| std::vector< uint8_t > jami::Conversation::vCard | ( | ) | const |
Definition at line 2084 of file conversation.cpp.
References jami::fileutils::loadFile().
