Own omemo key display, a bit of CMake clean up
This commit is contained in:
parent
19835af3cf
commit
00af582287
16 changed files with 443 additions and 360 deletions
|
@ -1,18 +1,20 @@
|
|||
// Squawk messenger.
|
||||
// Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/*
|
||||
* Squawk messenger.
|
||||
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "manager.h"
|
||||
|
||||
|
@ -39,17 +41,14 @@ Core::DelayManager::Manager::Manager(const QString& poj, Job::Id mpj, QObject* p
|
|||
requestedBundles(),
|
||||
#endif
|
||||
ownJid(poj)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Core::DelayManager::Manager::~Manager() {
|
||||
for (const std::pair<const Job::Id, Job*>& pair : runningJobs) {
|
||||
for (const std::pair<const Job::Id, Job*>& pair : runningJobs)
|
||||
delete pair.second;
|
||||
}
|
||||
|
||||
for (Job* job : jobSequence) {
|
||||
for (Job* job : jobSequence)
|
||||
delete job;
|
||||
}
|
||||
}
|
||||
|
||||
Core::DelayManager::Job::Id Core::DelayManager::Manager::getNextJobId() {
|
||||
|
@ -151,11 +150,10 @@ void Core::DelayManager::Manager::preScheduleJob(Job* job) {
|
|||
|
||||
void Core::DelayManager::Manager::scheduleJob(Job* job) {
|
||||
preScheduleJob(job);
|
||||
if (runningJobs.size() < maxParallelJobs) {
|
||||
if (runningJobs.size() < maxParallelJobs)
|
||||
executeJob(job);
|
||||
} else {
|
||||
else
|
||||
scheduledJobs.push_back(job);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::DelayManager::Manager::preExecuteJob(Job* job) {
|
||||
|
@ -190,9 +188,9 @@ void Core::DelayManager::Manager::executeJob(Job* job) {
|
|||
|
||||
void Core::DelayManager::Manager::jobIsDone(Job::Id jobId) {
|
||||
std::map<Job::Id, Job*>::const_iterator itr = runningJobs.find(jobId);
|
||||
if (itr == runningJobs.end()) {
|
||||
if (itr == runningJobs.end())
|
||||
throw JobNotFound(jobId, "jobIsDone");
|
||||
}
|
||||
|
||||
Job* job = itr->second;
|
||||
delete job;
|
||||
runningJobs.erase(itr);
|
||||
|
@ -292,9 +290,9 @@ void Core::DelayManager::Manager::receivedVCard(const QString& jid, const Shared
|
|||
Job::Id jobId = cardItr->second;
|
||||
requestedVCards.erase(cardItr);
|
||||
std::map<Job::Id, Job*>::const_iterator itr = runningJobs.find(jobId);
|
||||
if (itr == runningJobs.end()) {
|
||||
if (itr == runningJobs.end())
|
||||
throw JobNotFound(jobId, "receivedVCard");
|
||||
}
|
||||
|
||||
Job* job = itr->second;
|
||||
|
||||
switch (job->type) {
|
||||
|
@ -330,9 +328,9 @@ void Core::DelayManager::Manager::receivedOwnVCard(const Shared::VCard& card) {
|
|||
Job::Id jobId = ownVCardJobId;
|
||||
ownVCardJobId = 0;
|
||||
std::map<Job::Id, Job*>::const_iterator itr = runningJobs.find(jobId);
|
||||
if (itr == runningJobs.end()) {
|
||||
if (itr == runningJobs.end())
|
||||
throw JobNotFound(jobId, "receivedOwnVCard");
|
||||
}
|
||||
|
||||
Job* job = itr->second;
|
||||
switch (job->type) {
|
||||
case Job::Type::ownCardInternal:
|
||||
|
@ -388,9 +386,9 @@ void Core::DelayManager::Manager::receivedOwnBundles(const std::list<Shared::Key
|
|||
Job::Id jobId = ownInfoJobId;
|
||||
ownInfoJobId = 0;
|
||||
std::map<Job::Id, Job*>::const_iterator jitr = runningJobs.find(jobId);
|
||||
if (jitr == runningJobs.end()) {
|
||||
if (jitr == runningJobs.end())
|
||||
throw JobNotFound(jobId, "receivedOwnBundles");
|
||||
}
|
||||
|
||||
Job* jb = jitr->second;
|
||||
OwnInfoForUser* job = dynamic_cast<OwnInfoForUser*>(jb);
|
||||
|
||||
|
@ -414,9 +412,9 @@ Core::DelayManager::Manager::UnexpectedJobType::UnexpectedJobType(Job::Type p_ty
|
|||
std::string Core::DelayManager::Manager::UnexpectedJobType::getMessage() const{
|
||||
std::string msg("Unexpected job type: ");
|
||||
msg += Job::TypeString[static_cast<int>(type)];
|
||||
if (method.size() > 0) {
|
||||
if (method.size() > 0)
|
||||
msg += " in method " + method;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -430,8 +428,8 @@ std::string Core::DelayManager::Manager::JobNotFound::getMessage() const {
|
|||
std::string msg("Job with id ");
|
||||
msg += std::to_string(id);
|
||||
msg += " was not found";
|
||||
if (method.size() > 0) {
|
||||
if (method.size() > 0)
|
||||
msg += " in method " + method;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue