From a3d6c2899bda6e00c731b5fe8931aa4696837621 Mon Sep 17 00:00:00 2001 From: semenov Date: Mon, 16 Feb 2026 09:35:38 +0300 Subject: [PATCH] feat: cfi package update --- LibServer/Data/PacketType.h | 3 +-- LibServer/Systems/commonclienthandler.cpp | 2 +- LibServer/Systems/commonclienthandler.h | 2 +- LibServer/Systems/processingsystem.cpp | 9 ++++++++- LibServer/Systems/recognizesystem.cpp | 7 +------ LibServer/Systems/sendsystem.cpp | 5 +++++ LibServer/Systems/sendsystem.h | 1 + LibServer/Systems/tools.h | 1 + LibServer/Systems/updatecontroller.cpp | 2 ++ 9 files changed, 21 insertions(+), 11 deletions(-) diff --git a/LibServer/Data/PacketType.h b/LibServer/Data/PacketType.h index a7ba524..3eed372 100644 --- a/LibServer/Data/PacketType.h +++ b/LibServer/Data/PacketType.h @@ -22,7 +22,6 @@ enum PacketType TYPE_FILESIZE = 20, TYPE_BIGXML = 21, UPDATE_DOCS_COMPLETE = 22, - TYPE_CFIUPDATE = 23, TYPE_UPDATEDCFI = 24, TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90, @@ -108,7 +107,7 @@ inline QString enumToString(PacketType value) { case PacketType::RECALCULATE_DOCS: return "RECALCULATE_DOCS"; case PacketType::GET_DOCS: return "GET_DOCS"; case PacketType::SEND_HASH: return "SEND_HASH"; - case PacketType::TYPE_CFIUPDATE: return "CFI_UPDATE"; + case PacketType::TYPE_UPDATEDCFI: return "UPDATED_CFI"; default: return "Unknown"; diff --git a/LibServer/Systems/commonclienthandler.cpp b/LibServer/Systems/commonclienthandler.cpp index 3b30420..d6820cb 100644 --- a/LibServer/Systems/commonclienthandler.cpp +++ b/LibServer/Systems/commonclienthandler.cpp @@ -249,7 +249,7 @@ void CommonClientHandler::slot_DocsChanged() } } -void CommonClientHandler::sendXmlAnswer(QByteArray array) +void CommonClientHandler::sendUpdatedCFI(QByteArray array) { foreach(int idSocket, clientsMap->keys()) { diff --git a/LibServer/Systems/commonclienthandler.h b/LibServer/Systems/commonclienthandler.h index 08321da..1d7cab8 100644 --- a/LibServer/Systems/commonclienthandler.h +++ b/LibServer/Systems/commonclienthandler.h @@ -32,7 +32,7 @@ public: void slot_DocsChanged(); - void sendXmlAnswer(QByteArray array); + void sendUpdatedCFI(QByteArray array); public slots: void slot_sendPacketToAllClients(PacketType packetType, bool flOnlyGUI); diff --git a/LibServer/Systems/processingsystem.cpp b/LibServer/Systems/processingsystem.cpp index a49f8cf..7e6f7ad 100644 --- a/LibServer/Systems/processingsystem.cpp +++ b/LibServer/Systems/processingsystem.cpp @@ -266,7 +266,7 @@ void ProcessingSystem::processingCFIUpdate(QByteArray array) cfiController->unLockAccessToCfiXML(); - commonClientServer->sendXmlAnswer(result); + commonClientServer->sendUpdatedCFI(result); } void ProcessingSystem::processingEntryUnityClient(ClientHandler *client) @@ -735,6 +735,13 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif { chatSystem->sendOldMessages(clientData->getId()); } + else if (clientNotify.Code == commandGetCFI) + { + QByteArray result; + QString path = updateController->getPathAdditionalFile(cfiListFileName); + Tools::loadFileXMLtoByteArray(path,result); + client->sendXmlAnswer(result,PacketType::TYPE_UPDATEDCFI); + } } void ProcessingSystem::setCurrentDataInfo(DataInfo *dataInfo) diff --git a/LibServer/Systems/recognizesystem.cpp b/LibServer/Systems/recognizesystem.cpp index 2f1ee30..760b500 100644 --- a/LibServer/Systems/recognizesystem.cpp +++ b/LibServer/Systems/recognizesystem.cpp @@ -29,7 +29,7 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser* connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection); connect(this,&RecognizeSystem::sigXmlParser,dataParser->getProcessParser(),&ProcessParser::slot_read,Qt::AutoConnection); //connect(this,&RecognizeSystem::sigRecalculateDocs,server,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection); - connect(this,&RecognizeSystem::sigSendDocs,sendSystem,&SendSystem::sendDocs,Qt::AutoConnection); + connect(this,&RecognizeSystem::sigSendDocs,sendSystem,&SendSystem::sendDocs,Qt::AutoConnection); } void RecognizeSystem::recognize() @@ -509,11 +509,6 @@ void RecognizeSystem::recognize() packetType = PacketType::TYPE_NONE; client->setClientHash(hash); } - - if(packetType == PacketType::TYPE_CFIUPDATE) - { - qDebug() << "CFI HELLO"; - } packetType = PacketType::TYPE_NONE; } diff --git a/LibServer/Systems/sendsystem.cpp b/LibServer/Systems/sendsystem.cpp index 86027d9..03611f1 100644 --- a/LibServer/Systems/sendsystem.cpp +++ b/LibServer/Systems/sendsystem.cpp @@ -323,6 +323,11 @@ void SendSystem::sendStop() isSendStopped = true; } +void SendSystem::sendCFI(QByteArray array) +{ + sendXmlAnswer(array,PacketType::TYPE_UPDATEDCFI); +} + void SendSystem::sendDocs(QString docsPath) { sendFileBlock(docsPath); diff --git a/LibServer/Systems/sendsystem.h b/LibServer/Systems/sendsystem.h index 30d79e5..7dd3066 100644 --- a/LibServer/Systems/sendsystem.h +++ b/LibServer/Systems/sendsystem.h @@ -31,6 +31,7 @@ public: void sendPacketType(PacketType packet); void sendNotify(QString notify); void sendStop(); + void sendCFI(QByteArray array); void sendDocs(QString docPath); void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER); void sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount); diff --git a/LibServer/Systems/tools.h b/LibServer/Systems/tools.h index faf611b..2cbd5d6 100644 --- a/LibServer/Systems/tools.h +++ b/LibServer/Systems/tools.h @@ -55,6 +55,7 @@ static const QString commandUnchangable = "UNCHANGEABLE"; static const QString commandUpdateFilesClient = "update"; static const QString commandGetTasks = "GETTASKS"; static const QString commandeGetOfflineMessages = "GETOFFLINEMESSAGE"; +static const QString commandGetCFI = "GETCFI"; //static quint64 fileBlockSize = 1460; static quint64 sendFileBlockSize = 256000; diff --git a/LibServer/Systems/updatecontroller.cpp b/LibServer/Systems/updatecontroller.cpp index f5d88a6..1f34f20 100644 --- a/LibServer/Systems/updatecontroller.cpp +++ b/LibServer/Systems/updatecontroller.cpp @@ -280,6 +280,7 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler) { if(item.path.contains("Temp")) continue; if(item.path.contains("docs.xml")) continue; + if(item.path.contains("CfiList.xml")) continue; if (!serverDataList.contains(item)) { @@ -291,6 +292,7 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler) { if(item.path.contains("Temp")) continue; if(item.path.contains("docs.xml")) continue; + if(item.path.contains("CfiList.xml")) continue; if (!clientDataList.contains(item)) {