Ring Daemon 16.0.0
|
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 > > | getMembers (bool includeInvited, bool includeLeft) const |
std::vector< std::map< std::string, std::string > > | getMembers (bool includeInvited, bool includeLeft, bool includeBanned) 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 | init (const std::shared_ptr< JamiAccount > &account) |
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< std::map< std::string, std::string > > | loadMessages (const LogOptions &options) |
std::vector< libjami::SwarmMessage > | loadMessages2 (const LogOptions &options, History *optHistory=nullptr) |
void | loadStatus () |
std::vector< std::map< std::string, std::string > > | mergeHistory (const std::string &uri) |
void | pull (const std::string &deviceId) |
void | rectifyStatus (const std::shared_ptr< libjami::SwarmMessage > &message, History &history) const |
void | removeGitSocket (const DeviceId &deviceId) |
std::filesystem::path | repoPath () const |
void | saveActiveCalls () const |
void | saveHostedCalls () const |
void | saveStatus () |
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 | |
std::weak_ptr< JamiAccount > | account_ |
std::string | accountId_ {} |
std::vector< std::map< std::string, std::string > > | activeCalls_ {} |
std::mutex | activeCallsMtx_ {} |
std::filesystem::path | activeCallsPath_ {} |
std::function< void()> | bootstrapCb_ |
std::set< std::string > | checkedMembers_ |
std::filesystem::path | conversationDataPath_ {} |
std::string | deviceId_ |
std::unique_ptr< asio::steady_timer > | fallbackTimer_ |
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_ {} |
std::shared_ptr< asio::io_context > | ioContext_ |
std::atomic_bool | isRemoving_ {false} |
History | loadedHistory_ {} |
Loaded history represents the linearized history to show for clients. | |
std::mutex | membersMtx_ {} |
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_ {} |
std::filesystem::path | preferencesPath_ {} |
std::mutex | pullcbsMtx_ {} |
std::unique_ptr< ConversationRepository > | repository_ |
std::filesystem::path | sendingPath_ {} |
std::filesystem::path | statusPath_ {} |
std::shared_ptr< SwarmManager > | swarmManager_ |
std::shared_ptr< TransferManager > | transferManager_ {} |
std::shared_ptr< Typers > | typers_ |
std::string | userId_ |
std::mutex | writeMtx_ {} |
Definition at line 134 of file conversation.cpp.
|
inline |
Definition at line 137 of file conversation.cpp.
References jami::emitSignal(), init(), and repository_.
|
inline |
Definition at line 152 of file conversation.cpp.
References jami::emitSignal(), init(), and repository_.
|
inline |
Definition at line 165 of file conversation.cpp.
References accountId_, jami::ConversationMapKeys::ACTIVE_CALLS, activeCallsPath_, jami::ConversationRepository::cloneConversation(), conversationDataPath_, jami::EFETCH, jami::emitSignal(), jami::fileutils::get_data_dir(), init(), initActiveCalls(), and repository_.
|
inline |
Definition at line 229 of file conversation.cpp.
References jami::emitSignal(), fallbackTimer_, JAMI_ERROR, and toString().
|
inline |
Definition at line 590 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 1150 of file conversation.cpp.
References libjami::Account::DISPLAYED, jami::emitSignal(), libjami::Account::SENDING, and libjami::Account::SENT.
Referenced by announce().
|
inline |
Definition at line 248 of file conversation.cpp.
References announce(), and jami::emitSignal().
Referenced by announce(), announce(), and voteUnban().
|
inline |
Definition at line 437 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 256 of file conversation.cpp.
References announce(), jami::emitSignal(), and repository_.
|
inline |
Definition at line 565 of file conversation.cpp.
References jami::emitSignal(), 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 764 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 723 of file conversation.cpp.
References jami::emitSignal().
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 743 of file conversation.cpp.
References jami::BANNED, jami::emitSignal(), jami::INVITED, jami::ConversationMapKeys::LAST_DISPLAYED, and jami::LEFT.
|
inline |
Definition at line 584 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 999 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 1073 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 975 of file conversation.cpp.
References accountId_, jami::emitSignal(), and repository_.
|
inline |
Definition at line 193 of file conversation.cpp.
References account_, accountId_, jami::ConversationMapKeys::ACTIVE_CALLS, activeCallsPath_, conversationDataPath_, deviceId_, jami::emitSignal(), fallbackTimer_, fetchedPath_, jami::fileutils::get_data_dir(), jami::Manager::getSeededRandomEngine(), jami::ConversationMapKeys::HOSTED_CALLS, hostedCallsPath_, jami::Manager::instance(), jami::Manager::ioContext(), ioContext_, loadActiveCalls(), loadStatus(), jami::ConversationMapKeys::PREFERENCES, preferencesPath_, repository_, sendingPath_, statusPath_, swarmManager_, transferManager_, and typers_.
Referenced by Impl(), Impl(), and Impl().
|
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 273 of file conversation.cpp.
References accountId_, activeCalls_, activeCallsMtx_, jami::emitSignal(), repository_, and saveActiveCalls().
Referenced by Impl().
bool jami::Conversation::Impl::isAdmin | ( | ) | const |
Definition at line 716 of file conversation.cpp.
References jami::emitSignal(), jami::fileutils::getFullPath(), repoPath(), and userId_.
Referenced by voteUnban().
|
inline |
Definition at line 519 of file conversation.cpp.
References activeCalls_, activeCallsMtx_, activeCallsPath_, jami::emitSignal(), and jami::fileutils::loadFile().
Referenced by init().
|
inline |
Definition at line 539 of file conversation.cpp.
References activeCallsMtx_, jami::emitSignal(), hostedCalls_, hostedCallsPath_, and jami::fileutils::loadFile().
std::vector< std::map< std::string, std::string > > jami::Conversation::Impl::loadMessages | ( | const LogOptions & | options | ) |
Definition at line 809 of file conversation.cpp.
References jami::Break, jami::emitSignal(), jami::Ok, and jami::Skip.
std::vector< libjami::SwarmMessage > jami::Conversation::Impl::loadMessages2 | ( | const LogOptions & | options, |
History * | optHistory = nullptr |
||
) |
Definition at line 862 of file conversation.cpp.
References jami::Break, jami::emitSignal(), jami::Ok, and jami::Skip.
|
inline |
Definition at line 501 of file conversation.cpp.
References jami::emitSignal(), jami::fileutils::loadFile(), messagesStatus_, messageStatusMtx_, and statusPath_.
Referenced by init().
std::vector< std::map< std::string, std::string > > jami::Conversation::Impl::mergeHistory | ( | const std::string & | uri | ) |
Definition at line 1760 of file conversation.cpp.
References jami::emitSignal(), JAMI_ERROR, JAMI_LOG, JAMI_WARNING, and jami::toString().
Definition at line 1834 of file conversation.cpp.
References jami::emitSignal(), JAMI_ERROR, JAMI_WARNING, jami::Conversation::loadMessages(), and jami::LogOptions::to.
void jami::Conversation::Impl::rectifyStatus | ( | const std::shared_ptr< libjami::SwarmMessage > & | message, |
History & | history | ||
) | const |
Definition at line 1120 of file conversation.cpp.
References jami::emitSignal().
Definition at line 594 of file conversation.cpp.
References jami::emitSignal(), and gitSocketList_.
std::filesystem::path jami::Conversation::Impl::repoPath | ( | ) | const |
Definition at line 803 of file conversation.cpp.
References jami::fileutils::get_data_dir().
Referenced by bannedType(), and isAdmin().
|
inline |
Definition at line 533 of file conversation.cpp.
References activeCalls_, activeCallsPath_, and jami::emitSignal().
Referenced by initActiveCalls(), and updateActiveCalls().
|
inline |
Definition at line 553 of file conversation.cpp.
References jami::emitSignal(), hostedCalls_, and hostedCallsPath_.
|
inline |
Definition at line 513 of file conversation.cpp.
References jami::emitSignal(), messagesStatus_, and statusPath_.
|
inline |
Definition at line 224 of file conversation.cpp.
References accountId_, jami::emitSignal(), and repository_.
Referenced by ~Impl().
|
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 332 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 2215 of file conversation.cpp.
References _, jami::emitSignal(), jami::Conversation::loadMessages2(), and libjami::Account::SENT.
void jami::Conversation::Impl::voteUnban | ( | const std::string & | contactUri, |
const std::string_view | type, | ||
const OnDoneCb & | cb | ||
) |
Definition at line 1429 of file conversation.cpp.
References announce(), jami::emitSignal(), isAdmin(), JAMI_WARN, repository_, and writeMtx_.
std::weak_ptr<JamiAccount> jami::Conversation::Impl::account_ |
Definition at line 621 of file conversation.cpp.
Referenced by init().
std::string jami::Conversation::Impl::accountId_ {} |
Definition at line 622 of file conversation.cpp.
Referenced by announce(), handleReaction(), Impl(), init(), initActiveCalls(), toString(), and updateActiveCalls().
|
mutable |
Definition at line 650 of file conversation.cpp.
Referenced by initActiveCalls(), loadActiveCalls(), saveActiveCalls(), and updateActiveCalls().
|
mutable |
Definition at line 649 of file conversation.cpp.
Referenced by initActiveCalls(), loadActiveCalls(), loadHostedCalls(), and updateActiveCalls().
std::filesystem::path jami::Conversation::Impl::activeCallsPath_ {} |
Definition at line 648 of file conversation.cpp.
Referenced by Impl(), init(), loadActiveCalls(), and saveActiveCalls().
std::function<void()> jami::Conversation::Impl::bootstrapCb_ |
Definition at line 613 of file conversation.cpp.
std::set<std::string> jami::Conversation::Impl::checkedMembers_ |
Definition at line 612 of file conversation.cpp.
std::filesystem::path jami::Conversation::Impl::conversationDataPath_ {} |
Definition at line 636 of file conversation.cpp.
std::string jami::Conversation::Impl::deviceId_ |
Definition at line 624 of file conversation.cpp.
Referenced by init().
std::unique_ptr<asio::steady_timer> jami::Conversation::Impl::fallbackTimer_ |
Definition at line 656 of file conversation.cpp.
std::filesystem::path jami::Conversation::Impl::fetchedPath_ {} |
Definition at line 637 of file conversation.cpp.
Referenced by init().
std::map<std::string, std::deque<std::pair<std::string, OnPullCb> > > jami::Conversation::Impl::fetchingRemotes_ {} |
Definition at line 634 of file conversation.cpp.
|
mutable |
Definition at line 227 of file conversation.cpp.
|
mutable |
Definition at line 703 of file conversation.cpp.
GitSocketList jami::Conversation::Impl::gitSocketList_ {} |
Definition at line 652 of file conversation.cpp.
Referenced by addGitSocket(), gitSocket(), and removeGitSocket().
|
mutable |
Definition at line 646 of file conversation.cpp.
Referenced by loadHostedCalls(), and saveHostedCalls().
std::filesystem::path jami::Conversation::Impl::hostedCallsPath_ {} |
Definition at line 645 of file conversation.cpp.
Referenced by init(), loadHostedCalls(), and saveHostedCalls().
std::shared_ptr<asio::io_context> jami::Conversation::Impl::ioContext_ |
Definition at line 655 of file conversation.cpp.
Referenced by init().
std::atomic_bool jami::Conversation::Impl::isRemoving_ {false} |
Definition at line 625 of file conversation.cpp.
History jami::Conversation::Impl::loadedHistory_ {} |
Loaded history represents the linearized history to show for clients.
Definition at line 662 of file conversation.cpp.
Referenced by announce().
std::mutex jami::Conversation::Impl::membersMtx_ {} |
Definition at line 611 of file conversation.cpp.
|
mutable |
Status: 0 = commited, 1 = fetched, 2 = read This cache the curent status to add in the messages.
Definition at line 698 of file conversation.cpp.
|
mutable |
Definition at line 691 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 689 of file conversation.cpp.
|
mutable |
{uri, { {"fetch", "commitId"}, {"fetched_ts", "timestamp"}, {"read", "commitId"}, {"read_ts", "timestamp"} } }
Definition at line 688 of file conversation.cpp.
Referenced by loadStatus().
OnMembersChanged jami::Conversation::Impl::onMembersChanged_ {} |
Definition at line 642 of file conversation.cpp.
Referenced by announce().
std::filesystem::path jami::Conversation::Impl::preferencesPath_ {} |
Definition at line 641 of file conversation.cpp.
Referenced by init().
std::mutex jami::Conversation::Impl::pullcbsMtx_ {} |
Definition at line 633 of file conversation.cpp.
std::unique_ptr<ConversationRepository> jami::Conversation::Impl::repository_ |
Definition at line 619 of file conversation.cpp.
Referenced by announce(), announce(), handleReaction(), Impl(), Impl(), Impl(), init(), initActiveCalls(), toString(), updateActiveCalls(), and voteUnban().
std::filesystem::path jami::Conversation::Impl::sendingPath_ {} |
Definition at line 640 of file conversation.cpp.
Referenced by init().
std::filesystem::path jami::Conversation::Impl::statusPath_ {} |
Definition at line 690 of file conversation.cpp.
Referenced by init(), loadStatus(), and saveStatus().
std::shared_ptr<SwarmManager> jami::Conversation::Impl::swarmManager_ |
Definition at line 620 of file conversation.cpp.
Referenced by init().
std::shared_ptr<TransferManager> jami::Conversation::Impl::transferManager_ {} |
Definition at line 635 of file conversation.cpp.
Referenced by init().
std::shared_ptr<Typers> jami::Conversation::Impl::typers_ |
Definition at line 712 of file conversation.cpp.
Referenced by announce(), and init().
std::string jami::Conversation::Impl::userId_ |
Definition at line 623 of file conversation.cpp.
Referenced by announce(), and isAdmin().
std::mutex jami::Conversation::Impl::writeMtx_ {} |
Definition at line 618 of file conversation.cpp.
Referenced by voteUnban().