|
Ring Daemon
|

Classes | |
| struct | TrackedMember |
Public Member Functions | |
| void | addGitSocket (const DeviceId &deviceId, const std::shared_ptr< dhtnet::ChannelSocket > &socket) |
| std::vector< std::shared_ptr< libjami::SwarmMessage > > | addToHistory (History &history, const std::vector< std::map< std::string, std::string > > &commits, bool messageReceived=false, bool commitFromSelf=false) |
| void | announce (const std::string &commitId, bool commitFromSelf=false) |
| void | announce (const std::vector< std::map< std::string, std::string > > &commits, bool commitFromSelf=false) |
| void | announce (const std::vector< std::string > &commits, bool commitFromSelf=false) |
| std::string_view | bannedType (const std::string &uri) const |
| std::vector< std::string > | commitsEndedCalls () |
| If, for whatever reason, the daemon is stopped while hosting a conference, we need to announce the end of this call when restarting. | |
| void | disconnectFromPeer (const std::string &peerUri) |
| Remove all git sockets and all DRT nodes associated with the given peer. | |
| std::vector< std::map< std::string, std::string > > | getConnectivity () const |
| std::vector< std::map< std::string, std::string > > | getMembers (bool includeInvited, bool includeLeft) const |
| std::vector< std::map< std::string, std::string > > | getMembers (bool includeInvited, bool includeLeft, bool includeBanned) const |
| std::vector< std::map< std::string, std::string > > | getTrackedMembers () const |
| std::shared_ptr< dhtnet::ChannelSocket > | gitSocket (const DeviceId &deviceId) const |
| void | handleEdition (History &history, const std::shared_ptr< libjami::SwarmMessage > &sharedCommit, bool messageReceived) const |
| bool | handleMessage (History &history, const std::shared_ptr< libjami::SwarmMessage > &sharedCommit, bool messageReceived) const |
| void | handleReaction (History &history, const std::shared_ptr< libjami::SwarmMessage > &sharedCommit) const |
| Impl (const std::shared_ptr< JamiAccount > &account, const std::string &conversationId) | |
| Impl (const std::shared_ptr< JamiAccount > &account, const std::string &remoteDevice, const std::string &conversationId) | |
| Impl (const std::shared_ptr< JamiAccount > &account, ConversationMode mode, const std::string &otherMember="") | |
| void | initActiveCalls (const std::vector< std::map< std::string, std::string > > &commits) const |
| Initialize activeCalls_ from the list of commits in the repository. | |
| bool | isAdmin () const |
| void | loadActiveCalls () const |
| void | loadHostedCalls () const |
| std::vector< libjami::SwarmMessage > | loadMessages (const LogOptions &options, History *optHistory=nullptr) |
| void | loadStatus () |
| void | monitorConnection (std::weak_ptr< Conversation > w) |
| void | onConnectionFailed (const DeviceId &deviceId, const std::string &memberUri="") |
| void | pull (const std::string &deviceId) |
| void | rectifyStatus (const std::shared_ptr< libjami::SwarmMessage > &message, History &history) const |
| void | removeGitSocket (const DeviceId &deviceId) |
| void | rotateTrackedMembers (const std::string &memberUri="", const DeviceId &deviceId={}) |
| void | saveActiveCalls () const |
| void | saveHostedCalls () const |
| void | saveStatus () |
| void | setupMemberCallback () |
| void | startTracking (std::weak_ptr< Conversation > w) |
| void | stopTracking () |
| std::string | toString () const |
| void | updateActiveCalls (const std::map< std::string, std::string > &commit, bool eraseOnly=false, bool emitSig=true) const |
| Update activeCalls_ via announced commits (in load or via new commits) | |
| void | updateStatus (const std::string &uri, libjami::Account::MessageStates status, const std::string &commitId, const std::string &ts, bool emit=false) |
| void | voteUnban (const std::string &contactUri, const std::string_view type, const OnDoneCb &cb) |
| ~Impl () | |
Public Attributes | |
| const std::weak_ptr< JamiAccount > | account_ |
| const std::string | accountId_ |
| std::vector< std::map< std::string, std::string > > | activeCalls_ {} |
| std::mutex | activeCallsMtx_ {} |
| std::filesystem::path | activeCallsPath_ {} |
| std::function< void()> | bootstrapCb_ |
| std::mutex | bootstrapMtx_ {} |
| const std::filesystem::path | conversationDataPath_ {} |
| const std::string | deviceId_ |
| const std::filesystem::path | fetchedPath_ {} |
| std::map< std::string, std::deque< std::pair< std::string, OnPullCb > > > | fetchingRemotes_ {} |
| std::string | fmtStr_ |
| std::map< std::string, std::map< std::string, int32_t > > | futureStatus |
| GitSocketList | gitSocketList_ {} |
| std::map< std::string, uint64_t > | hostedCalls_ {} |
| std::filesystem::path | hostedCallsPath_ {} |
| const std::shared_ptr< asio::io_context > | ioContext_ |
| std::atomic_bool | isRemoving_ {false} |
| bool | isTracking_ {false} |
| History | loadedHistory_ {} |
| Loaded history represents the linearized history to show for clients. | |
| std::map< std::string, int32_t > | memberToStatus |
| Status: 0 = commited, 1 = fetched, 2 = read This cache the curent status to add in the messages. | |
| std::map< std::string, std::map< std::string, std::string > > | messagesStatus_ {} |
| std::function< void(const std::map< std::string, std::map< std::string, std::string > > &)> | messageStatusCb_ {} |
| std::mutex | messageStatusMtx_ |
| {uri, { {"fetch", "commitId"}, {"fetched_ts", "timestamp"}, {"read", "commitId"}, {"read_ts", "timestamp"} } } | |
| OnMembersChanged | onMembersChanged_ {} |
| const std::filesystem::path | preferencesPath_ {} |
| uint64_t | presenceDeviceListenerToken_ {0} |
| std::mutex | pullcbsMtx_ {} |
| const std::filesystem::path | repoPath_ {} |
| const std::unique_ptr< ConversationRepository > | repository_ |
| const std::filesystem::path | sendingPath_ {} |
| const std::filesystem::path | statusPath_ {} |
| const std::shared_ptr< SwarmManager > | swarmManager_ |
| std::map< std::string, TrackedMember > | trackedMembers_ |
| std::mutex | trackedMembersMtx_ |
| const std::shared_ptr< TransferManager > | transferManager_ {} |
| std::shared_ptr< Typers > | typers_ |
| const std::string | userId_ |
| std::mutex | writeMtx_ {} |
Definition at line 150 of file conversation.cpp.
|
inline |
Definition at line 196 of file conversation.cpp.
|
inline |
Definition at line 200 of file conversation.cpp.
|
inline |
Definition at line 204 of file conversation.cpp.
|
inline |
Definition at line 220 of file conversation.cpp.
References stopTracking().

