From 9fff40963021b2a0b9d80b9f8cb53f9817ae1678 Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 7 Mar 2023 21:45:01 +0300 Subject: [PATCH] some more thinking about delay manager --- core/delayManager/CMakeLists.txt | 4 + core/delayManager/cardinternal.cpp | 14 ++- core/delayManager/cardinternal.h | 20 ++--- core/delayManager/contact.cpp | 26 ++++++ core/delayManager/contact.h | 39 +++++++++ core/delayManager/delaymanager.cpp | 120 ++++++++++++++++++++------ core/delayManager/delaymanager.h | 18 ++-- core/delayManager/info.cpp | 34 ++++++++ core/delayManager/info.h | 48 +++++++++++ core/delayManager/infoforuser.cpp | 12 ++- core/delayManager/infoforuser.h | 15 ++-- core/delayManager/job.cpp | 10 +-- core/delayManager/job.h | 13 ++- core/delayManager/owncardinternal.cpp | 6 +- core/delayManager/owncardinternal.h | 12 +-- core/delayManager/owninfoforuser.cpp | 10 ++- core/delayManager/owninfoforuser.h | 15 ++-- 17 files changed, 320 insertions(+), 96 deletions(-) create mode 100644 core/delayManager/contact.cpp create mode 100644 core/delayManager/contact.h create mode 100644 core/delayManager/info.cpp create mode 100644 core/delayManager/info.h diff --git a/core/delayManager/CMakeLists.txt b/core/delayManager/CMakeLists.txt index f9ccb57..96f4cef 100644 --- a/core/delayManager/CMakeLists.txt +++ b/core/delayManager/CMakeLists.txt @@ -5,6 +5,8 @@ set(SOURCE_FILES infoforuser.cpp owncardinternal.cpp owninfoforuser.cpp + contact.cpp + info.cpp ) set(HEADER_FILES @@ -14,6 +16,8 @@ set(HEADER_FILES infoforuser.h owncardinternal.h owninfoforuser.h + contact.h + info.h ) target_sources(squawk PRIVATE diff --git a/core/delayManager/cardinternal.cpp b/core/delayManager/cardinternal.cpp index c7a599a..c9ed203 100644 --- a/core/delayManager/cardinternal.cpp +++ b/core/delayManager/cardinternal.cpp @@ -16,17 +16,13 @@ #include "cardinternal.h" -Core::CardInternal::CardInternal(Job::Id p_id, const QString& p_jid) : - Job(p_id, Type::cardInternal), - jid(p_id) +Core::DelayManager::CardInternal::CardInternal(Id p_id, const QString& p_jid) : + Job(p_id, Type::cardInternal), + Contact(p_id, p_jid, Type::cardInternal) {} -Core::CardInternal::CardInternal(Job::Id p_id, const QString& p_jid, Job::Type p_type) : - Job(p_id, p_type), - jid(p_id) -{} -Core::CardInternal::CardInternal(const Core::CardInternal& other) : +Core::DelayManager::CardInternal::CardInternal(const CardInternal& other) : Job(other), - jid(other.jid) + Contact(other) {} diff --git a/core/delayManager/cardinternal.h b/core/delayManager/cardinternal.h index a95f0ba..17dd1ba 100644 --- a/core/delayManager/cardinternal.h +++ b/core/delayManager/cardinternal.h @@ -14,28 +14,24 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef CORE_CARDINTERNAL_H -#define CORE_CARDINTERNAL_H +#ifndef CORE_DELAYMANAGER_CARDINTERNAL_H +#define CORE_DELAYMANAGER_CARDINTERNAL_H #include -#include "job.h" +#include "contact.h" namespace Core { +namespace DelayManager { -class CardInternal : public Job { -protected: - CardInternal(Job::Id id, const QString& jid, Job::Type type); - +class CardInternal : public Contact { public: - CardInternal(Job::Id id, const QString& jid); + CardInternal(Id id, const QString& jid); CardInternal(const CardInternal& other); - - const QString jid; - }; +} } -#endif // CORE_CARDINTERNAL_H +#endif // CORE_DELAYMANAGER_CARDINTERNAL_H diff --git a/core/delayManager/contact.cpp b/core/delayManager/contact.cpp new file mode 100644 index 0000000..286c8bd --- /dev/null +++ b/core/delayManager/contact.cpp @@ -0,0 +1,26 @@ +// Squawk messenger. +// Copyright (C) 2019 Yury Gubich +// +// 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 . + +#include "contact.h" + +Core::DelayManager::Contact::Contact(const Contact& other): + Job(other), + jid(other.jid) {} + + +Core::DelayManager::Contact::Contact(Id p_id, const QString& p_jid, Type p_type): + Job(p_id, p_type), + jid(p_jid) {} diff --git a/core/delayManager/contact.h b/core/delayManager/contact.h new file mode 100644 index 0000000..c136525 --- /dev/null +++ b/core/delayManager/contact.h @@ -0,0 +1,39 @@ +// Squawk messenger. +// Copyright (C) 2019 Yury Gubich +// +// 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 . + +#ifndef CORE_DELAYMANAGER_CONTACT_H +#define CORE_DELAYMANAGER_CONTACT_H + +#include + +#include "job.h" + +namespace Core { +namespace DelayManager { + +class Contact : public virtual Job { +protected: + Contact(Id id, const QString& jid, Type type); + Contact(const Contact& other); + +public: + const QString jid; +}; + +} +} + +#endif // CORE_DELAYMANAGER_CONTACT_H diff --git a/core/delayManager/delaymanager.cpp b/core/delayManager/delaymanager.cpp index 6ebc85d..906724f 100644 --- a/core/delayManager/delaymanager.cpp +++ b/core/delayManager/delaymanager.cpp @@ -21,7 +21,7 @@ #include "owncardinternal.h" #include "owninfoforuser.h" -Core::DelayManager::DelayManager(Job::Id mpj, QObject* parent) : +Core::DelayManager::Manager::Manager(Job::Id mpj, QObject* parent) : QObject(parent), maxParallelJobs(mpj), nextJobId(1), @@ -33,13 +33,23 @@ Core::DelayManager::DelayManager(Job::Id mpj, QObject* parent) : ownInfoJobId(0), scheduledVCards(), requestedVCards(), +#ifdef WITH_OMEMO requestedBundles() +#endif { } -Core::DelayManager::~DelayManager() {} +Core::DelayManager::Manager::~Manager() { + for (const std::pair& pair : runningJobs) { + delete pair.second; + } -Core::Job::Id Core::DelayManager::getNextJobId() { + for (Job* job : jobSequence) { + delete job; + } +} + +Core::Job::Id Core::DelayManager::Manager::getNextJobId() { Job::Id id = nextJobId++; if (id == 0) id = nextJobId++; @@ -47,7 +57,7 @@ Core::Job::Id Core::DelayManager::getNextJobId() { return id; } -void Core::DelayManager::getInfo(const QString& jid) { +void Core::DelayManager::Manager::getInfo(const QString& jid) { Job* job = nullptr; #ifdef WITH_OMEMO std::map::const_iterator bitr = requestedBundles.find(jid); @@ -58,13 +68,13 @@ void Core::DelayManager::getInfo(const QString& jid) { job = getVCardJob(jid); if (job != nullptr) { - if (job->getType() == Job::Type::cardInternal) + if (job->type == Job::Type::cardInternal) replaceJob(new InfoForUser(job->id, jid)); } else scheduleJob(new InfoForUser(getNextJobId(), jid)); } -void Core::DelayManager::getOwnInfo() { +void Core::DelayManager::Manager::getOwnInfo() { if (ownInfoJobId == 0) { if (ownVCardJobId != 0) replaceJob(new OwnInfoForUser(ownVCardJobId)); @@ -73,18 +83,18 @@ void Core::DelayManager::getOwnInfo() { } } -void Core::DelayManager::getVCard(const QString& jid) { +void Core::DelayManager::Manager::getVCard(const QString& jid) { Job* job = getVCardJob(jid); if (job == nullptr) scheduleJob(new CardInternal(getNextJobId(), jid)); } -void Core::DelayManager::getOwnVCard() { +void Core::DelayManager::Manager::getOwnVCard() { if (ownInfoJobId == 0) scheduleJob(new OwnCardInternal(getNextJobId())); } -Core::Job* Core::DelayManager::getVCardJob(const QString& jid) { +Core::Job* Core::DelayManager::Manager::getVCardJob(const QString& jid) { Job* job = nullptr; std::map::const_iterator sitr = scheduledVCards.find(jid); if (sitr == scheduledVCards.end()) { @@ -97,16 +107,16 @@ Core::Job* Core::DelayManager::getVCardJob(const QString& jid) { return job; } -void Core::DelayManager::preScheduleJob(Core::Job* job) { - switch (job->getType()) { +void Core::DelayManager::Manager::preScheduleJob(Core::Job* job) { + switch (job->type) { case Job::Type::cardInternal: - scheduledVCards.emplace(static_cast(job)->jid, job->id); + scheduledVCards.emplace(dynamic_cast(job)->jid, job->id); break; case Job::Type::ownCardInternal: ownVCardJobId = job->id; break; case Job::Type::infoForUser: - scheduledVCards.emplace(static_cast(job)->jid, job->id); + scheduledVCards.emplace(dynamic_cast(job)->jid, job->id); break; case Job::Type::ownInfoForUser: ownVCardJobId = job->id; @@ -115,7 +125,7 @@ void Core::DelayManager::preScheduleJob(Core::Job* job) { } } -void Core::DelayManager::scheduleJob(Core::Job* job) { +void Core::DelayManager::Manager::scheduleJob(Core::Job* job) { preScheduleJob(job); if (runningJobs.size() < maxParallelJobs) { executeJob(job); @@ -124,11 +134,11 @@ void Core::DelayManager::scheduleJob(Core::Job* job) { } } -void Core::DelayManager::preExecuteJob(Core::Job* job) { - switch (job->getType()) { +void Core::DelayManager::Manager::preExecuteJob(Core::Job* job) { + switch (job->type) { case Job::Type::cardInternal: case Job::Type::infoForUser: { - CardInternal* cij = static_cast(job); + Contact* cij = dynamic_cast(job); requestedVCards.emplace(cij->jid, job->id); scheduledVCards.erase(cij->jid); } @@ -139,13 +149,13 @@ void Core::DelayManager::preExecuteJob(Core::Job* job) { } } -void Core::DelayManager::executeJob(Core::Job* job) { +void Core::DelayManager::Manager::executeJob(Core::Job* job) { preExecuteJob(job); runningJobs.emplace(job->id, job); - switch (job->getType()) { + switch (job->type) { case Job::Type::cardInternal: case Job::Type::infoForUser: - emit requestVCard(static_cast(job)->jid); + emit requestVCard(dynamic_cast(job)->jid); break; case Job::Type::ownInfoForUser: case Job::Type::ownCardInternal: @@ -154,7 +164,7 @@ void Core::DelayManager::executeJob(Core::Job* job) { } } -void Core::DelayManager::jobIsDone(Job::Id jobId) { +void Core::DelayManager::Manager::jobIsDone(Job::Id jobId) { std::map::const_iterator itr = runningJobs.find(jobId); if (itr == runningJobs.end()) { throw 8573; //not supposed to happen, ever @@ -169,7 +179,7 @@ void Core::DelayManager::jobIsDone(Job::Id jobId) { } } -void Core::DelayManager::replaceJob(Core::Job* job) { +void Core::DelayManager::Manager::replaceJob(Core::Job* job) { preScheduleJob(job); std::map::iterator itr = runningJobs.find(job->id); if (itr != runningJobs.end()) { @@ -187,7 +197,63 @@ void Core::DelayManager::replaceJob(Core::Job* job) { } } -void Core::DelayManager::receivedVCard(const QString& jid, const Shared::VCard& card) { +void Core::DelayManager::Manager::jobIsCanceled(Core::Job* job, bool wasRunning) { + switch (job->type) { + case Job::Type::cardInternal: { + CardInternal* jb = dynamic_cast(job); + if (wasRunning) + requestedVCards.erase(jb->jid); + else + scheduledVCards.erase(jb->jid); + + emit receivedVCard(jb->jid, Shared::VCard()); + } + break; + case Job::Type::infoForUser: { + InfoForUser* jb = dynamic_cast(job); + if (jb->getStage() == InfoForUser::Stage::waitingForVCard) { + if (wasRunning) + requestedVCards.erase(jb->jid); + else + scheduledVCards.erase(jb->jid); + + emit receivedVCard(jb->jid, Shared::VCard()); + } + emit receivedInfo(Shared::Info(jb->jid)); + } + break; + case Job::Type::ownInfoForUser: { + OwnInfoForUser* jb = dynamic_cast(job); + if (jb->getStage() == OwnInfoForUser::Stage::waitingForVCard) { + ownVCardJobId = 0; + emit receivedOwnCard(Shared::VCard()); + } + ownInfoJobId = 0; + emit receivedOwnInfo(Shared::Info ("")); + } + + break; + case Job::Type::ownCardInternal: + ownVCardJobId = 0; + emit receivedOwnCard(Shared::VCard()); + break; + } + + delete job; +} + +void Core::DelayManager::Manager::disconnected() { + for (const std::pair pair : runningJobs) + jobIsCanceled(pair.second, true); + + for (Job* job : scheduledJobs) + jobIsCanceled(job, false); + + runningJobs.clear(); + scheduledJobs.clear(); +} + +void Core::DelayManager::Manager::receivedVCard(const QString& jid, const Shared::VCard& card) { std::map::const_iterator cardItr = requestedVCards.find(jid); if (cardItr == requestedVCards.end()) { throw 8575; //never supposed to happen, the state is not correct; @@ -195,7 +261,7 @@ void Core::DelayManager::receivedVCard(const QString& jid, const Shared::VCard& Job::Id jobId = cardItr->second; requestedVCards.erase(cardItr); Job* job = runningJobs.at(jobId); - switch (job->getType()) { + switch (job->type) { case Job::Type::cardInternal: jobIsDone(jobId); emit receivedCard(jid, card); @@ -221,11 +287,11 @@ void Core::DelayManager::receivedVCard(const QString& jid, const Shared::VCard& } } -void Core::DelayManager::ownVCardReceived(const Shared::VCard& card) { +void Core::DelayManager::Manager::ownVCardReceived(const Shared::VCard& card) { Job::Id jobId = ownVCardJobId; ownVCardJobId = 0; Job* job = runningJobs.at(jobId); - switch (job->getType()) { + switch (job->type) { case Job::Type::ownCardInternal: jobIsDone(jobId); emit receivedOwnCard(card); @@ -250,6 +316,6 @@ void Core::DelayManager::ownVCardReceived(const Shared::VCard& card) { } } -void Core::DelayManager::receivedBundles(const QString& jid) { +void Core::DelayManager::Manager::receivedBundles(const QString& jid) { } diff --git a/core/delayManager/delaymanager.h b/core/delayManager/delaymanager.h index e4f3e2a..c3d1da8 100644 --- a/core/delayManager/delaymanager.h +++ b/core/delayManager/delaymanager.h @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef CORE_DELAYMANAGER_H -#define CORE_DELAYMANAGER_H +#ifndef CORE_DELAYMANAGER_MANAGER_H +#define CORE_DELAYMANAGER_MANAGER_H #include #include @@ -34,13 +34,14 @@ #include "job.h" namespace Core { +namespace DelayManager { -class DelayManager : public QObject +class Manager : public QObject { Q_OBJECT public: - DelayManager(Job::Id maxParallelJobs = 5, QObject* parent = nullptr); - ~DelayManager(); + Manager(Job::Id maxParallelJobs = 5, QObject* parent = nullptr); + ~Manager(); void getOwnVCard(); void getOwnInfo(); @@ -58,6 +59,7 @@ signals: void receivedOwnInfo(const Shared::Info& info); public slots: + void disconnected(); void ownVCardReceived(const Shared::VCard& card); void receivedVCard(const QString& jid, const Shared::VCard& card); void receivedBundles(const QString& jid); @@ -67,6 +69,7 @@ private: void scheduleJob(Job* job); void preExecuteJob(Job* job); void executeJob(Job* job); + void jobIsCanceled(Job* job, bool wasRunning); void jobIsDone(Job::Id jobId); Job::Id getNextJobId(); void replaceJob(Job* job); @@ -108,9 +111,12 @@ private: Job::Id ownInfoJobId; std::map scheduledVCards; std::map requestedVCards; +#ifdef WITH_OMEMO std::map requestedBundles; +#endif }; +} } -#endif // CORE_DELAYMANAGER_H +#endif // CORE_DELAYMANAGER_MANAGER_H diff --git a/core/delayManager/info.cpp b/core/delayManager/info.cpp new file mode 100644 index 0000000..3b61f63 --- /dev/null +++ b/core/delayManager/info.cpp @@ -0,0 +1,34 @@ +// Squawk messenger. +// Copyright (C) 2019 Yury Gubich +// +// 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 . + +#include "info.h" + +Core::DelayManager::Info::Info(Id p_id, Type p_type) : + Job(p_id, p_type), + stage(Stage::waitingForVCard) +{} + +Core::DelayManager::Info::Info(const Info& other) : + Job(other), + stage(other.stage) +{} + +Core::DelayManager::Info::~Info() { +} + +Core::DelayManager::Info::Stage Core::DelayManager::Info::getStage() const { + return stage; +} diff --git a/core/delayManager/info.h b/core/delayManager/info.h new file mode 100644 index 0000000..0c4249a --- /dev/null +++ b/core/delayManager/info.h @@ -0,0 +1,48 @@ +// Squawk messenger. +// Copyright (C) 2019 Yury Gubich +// +// 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 . + +#ifndef CORE_DELAYMANAGER_INFO_H +#define CORE_DELAYMANAGER_INFO_H + +#include "job.h" + +namespace Core { +namespace DelayManager { + +class Info : public virtual Job { +public: + enum class Stage { + waitingForVCard, + waitingForBundles + }; + +protected: + Info(Id id, Type type); + Info(const Info& other); + +public: + ~Info(); + + Stage getStage() const; + +private: + Stage stage; +}; + +} +} + +#endif // CORE_DELAYMANAGER_INFO_H diff --git a/core/delayManager/infoforuser.cpp b/core/delayManager/infoforuser.cpp index 31d0571..fc494fb 100644 --- a/core/delayManager/infoforuser.cpp +++ b/core/delayManager/infoforuser.cpp @@ -16,11 +16,15 @@ #include "infoforuser.h" -Core::InfoForUser::InfoForUser(Job::Id p_id, const QString& p_jid) : - CardInternal(p_id, p_jid, Type::infoForUser) +Core::DelayManager::InfoForUser::InfoForUser(Id p_id, const QString& p_jid) : + Job(p_id, Type::infoForUser), + Contact(p_id, p_jid, Type::infoForUser), + Info(p_id, Type::infoForUser) {} -Core::InfoForUser::InfoForUser(const Core::InfoForUser& other) : - CardInternal(other) +Core::DelayManager::InfoForUser::InfoForUser(const InfoForUser& other) : + Job(other), + Contact(other), + Info(other) {} diff --git a/core/delayManager/infoforuser.h b/core/delayManager/infoforuser.h index 2bc84e4..651d741 100644 --- a/core/delayManager/infoforuser.h +++ b/core/delayManager/infoforuser.h @@ -14,19 +14,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef CORE_INFOFORUSER_H -#define CORE_INFOFORUSER_H +#ifndef CORE_DELAYMANAGER_INFOFORUSER_H +#define CORE_DELAYMANAGER_INFOFORUSER_H -#include "cardinternal.h" +#include "contact.h" +#include "info.h" namespace Core { +namespace DelayManager { -class InfoForUser : public CardInternal { +class InfoForUser : public Contact, public Info { public: - InfoForUser(Job::Id id, const QString& jid); + InfoForUser(Id id, const QString& jid); InfoForUser(const InfoForUser& other); }; +} } -#endif // CORE_INFOFORUSER_H +#endif // CORE_DELAYMANAGER_INFOFORUSER_H diff --git a/core/delayManager/job.cpp b/core/delayManager/job.cpp index 0d4c868..b2d74b2 100644 --- a/core/delayManager/job.cpp +++ b/core/delayManager/job.cpp @@ -16,17 +16,13 @@ #include "job.h" -Core::Job::Job(Core::Job::Id p_id, Core::Job::Type p_type) : +Core::DelayManager::Job::Job(Id p_id, Type p_type) : id (p_id), type (p_type) {} -Core::Job::Job(const Core::Job& other) : +Core::DelayManager::Job::Job(const Job& other) : id(other.id), type(other.type) {} -Core::Job::~Job() {} - -Core::Job::Type Core::Job::getType() const { - return type; -} +Core::DelayManager::Job::~Job() {} diff --git a/core/delayManager/job.h b/core/delayManager/job.h index 6314f48..633f2b2 100644 --- a/core/delayManager/job.h +++ b/core/delayManager/job.h @@ -20,6 +20,7 @@ #include namespace Core { +namespace DelayManager { class Job { public: @@ -31,20 +32,18 @@ public: infoForUser, ownInfoForUser }; - +protected: Job(Id id, Type type); Job(const Job& other); + +public: virtual ~Job(); const Id id; - -public: - Type getType() const; - -protected: - Type type; + const Type type; }; +} } #endif // CORE_DELAYMANAGER_JOB_H diff --git a/core/delayManager/owncardinternal.cpp b/core/delayManager/owncardinternal.cpp index 0167516..43ed540 100644 --- a/core/delayManager/owncardinternal.cpp +++ b/core/delayManager/owncardinternal.cpp @@ -16,15 +16,15 @@ #include "owncardinternal.h" -Core::OwnCardInternal::OwnCardInternal(Job::Id p_id) : +Core::DelayManager::OwnCardInternal::OwnCardInternal(Id p_id) : Job(p_id, Type::ownCardInternal) {} -Core::OwnCardInternal::OwnCardInternal(Job::Id p_id, Job::Type p_type) : +Core::DelayManager::OwnCardInternal::OwnCardInternal(Id p_id, Type p_type) : Job(p_id, p_type) {} -Core::OwnCardInternal::OwnCardInternal(const Core::OwnCardInternal& other) : +Core::DelayManager::OwnCardInternal::OwnCardInternal(const OwnCardInternal& other) : Job(other) {} diff --git a/core/delayManager/owncardinternal.h b/core/delayManager/owncardinternal.h index 296666f..7cca0a0 100644 --- a/core/delayManager/owncardinternal.h +++ b/core/delayManager/owncardinternal.h @@ -14,22 +14,24 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef CORE_OWNCARDINTERNAL_H -#define CORE_OWNCARDINTERNAL_H +#ifndef CORE_DELAYMANAGER_OWNCARDINTERNAL_H +#define CORE_DELAYMANAGER_OWNCARDINTERNAL_H #include "job.h" namespace Core { +namespace DelayManager { class OwnCardInternal : public Job { protected: - OwnCardInternal(Job::Id id, Job::Type type); + OwnCardInternal(Id id, Type type); public: - OwnCardInternal(Job::Id id); + OwnCardInternal(Id id); OwnCardInternal(const OwnCardInternal& other); }; +} } -#endif // CORE_OWNCARDINTERNAL_H +#endif // CORE_DELAYMANAGER_OWNCARDINTERNAL_H diff --git a/core/delayManager/owninfoforuser.cpp b/core/delayManager/owninfoforuser.cpp index 12d1f72..396dc49 100644 --- a/core/delayManager/owninfoforuser.cpp +++ b/core/delayManager/owninfoforuser.cpp @@ -16,10 +16,12 @@ #include "owninfoforuser.h" -Core::OwnInfoForUser::OwnInfoForUser(Job::Id p_id) : - OwnCardInternal(p_id, Type::ownInfoForUser) +Core::DelayManager::OwnInfoForUser::OwnInfoForUser(Id p_id) : + Job(p_id, Type::ownInfoForUser), + Info(p_id, Type::ownInfoForUser) {} -Core::OwnInfoForUser::OwnInfoForUser(const Core::OwnInfoForUser& other) : - OwnCardInternal(other) +Core::DelayManager::OwnInfoForUser::OwnInfoForUser(const OwnInfoForUser& other) : + Job(other), + Info(other) {} diff --git a/core/delayManager/owninfoforuser.h b/core/delayManager/owninfoforuser.h index a2534e5..80a13b6 100644 --- a/core/delayManager/owninfoforuser.h +++ b/core/delayManager/owninfoforuser.h @@ -14,19 +14,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef CORE_OWNINFOFORUSER_H -#define CORE_OWNINFOFORUSER_H +#ifndef CORE_DELAYMANAGER_OWNINFOFORUSER_H +#define CORE_DELAYMANAGER_OWNINFOFORUSER_H -#include "owncardinternal.h" +#include "contact.h" +#include "info.h" namespace Core { +namespace DelayManager { -class OwnInfoForUser : public OwnCardInternal { +class OwnInfoForUser : public Info { public: - OwnInfoForUser(Job::Id id); + OwnInfoForUser(Id id); OwnInfoForUser(const OwnInfoForUser& other); }; +} } -#endif // CORE_OWNINFOFORUSER_H +#endif // CORE_DELAYMANAGER_OWNINFOFORUSER_H