summaryrefslogtreecommitdiffstats
path: root/src/client/ClientStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/ClientStore.cpp')
-rw-r--r--src/client/ClientStore.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index e5fbab6a..cf05e599 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -48,6 +48,7 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
emitter->signal_object_deleted.connect(sigc::mem_fun(this, &ClientStore::del));
emitter->signal_object_moved.connect(sigc::mem_fun(this, &ClientStore::move));
emitter->signal_put.connect(sigc::mem_fun(this, &ClientStore::put));
+ emitter->signal_delta.connect(sigc::mem_fun(this, &ClientStore::delta));
emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect));
emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnect));
emitter->signal_property_change.connect(sigc::mem_fun(this, &ClientStore::set_property));
@@ -338,6 +339,28 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
void
+ClientStore::delta(const URI& uri, const Resource::Properties& remove, const Resource::Properties& add)
+{
+ bool is_meta = ResourceImpl::is_meta_uri(uri);
+ string path_str = is_meta ? (string("/") + uri.chop_start("#")) : uri.str();
+ if (!Path::is_valid(path_str)) {
+ LOG(error) << "Bad path: " << uri.str() << " - " << path_str << endl;
+ return;
+ }
+
+ Path path(is_meta ? (string("/") + uri.chop_start("#")) : uri.str());
+
+ SharedPtr<ObjectModel> obj = object(path);
+ if (obj) {
+ obj->remove_properties(remove);
+ obj->add_properties(add);
+ } else {
+ LOG(warn) << "Failed to find object `" << path << "'" << endl;
+ }
+}
+
+
+void
ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value)
{
SharedPtr<Resource> subject = resource(subject_uri);