summaryrefslogtreecommitdiffstats
path: root/common/listener.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-24 22:15:18 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-24 22:15:18 +0100
commit9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a (patch)
tree41fef7daac9e5ae64d61452a3f38c82243d29fdd /common/listener.cpp
parent84d70933c0cd0987d5fee5a78f413fec82bb1288 (diff)
downloadsink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.tar.gz
sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.zip
Implemented notification support in the model.
This will allow us to fold things like progress and sync status directly into the model. Usecases are mail download progress and folder sync progress. Ideally we would also solve the resource/account state through this.
Diffstat (limited to 'common/listener.cpp')
-rw-r--r--common/listener.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/listener.cpp b/common/listener.cpp
index f18fe1d..96806ad 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -25,6 +25,7 @@
25#include "common/definitions.h" 25#include "common/definitions.h"
26#include "common/resourcecontext.h" 26#include "common/resourcecontext.h"
27#include "common/adaptorfactoryregistry.h" 27#include "common/adaptorfactoryregistry.h"
28#include "common/bufferutils.h"
28 29
29// commands 30// commands
30#include "common/commandcompletion_generated.h" 31#include "common/commandcompletion_generated.h"
@@ -406,11 +407,13 @@ void Listener::notify(const Sink::Notification &notification)
406{ 407{
407 auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size()); 408 auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size());
408 auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size()); 409 auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size());
410 auto entities = Sink::BufferUtils::toVector(m_fbb, notification.entities);
409 Sink::Commands::NotificationBuilder builder(m_fbb); 411 Sink::Commands::NotificationBuilder builder(m_fbb);
410 builder.add_type(notification.type); 412 builder.add_type(notification.type);
411 builder.add_code(notification.code); 413 builder.add_code(notification.code);
412 builder.add_identifier(idString); 414 builder.add_identifier(idString);
413 builder.add_message(messageString); 415 builder.add_message(messageString);
416 builder.add_entities(entities);
414 auto command = builder.Finish(); 417 auto command = builder.Finish();
415 Sink::Commands::FinishNotificationBuffer(m_fbb, command); 418 Sink::Commands::FinishNotificationBuffer(m_fbb, command);
416 for (Client &client : m_connections) { 419 for (Client &client : m_connections) {