summaryrefslogtreecommitdiffstats
path: root/common/listener.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-07-30 13:43:31 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-07-30 13:43:31 +0200
commit01adeefb24bf72f1015e93aa5f075f93f56d94da (patch)
treeee6d204a47f246688202b4a3a9eb0db23b462f7f /common/listener.cpp
parent07572b25af45c41a82eb8ddfdecf18e58958788b (diff)
downloadsink-01adeefb24bf72f1015e93aa5f075f93f56d94da.tar.gz
sink-01adeefb24bf72f1015e93aa5f075f93f56d94da.zip
Made the pipeline an implementation detail of the resource.
This removes one dependency from the Listener and will allow us to test the Listener better.
Diffstat (limited to 'common/listener.cpp')
-rw-r--r--common/listener.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/common/listener.cpp b/common/listener.cpp
index 2e2e98e..8ec9b3e 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -41,7 +41,6 @@ Listener::Listener(const QByteArray &resourceInstanceIdentifier, QObject *parent
41 m_resourceName(Akonadi2::Store::resourceName(resourceInstanceIdentifier)), 41 m_resourceName(Akonadi2::Store::resourceName(resourceInstanceIdentifier)),
42 m_resourceInstanceIdentifier(resourceInstanceIdentifier), 42 m_resourceInstanceIdentifier(resourceInstanceIdentifier),
43 m_resource(0), 43 m_resource(0),
44 m_pipeline(new Akonadi2::Pipeline(resourceInstanceIdentifier, parent)),
45 m_clientBufferProcessesTimer(new QTimer(this)), 44 m_clientBufferProcessesTimer(new QTimer(this)),
46 m_messageId(0) 45 m_messageId(0)
47{ 46{
@@ -226,7 +225,7 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
226 } 225 }
227 auto job = KAsync::null<void>(); 226 auto job = KAsync::null<void>();
228 if (buffer->sourceSync()) { 227 if (buffer->sourceSync()) {
229 job = m_resource->synchronizeWithSource(m_pipeline); 228 job = m_resource->synchronizeWithSource();
230 } 229 }
231 if (buffer->localSync()) { 230 if (buffer->localSync()) {
232 job = job.then<void>(m_resource->processAllMessages()); 231 job = job.then<void>(m_resource->processAllMessages());
@@ -247,7 +246,7 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
247 Log() << "\tCommand id " << messageId << " of type \"" << Akonadi2::Commands::name(commandId) << "\" from " << client.name; 246 Log() << "\tCommand id " << messageId << " of type \"" << Akonadi2::Commands::name(commandId) << "\" from " << client.name;
248 loadResource(); 247 loadResource();
249 if (m_resource) { 248 if (m_resource) {
250 m_resource->processCommand(commandId, commandBuffer, m_pipeline); 249 m_resource->processCommand(commandId, commandBuffer);
251 } 250 }
252 break; 251 break;
253 case Akonadi2::Commands::ShutdownCommand: 252 case Akonadi2::Commands::ShutdownCommand:
@@ -261,7 +260,7 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
261 Log() << QString("\tReceived custom command from %1: ").arg(client.name) << commandId; 260 Log() << QString("\tReceived custom command from %1: ").arg(client.name) << commandId;
262 loadResource(); 261 loadResource();
263 if (m_resource) { 262 if (m_resource) {
264 m_resource->processCommand(commandId, commandBuffer, m_pipeline); 263 m_resource->processCommand(commandId, commandBuffer);
265 } 264 }
266 } else { 265 } else {
267 Warning() << QString("\tReceived invalid command from %1: ").arg(client.name) << commandId; 266 Warning() << QString("\tReceived invalid command from %1: ").arg(client.name) << commandId;
@@ -367,7 +366,6 @@ void Listener::loadResource()
367 m_resource = resourceFactory->createResource(m_resourceInstanceIdentifier); 366 m_resource = resourceFactory->createResource(m_resourceInstanceIdentifier);
368 Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); 367 Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory);
369 Log() << QString("\tResource: %1").arg((qlonglong)m_resource); 368 Log() << QString("\tResource: %1").arg((qlonglong)m_resource);
370 m_resource->configurePipeline(m_pipeline);
371 connect(m_resource, &Akonadi2::Resource::revisionUpdated, 369 connect(m_resource, &Akonadi2::Resource::revisionUpdated,
372 this, &Listener::refreshRevision); 370 this, &Listener::refreshRevision);
373 } else { 371 } else {