From fabfd06e73f6ac99ce66c70fc95314e02caf4df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Mon, 14 Jun 2021 15:46:23 -0400 Subject: [PATCH] conversationrepository: fix signal emission Change-Id: Icb8b13668a749c27125f0377299cf96a51170132 --- src/jamidht/conversationrepository.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp index 9d0932cc6c..79f9c2824a 100644 --- a/src/jamidht/conversationrepository.cpp +++ b/src/jamidht/conversationrepository.cpp @@ -246,8 +246,8 @@ add_initial_files(GitRepository& repo, const std::shared_ptr<JamiAccount>& accou for (const auto& crl : account->identity().second->getRevocationLists()) { if (!crl) continue; - std::string crlPath = crlsPath + DIR_SEPARATOR_STR + deviceId + DIR_SEPARATOR_STR + dht::toHex(crl->getNumber()) - + ".crl"; + std::string crlPath = crlsPath + DIR_SEPARATOR_STR + deviceId + DIR_SEPARATOR_STR + + dht::toHex(crl->getNumber()) + ".crl"; file = fileutils::ofstream(crlPath, std::ios::trunc | std::ios::binary); if (!file.is_open()) { JAMI_ERR("Could not write data to %s", crlPath.c_str()); @@ -1280,13 +1280,13 @@ ConversationRepository::Impl::mode() const auto lastMsg = log(id_, "", 1); if (lastMsg.size() == 0) { - throw std::logic_error("Can't retrieve first commit"); if (auto shared = account_.lock()) { emitSignal<DRing::ConversationSignal::OnConversationError>(shared->getAccountID(), id_, EINVALIDMODE, "No initial commit"); } + throw std::logic_error("Can't retrieve first commit"); } auto commitMsg = lastMsg[0].commit_msg; @@ -1295,22 +1295,22 @@ ConversationRepository::Impl::mode() const Json::CharReaderBuilder rbuilder; auto reader = std::unique_ptr<Json::CharReader>(rbuilder.newCharReader()); if (!reader->parse(commitMsg.data(), commitMsg.data() + commitMsg.size(), &root, &err)) { - throw std::logic_error("Can't retrieve first commit"); if (auto shared = account_.lock()) { emitSignal<DRing::ConversationSignal::OnConversationError>(shared->getAccountID(), id_, EINVALIDMODE, "No initial commit"); } + throw std::logic_error("Can't retrieve first commit"); } if (!root.isMember("mode")) { - throw std::logic_error("No mode detected for initial commit"); if (auto shared = account_.lock()) { emitSignal<DRing::ConversationSignal::OnConversationError>(shared->getAccountID(), id_, EINVALIDMODE, "No mode detected"); } + throw std::logic_error("No mode detected for initial commit"); } int mode = root["mode"].asInt(); @@ -1335,7 +1335,6 @@ ConversationRepository::Impl::mode() const "Incorrect mode detected"); } throw std::logic_error("Incorrect mode detected"); - break; } return *mode_; } -- GitLab