diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 00:53:54 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 00:53:54 +0100 |
commit | 70bb707903da21103b84e0f3effcaa0a24612d5c (patch) | |
tree | 9ceac185dd2d6e3a314014563e5596b557afcb78 /common/messagequeue.cpp | |
parent | ccd61612c51d7f8a92349a2d4855efc583a35b5b (diff) | |
download | sink-70bb707903da21103b84e0f3effcaa0a24612d5c.tar.gz sink-70bb707903da21103b84e0f3effcaa0a24612d5c.zip |
Fixed messagequeue
Diffstat (limited to 'common/messagequeue.cpp')
-rw-r--r-- | common/messagequeue.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp index cf63e57..e1bde4b 100644 --- a/common/messagequeue.cpp +++ b/common/messagequeue.cpp | |||
@@ -15,12 +15,13 @@ void MessageQueue::enqueue(void const *msg, size_t size) | |||
15 | mStorage.write(key.data(), key.size(), msg, size); | 15 | mStorage.write(key.data(), key.size(), msg, size); |
16 | mStorage.setMaxRevision(revision); | 16 | mStorage.setMaxRevision(revision); |
17 | mStorage.commitTransaction(); | 17 | mStorage.commitTransaction(); |
18 | emit messageReady(); | ||
18 | } | 19 | } |
19 | 20 | ||
20 | void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> &resultHandler, | 21 | void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> &resultHandler, |
21 | const std::function<void(const Error &error)> &errorHandler) | 22 | const std::function<void(const Error &error)> &errorHandler) |
22 | { | 23 | { |
23 | mStorage.scan("", [this, resultHandler](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { | 24 | mStorage.scan("", 0, [this, resultHandler](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { |
24 | const std::string key(static_cast<char*>(keyPtr), keySize); | 25 | const std::string key(static_cast<char*>(keyPtr), keySize); |
25 | resultHandler(valuePtr, valueSize, [this, key](bool success) { | 26 | resultHandler(valuePtr, valueSize, [this, key](bool success) { |
26 | if (success) { | 27 | if (success) { |
@@ -30,7 +31,12 @@ void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::fu | |||
30 | } | 31 | } |
31 | }); | 32 | }); |
32 | return false; | 33 | return false; |
33 | }); | 34 | }, |
35 | [errorHandler](const Akonadi2::Storage::Error &error) { | ||
36 | qDebug() << "Error while retrieving value" << QString::fromStdString(error.message); | ||
37 | errorHandler(Error(error.store, error.code, error.message)); | ||
38 | } | ||
39 | ); | ||
34 | } | 40 | } |
35 | 41 | ||
36 | bool MessageQueue::isEmpty() | 42 | bool MessageQueue::isEmpty() |