|
inline |
Definition at line 555 of file conversation.cpp.
References gitSocketList_.
| std::vector< std::shared_ptr< libjami::SwarmMessage > > jami::Conversation::Impl::addToHistory | ( | History & | history, |
| const std::vector< std::map< std::string, std::string > > & | commits, | ||
| bool | messageReceived = false, |
||
| bool | commitFromSelf = false |
||
| ) |
Definition at line 1269 of file conversation.cpp.
References libjami::Account::DISPLAYED, jami::emitSignal(), libjami::Account::SENDING, and libjami::Account::SENT.
Referenced by announce().

|
inline |
Definition at line 230 of file conversation.cpp.
References announce(), and jami::emitSignal().
Referenced by announce(), announce(), and voteUnban().

|
inline |
Definition at line 406 of file conversation.cpp.
References accountId_, addToHistory(), jami::emitSignal(), jami::ConversationMapKeys::ID, jami::Manager::instance(), loadedHistory_, onMembersChanged_, repository_, typers_, updateActiveCalls(), and userId_.

|
inline |
Definition at line 238 of file conversation.cpp.
References announce(), jami::emitSignal(), and repository_.

|
inline |
Definition at line 531 of file conversation.cpp.
References jami::MemberPath::ADMINS, jami::MemberPath::BANNED, jami::MemberPath::DEVICES, jami::emitSignal(), jami::MemberPath::INVITED, jami::MemberPath::MEMBERS, and repoPath_.

| std::vector< std::string > jami::Conversation::Impl::commitsEndedCalls | ( | ) |
If, for whatever reason, the daemon is stopped while hosting a conference, we need to announce the end of this call when restarting.
To avoid to keep active calls forever.
Definition at line 956 of file conversation.cpp.
References jami::emitSignal(), JAMI_DEBUG, and jami::json::toString().

Remove all git sockets and all DRT nodes associated with the given peer.
This is used when a swarm member is banned to ensure that we stop syncing with them or sending them message notifications.
Definition at line 890 of file conversation.cpp.
References jami::emitSignal().

