diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-19 14:26:45 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-19 14:26:45 +0100 |
commit | cd7287325944571e9d53b00b48abdba4c9257474 (patch) | |
tree | fe6f822597e17c3a6f7d06fb512fcda36e490f21 /common/listener.cpp | |
parent | 1812c077d6461b3e9fb865f47cffafc3c179e136 (diff) | |
download | sink-cd7287325944571e9d53b00b48abdba4c9257474.tar.gz sink-cd7287325944571e9d53b00b48abdba4c9257474.zip |
Moved all commands in to the Commands namespace
Diffstat (limited to 'common/listener.cpp')
-rw-r--r-- | common/listener.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/common/listener.cpp b/common/listener.cpp index bb0a130..857e15f 100644 --- a/common/listener.cpp +++ b/common/listener.cpp | |||
@@ -211,8 +211,8 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c | |||
211 | switch (commandId) { | 211 | switch (commandId) { |
212 | case Akonadi2::Commands::HandshakeCommand: { | 212 | case Akonadi2::Commands::HandshakeCommand: { |
213 | flatbuffers::Verifier verifier((const uint8_t *)commandBuffer.constData(), commandBuffer.size()); | 213 | flatbuffers::Verifier verifier((const uint8_t *)commandBuffer.constData(), commandBuffer.size()); |
214 | if (Akonadi2::VerifyHandshakeBuffer(verifier)) { | 214 | if (Akonadi2::Commands::VerifyHandshakeBuffer(verifier)) { |
215 | auto buffer = Akonadi2::GetHandshake(commandBuffer.constData()); | 215 | auto buffer = Akonadi2::Commands::GetHandshake(commandBuffer.constData()); |
216 | client.name = buffer->name()->c_str(); | 216 | client.name = buffer->name()->c_str(); |
217 | } else { | 217 | } else { |
218 | Warning() << "received invalid command"; | 218 | Warning() << "received invalid command"; |
@@ -221,8 +221,8 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c | |||
221 | } | 221 | } |
222 | case Akonadi2::Commands::SynchronizeCommand: { | 222 | case Akonadi2::Commands::SynchronizeCommand: { |
223 | flatbuffers::Verifier verifier((const uint8_t *)commandBuffer.constData(), commandBuffer.size()); | 223 | flatbuffers::Verifier verifier((const uint8_t *)commandBuffer.constData(), commandBuffer.size()); |
224 | if (Akonadi2::VerifySynchronizeBuffer(verifier)) { | 224 | if (Akonadi2::Commands::VerifySynchronizeBuffer(verifier)) { |
225 | auto buffer = Akonadi2::GetSynchronize(commandBuffer.constData()); | 225 | auto buffer = Akonadi2::Commands::GetSynchronize(commandBuffer.constData()); |
226 | Log() << QString("\tSynchronize request (id %1) from %2").arg(messageId).arg(client.name); | 226 | Log() << QString("\tSynchronize request (id %1) from %2").arg(messageId).arg(client.name); |
227 | auto timer = QSharedPointer<QTime>::create(); | 227 | auto timer = QSharedPointer<QTime>::create(); |
228 | timer->start(); | 228 | timer->start(); |
@@ -303,8 +303,8 @@ qint64 Listener::lowerBoundRevision() | |||
303 | void Listener::quit() | 303 | void Listener::quit() |
304 | { | 304 | { |
305 | //Broadcast shutdown notifications to open clients, so they don't try to restart the resource | 305 | //Broadcast shutdown notifications to open clients, so they don't try to restart the resource |
306 | auto command = Akonadi2::CreateNotification(m_fbb, Akonadi2::NotificationType::NotificationType_Shutdown); | 306 | auto command = Akonadi2::Commands::CreateNotification(m_fbb, Akonadi2::Commands::NotificationType::NotificationType_Shutdown); |
307 | Akonadi2::FinishNotificationBuffer(m_fbb, command); | 307 | Akonadi2::Commands::FinishNotificationBuffer(m_fbb, command); |
308 | for (Client &client : m_connections) { | 308 | for (Client &client : m_connections) { |
309 | if (client.socket && client.socket->isOpen()) { | 309 | if (client.socket && client.socket->isOpen()) { |
310 | Akonadi2::Commands::write(client.socket, ++m_messageId, Akonadi2::Commands::NotificationCommand, m_fbb); | 310 | Akonadi2::Commands::write(client.socket, ++m_messageId, Akonadi2::Commands::NotificationCommand, m_fbb); |
@@ -359,9 +359,9 @@ void Listener::sendCommandCompleted(QLocalSocket *socket, uint messageId, bool s | |||
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | 361 | ||
362 | auto command = Akonadi2::CreateCommandCompletion(m_fbb, messageId, success); | 362 | auto command = Akonadi2::Commands::CreateCommandCompletion(m_fbb, messageId, success); |
363 | Akonadi2::FinishCommandCompletionBuffer(m_fbb, command); | 363 | Akonadi2::Commands::FinishCommandCompletionBuffer(m_fbb, command); |
364 | Akonadi2::Commands::write(socket, ++m_messageId, Akonadi2::Commands::CommandCompletion, m_fbb); | 364 | Akonadi2::Commands::write(socket, ++m_messageId, Akonadi2::Commands::CommandCompletionCommand, m_fbb); |
365 | m_fbb.Clear(); | 365 | m_fbb.Clear(); |
366 | } | 366 | } |
367 | 367 | ||
@@ -372,8 +372,8 @@ void Listener::refreshRevision(qint64 revision) | |||
372 | 372 | ||
373 | void Listener::updateClientsWithRevision(qint64 revision) | 373 | void Listener::updateClientsWithRevision(qint64 revision) |
374 | { | 374 | { |
375 | auto command = Akonadi2::CreateRevisionUpdate(m_fbb, revision); | 375 | auto command = Akonadi2::Commands::CreateRevisionUpdate(m_fbb, revision); |
376 | Akonadi2::FinishRevisionUpdateBuffer(m_fbb, command); | 376 | Akonadi2::Commands::FinishRevisionUpdateBuffer(m_fbb, command); |
377 | 377 | ||
378 | for (const Client &client: m_connections) { | 378 | for (const Client &client: m_connections) { |
379 | if (!client.socket || !client.socket->isValid()) { | 379 | if (!client.socket || !client.socket->isValid()) { |
@@ -390,13 +390,13 @@ void Listener::notify(const Akonadi2::ResourceNotification ¬ification) | |||
390 | { | 390 | { |
391 | auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size()); | 391 | auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size()); |
392 | auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size()); | 392 | auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size()); |
393 | Akonadi2::NotificationBuilder builder(m_fbb); | 393 | Akonadi2::Commands::NotificationBuilder builder(m_fbb); |
394 | builder.add_type(static_cast<Akonadi2::NotificationType>(notification.type)); | 394 | builder.add_type(static_cast<Akonadi2::Commands::NotificationType>(notification.type)); |
395 | builder.add_code(notification.code); | 395 | builder.add_code(notification.code); |
396 | builder.add_identifier(idString); | 396 | builder.add_identifier(idString); |
397 | builder.add_message(messageString); | 397 | builder.add_message(messageString); |
398 | auto command = builder.Finish(); | 398 | auto command = builder.Finish(); |
399 | Akonadi2::FinishNotificationBuffer(m_fbb, command); | 399 | Akonadi2::Commands::FinishNotificationBuffer(m_fbb, command); |
400 | for (Client &client : m_connections) { | 400 | for (Client &client : m_connections) { |
401 | if (client.socket && client.socket->isOpen()) { | 401 | if (client.socket && client.socket->isOpen()) { |
402 | Akonadi2::Commands::write(client.socket, ++m_messageId, Akonadi2::Commands::NotificationCommand, m_fbb); | 402 | Akonadi2::Commands::write(client.socket, ++m_messageId, Akonadi2::Commands::NotificationCommand, m_fbb); |