diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/commands.h | 1 | ||||
-rw-r--r-- | common/commands/notification.fbs | 9 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 14 |
3 files changed, 24 insertions, 0 deletions
diff --git a/common/commands.h b/common/commands.h index 26729dc..0007ffc 100644 --- a/common/commands.h +++ b/common/commands.h | |||
@@ -43,6 +43,7 @@ enum CommandIds { | |||
43 | CreateEntityCommand, | 43 | CreateEntityCommand, |
44 | SearchSourceCommand, // need a buffer definition for this, but relies on Query API | 44 | SearchSourceCommand, // need a buffer definition for this, but relies on Query API |
45 | ShutdownCommand, | 45 | ShutdownCommand, |
46 | NotificationCommand, | ||
46 | CustomCommand = 0xffff | 47 | CustomCommand = 0xffff |
47 | }; | 48 | }; |
48 | 49 | ||
diff --git a/common/commands/notification.fbs b/common/commands/notification.fbs new file mode 100644 index 0000000..6684472 --- /dev/null +++ b/common/commands/notification.fbs | |||
@@ -0,0 +1,9 @@ | |||
1 | namespace Akonadi2; | ||
2 | |||
3 | enum NotificationType : byte { Shutdown = 1, Status, Warning, Progress } | ||
4 | |||
5 | table Notification { | ||
6 | type: NotificationType = Status; | ||
7 | } | ||
8 | |||
9 | root_type Notification; | ||
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 59cbece..20e1e8c 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "common/handshake_generated.h" | 25 | #include "common/handshake_generated.h" |
26 | #include "common/revisionupdate_generated.h" | 26 | #include "common/revisionupdate_generated.h" |
27 | #include "common/synchronize_generated.h" | 27 | #include "common/synchronize_generated.h" |
28 | #include "common/notification_generated.h" | ||
28 | #include "log.h" | 29 | #include "log.h" |
29 | 30 | ||
30 | #include <QCoreApplication> | 31 | #include <QCoreApplication> |
@@ -325,6 +326,19 @@ bool ResourceAccess::processMessageBuffer() | |||
325 | QMetaObject::invokeMethod(this, "callCallbacks", Qt::QueuedConnection, QGenericReturnArgument(), Q_ARG(int, buffer->id())); | 326 | QMetaObject::invokeMethod(this, "callCallbacks", Qt::QueuedConnection, QGenericReturnArgument(), Q_ARG(int, buffer->id())); |
326 | break; | 327 | break; |
327 | } | 328 | } |
329 | case Commands::NotificationCommand: { | ||
330 | auto buffer = GetNotification(d->partialMessageBuffer.constData() + headerSize); | ||
331 | switch (buffer->type()) { | ||
332 | case Akonadi2::NotificationType::NotificationType_Shutdown: | ||
333 | Log() << "Received shutdown notification."; | ||
334 | close(); | ||
335 | break; | ||
336 | default: | ||
337 | Warning() << "Received unknown notification: " << buffer->type(); | ||
338 | break; | ||
339 | } | ||
340 | break; | ||
341 | } | ||
328 | default: | 342 | default: |
329 | break; | 343 | break; |
330 | } | 344 | } |