|
inline |
Definition at line 213 of file conversation.cpp.
References swarmManager_.
| std::vector< std::map< std::string, std::string > > jami::Conversation::Impl::getMembers | ( | bool | includeInvited, |
| bool | includeLeft | ||
| ) | const |
| std::vector< std::map< std::string, std::string > > jami::Conversation::Impl::getMembers | ( | bool | includeInvited, |
| bool | includeLeft, | ||
| bool | includeBanned | ||
| ) | const |
Definition at line 910 of file conversation.cpp.
References jami::BANNED, jami::emitSignal(), jami::INVITED, jami::ConversationMapKeys::LAST_DISPLAYED, and jami::LEFT.

| std::vector< std::map< std::string, std::string > > jami::Conversation::Impl::getTrackedMembers | ( | ) | const |
Definition at line 936 of file conversation.cpp.
References jami::emitSignal().

|
inline |
Definition at line 549 of file conversation.cpp.
References jami::emitSignal(), and gitSocketList_.

| void jami::Conversation::Impl::handleEdition | ( | History & | history, |
| const std::shared_ptr< libjami::SwarmMessage > & | sharedCommit, | ||
| bool | messageReceived | ||
| ) | const |
Definition at line 1127 of file conversation.cpp.
References jami::emitSignal().

| bool jami::Conversation::Impl::handleMessage | ( | History & | history, |
| const std::shared_ptr< libjami::SwarmMessage > & | sharedCommit, | ||
| bool | messageReceived | ||
| ) | const |
Definition at line 1197 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::Impl::handleReaction | ( | History & | history, |
| const std::shared_ptr< libjami::SwarmMessage > & | sharedCommit | ||
| ) | const |
Definition at line 1104 of file conversation.cpp.
References jami::emitSignal().

|
inline |
Initialize activeCalls_ from the list of commits in the repository.
| commits | Commits in reverse chronological order (i.e. from newest to oldest) |
Definition at line 254 of file conversation.cpp.
References accountId_, activeCalls_, activeCallsMtx_, jami::emitSignal(), repository_, and saveActiveCalls().

| bool jami::Conversation::Impl::isAdmin | ( | ) | const |
Definition at line 883 of file conversation.cpp.
References jami::MemberPath::ADMINS, jami::emitSignal(), and jami::fileutils::getFullPath().
Referenced by voteUnban().

|
inline |
Definition at line 483 of file conversation.cpp.
References activeCalls_, activeCallsMtx_, activeCallsPath_, jami::emitSignal(), and jami::fileutils::loadFile().

|
inline |
Definition at line 503 of file conversation.cpp.
References activeCallsMtx_, jami::emitSignal(), hostedCalls_, hostedCallsPath_, and jami::fileutils::loadFile().

| std::vector< libjami::SwarmMessage > jami::Conversation::Impl::loadMessages | ( | const LogOptions & | options, |
| History * | optHistory = nullptr |
||
| ) |
Definition at line 994 of file conversation.cpp.
References jami::Break, jami::emitSignal(), jami::Ok, and jami::Skip.

|
inline |
Definition at line 465 of file conversation.cpp.
References jami::emitSignal(), jami::fileutils::loadFile(), messagesStatus_, messageStatusMtx_, and statusPath_.

| void jami::Conversation::Impl::monitorConnection | ( | std::weak_ptr< Conversation > | w | ) |
Definition at line 848 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::Impl::onConnectionFailed | ( | const DeviceId & | deviceId, |
| const std::string & | memberUri = "" |
||
| ) |
Definition at line 842 of file conversation.cpp.
References jami::emitSignal().

Definition at line 1849 of file conversation.cpp.
References jami::emitSignal(), JAMI_ERROR, and JAMI_WARNING.

| void jami::Conversation::Impl::rectifyStatus | ( | const std::shared_ptr< libjami::SwarmMessage > & | message, |
| History & | history | ||
| ) | const |
Definition at line 1243 of file conversation.cpp.
References jami::emitSignal().

Definition at line 559 of file conversation.cpp.
References jami::emitSignal(), and gitSocketList_.

| void jami::Conversation::Impl::rotateTrackedMembers | ( | const std::string & | memberUri = "", |
| const DeviceId & | deviceId = {} |
||
| ) |
Definition at line 774 of file conversation.cpp.
References jami::emitSignal(), jami::Manager::getSeededRandomEngine(), jami::Manager::instance(), JAMI_WARNING, and jami::toString().

