From 1f3b133321a71fa32556fb6d9e6611967c381ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 30 Apr 2022 09:12:40 +0200 Subject: Test: device and owner identity updates after discovery --- src/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index d403d29..84dfe2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,6 +229,23 @@ void watchSharedIdentity(const vector &) }); } +void updateLocalIdentity(const vector & params) +{ + if (params.size() != 1) { + throw invalid_argument("usage: update-local-identity "); + } + + auto nh = h->update([¶ms] (const Stored & loc) { + auto st = loc.ref().storage(); + + auto b = loc->identity()->modify(); + b.name(params[0]); + return st.store(loc->identity(b.commit())); + }); + if (nh) + *h = *nh; +} + void updateSharedIdentity(const vector & params) { if (params.size() != 1) { @@ -270,6 +287,7 @@ vector commands = { { "stop-server", stopServer }, { "watch-local-identity", watchLocalIdentity }, { "watch-shared-identity", watchSharedIdentity }, + { "update-local-identity", updateLocalIdentity }, { "update-shared-identity", updateSharedIdentity }, { "attach-to", attachTo }, { "attach-accept", attachAccept }, -- cgit v1.2.3