|
inline |
Definition at line 497 of file conversation.cpp.
References activeCalls_, activeCallsPath_, and jami::emitSignal().
Referenced by initActiveCalls(), and updateActiveCalls().

|
inline |
Definition at line 517 of file conversation.cpp.
References jami::emitSignal(), hostedCalls_, and hostedCallsPath_.

|
inline |
Definition at line 477 of file conversation.cpp.
References jami::emitSignal(), messagesStatus_, and statusPath_.

| void jami::Conversation::Impl::setupMemberCallback | ( | ) |
Definition at line 689 of file conversation.cpp.
References account_, jami::emitSignal(), isTracking_, jami::Conversation::memberUris(), onMembersChanged_, repository_, trackedMembers_, and trackedMembersMtx_.

| void jami::Conversation::Impl::startTracking | ( | std::weak_ptr< Conversation > | w | ) |
Definition at line 714 of file conversation.cpp.
References jami::emitSignal().

| void jami::Conversation::Impl::stopTracking | ( | ) |
Definition at line 739 of file conversation.cpp.
References _, account_, jami::emitSignal(), isTracking_, presenceDeviceListenerToken_, trackedMembers_, and trackedMembersMtx_.
Referenced by ~Impl().

|
inline |
Definition at line 208 of file conversation.cpp.
References accountId_, jami::emitSignal(), and repository_.

|
inline |
Update activeCalls_ via announced commits (in load or via new commits)
| commit | Commit to check |
| eraseOnly | If we want to ignore added commits |
| emitSig | If we want to emit to client |
Definition at line 310 of file conversation.cpp.
References accountId_, activeCalls_, activeCallsMtx_, jami::emitSignal(), JAMI_DEBUG, JAMI_ERROR, JAMI_WARNING, repository_, and saveActiveCalls().
Referenced by announce().

| void jami::Conversation::Impl::updateStatus | ( | const std::string & | uri, |
| libjami::Account::MessageStates | status, | ||
| const std::string & | commitId, | ||
| const std::string & | ts, | ||
| bool | emit = false |
||
| ) |
Definition at line 2212 of file conversation.cpp.
References _, jami::emitSignal(), jami::Conversation::loadMessages(), and libjami::Account::SENT.

| void jami::Conversation::Impl::voteUnban | ( | const std::string & | contactUri, |
| const std::string_view | type, | ||
| const OnDoneCb & | cb | ||
| ) |
Definition at line 1551 of file conversation.cpp.
References announce(), jami::emitSignal(), isAdmin(), JAMI_WARN, repository_, and writeMtx_.

| const std::weak_ptr<JamiAccount> jami::Conversation::Impl::account_ |
Definition at line 583 of file conversation.cpp.
Referenced by setupMemberCallback(), and stopTracking().
| const std::string jami::Conversation::Impl::accountId_ |
Definition at line 584 of file conversation.cpp.
Referenced by announce(), initActiveCalls(), toString(), and updateActiveCalls().
|
mutable |
Definition at line 630 of file conversation.cpp.
Referenced by initActiveCalls(), loadActiveCalls(), saveActiveCalls(), and updateActiveCalls().
|
mutable |
Definition at line 629 of file conversation.cpp.
Referenced by initActiveCalls(), loadActiveCalls(), loadHostedCalls(), and updateActiveCalls().
| std::filesystem::path jami::Conversation::Impl::activeCallsPath_ {} |
Definition at line 628 of file conversation.cpp.
Referenced by loadActiveCalls(), and saveActiveCalls().
| std::function<void()> jami::Conversation::Impl::bootstrapCb_ |
Definition at line 575 of file conversation.cpp.
| std::mutex jami::Conversation::Impl::bootstrapMtx_ {} |
Definition at line 576 of file conversation.cpp.
| const std::filesystem::path jami::Conversation::Impl::conversationDataPath_ {} |
Definition at line 598 of file conversation.cpp.
| const std::string jami::Conversation::Impl::deviceId_ |
Definition at line 586 of file conversation.cpp.
| const std::filesystem::path jami::Conversation::Impl::fetchedPath_ {} |
Definition at line 599 of file conversation.cpp.
| std::map<std::string, std::deque<std::pair<std::string, OnPullCb> > > jami::Conversation::Impl::fetchingRemotes_ {} |
Definition at line 595 of file conversation.cpp.
|
mutable |
Definition at line 218 of file conversation.cpp.
| std::map<std::string, std::map<std::string, int32_t> > jami::Conversation::Impl::futureStatus |
Definition at line 677 of file conversation.cpp.
| GitSocketList jami::Conversation::Impl::gitSocketList_ {} |
Definition at line 632 of file conversation.cpp.
Referenced by addGitSocket(), gitSocket(), and removeGitSocket().
|
mutable |
Definition at line 626 of file conversation.cpp.
Referenced by loadHostedCalls(), and saveHostedCalls().
| std::filesystem::path jami::Conversation::Impl::hostedCallsPath_ {} |
Definition at line 625 of file conversation.cpp.
Referenced by loadHostedCalls(), and saveHostedCalls().
| const std::shared_ptr<asio::io_context> jami::Conversation::Impl::ioContext_ |
Definition at line 635 of file conversation.cpp.
| std::atomic_bool jami::Conversation::Impl::isRemoving_ {false} |
Definition at line 588 of file conversation.cpp.
Definition at line 614 of file conversation.cpp.
Referenced by setupMemberCallback(), and stopTracking().
| History jami::Conversation::Impl::loadedHistory_ {} |
Loaded history represents the linearized history to show for clients.
Definition at line 640 of file conversation.cpp.
Referenced by announce().
| std::map<std::string, int32_t> jami::Conversation::Impl::memberToStatus |
Status: 0 = commited, 1 = fetched, 2 = read This cache the curent status to add in the messages.
Definition at line 673 of file conversation.cpp.
| std::map<std::string, std::map<std::string, std::string> > jami::Conversation::Impl::messagesStatus_ {} |
Definition at line 666 of file conversation.cpp.
Referenced by loadStatus(), and saveStatus().
| std::function<void(const std::map<std::string, std::map<std::string, std::string>>&)> jami::Conversation::Impl::messageStatusCb_ {} |
Definition at line 665 of file conversation.cpp.
|
mutable |
{uri, { {"fetch", "commitId"}, {"fetched_ts", "timestamp"}, {"read", "commitId"}, {"read_ts", "timestamp"} } }
Definition at line 664 of file conversation.cpp.
Referenced by loadStatus().
| OnMembersChanged jami::Conversation::Impl::onMembersChanged_ {} |
Definition at line 606 of file conversation.cpp.
Referenced by announce(), and setupMemberCallback().
| const std::filesystem::path jami::Conversation::Impl::preferencesPath_ {} |
Definition at line 603 of file conversation.cpp.
| uint64_t jami::Conversation::Impl::presenceDeviceListenerToken_ {0} |
Definition at line 622 of file conversation.cpp.
Referenced by stopTracking().
| std::mutex jami::Conversation::Impl::pullcbsMtx_ {} |
Definition at line 593 of file conversation.cpp.
| const std::filesystem::path jami::Conversation::Impl::repoPath_ {} |
Definition at line 597 of file conversation.cpp.
Referenced by bannedType().
| const std::unique_ptr<ConversationRepository> jami::Conversation::Impl::repository_ |
Definition at line 582 of file conversation.cpp.
Referenced by announce(), announce(), initActiveCalls(), setupMemberCallback(), toString(), updateActiveCalls(), and voteUnban().
| const std::filesystem::path jami::Conversation::Impl::sendingPath_ {} |
Definition at line 602 of file conversation.cpp.
| const std::filesystem::path jami::Conversation::Impl::statusPath_ {} |
Definition at line 604 of file conversation.cpp.
Referenced by loadStatus(), and saveStatus().
| const std::shared_ptr<SwarmManager> jami::Conversation::Impl::swarmManager_ |
Definition at line 587 of file conversation.cpp.
Referenced by getConnectivity().
| std::map<std::string, TrackedMember> jami::Conversation::Impl::trackedMembers_ |
Definition at line 612 of file conversation.cpp.
Referenced by setupMemberCallback(), and stopTracking().
|
mutable |
Definition at line 613 of file conversation.cpp.
Referenced by setupMemberCallback(), and stopTracking().
| const std::shared_ptr<TransferManager> jami::Conversation::Impl::transferManager_ {} |
Definition at line 596 of file conversation.cpp.
| std::shared_ptr<Typers> jami::Conversation::Impl::typers_ |
Definition at line 685 of file conversation.cpp.
Referenced by announce().
| const std::string jami::Conversation::Impl::userId_ |
Definition at line 585 of file conversation.cpp.
Referenced by announce().
| std::mutex jami::Conversation::Impl::writeMtx_ {} |
Definition at line 581 of file conversation.cpp.
Referenced by voteUnban().