summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/attach.cpp9
-rw-r--r--src/identity.cpp2
-rw-r--r--src/main.cpp8
-rw-r--r--src/state.cpp4
4 files changed, 13 insertions, 10 deletions
diff --git a/src/attach.cpp b/src/attach.cpp
index 74bc875..3d351f8 100644
--- a/src/attach.cpp
+++ b/src/attach.cpp
@@ -34,14 +34,13 @@ void AttachService::attachTo(const Peer & peer)
Stored<AttachIdentity> AttachService::handlePairingComplete(const Peer & peer)
{
auto owner = peer.server().identity().finalOwner();
- auto id = peer.identity()->ref();
- auto prev = Stored<Signed<IdentityData>>::load(*peer.identity()->ref());
+ auto pid = peer.identity();
auto idata = peer.tempStorage().store(IdentityData {
- .prev = { prev },
+ .prev = pid->data(),
.name = nullopt,
- .owner = Stored<Signed<IdentityData>>::load(*owner.ref()),
- .keyIdentity = prev->data->keyIdentity,
+ .owner = owner.data()[0],
+ .keyIdentity = pid->keyIdentity(),
.keyMessage = nullopt,
});
diff --git a/src/identity.cpp b/src/identity.cpp
index f2912c5..ae20b3b 100644
--- a/src/identity.cpp
+++ b/src/identity.cpp
@@ -145,7 +145,7 @@ bool Identity::operator!=(const Identity & other) const
optional<Ref> Identity::ref() const
{
if (p->data.size() == 1)
- return p->data[0].ref();
+ return p->data[0].base().ref();
return nullopt;
}
diff --git a/src/main.cpp b/src/main.cpp
index b39130a..0eb379b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -417,8 +417,12 @@ void watchLocalIdentity(const vector<string> &)
if (idt) {
ostringstream ss;
ss << "local-identity";
- for (optional<Identity> i = idt; i; i = i->owner())
- ss << " " << i->name().value();
+ for (optional<Identity> i = idt; i; i = i->owner()) {
+ if (auto name = i->name())
+ ss << " " << i->name().value();
+ else
+ ss << " <unnamed>";
+ }
printLine(ss.str());
}
});
diff --git a/src/state.cpp b/src/state.cpp
index 8e5dcad..40d4eec 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -25,9 +25,9 @@ LocalState::LocalState(const Ref & ref):
p->shared.tip = rec->items("shared").as<SharedData>();
if (p->identity) {
- vector<Stored<Signed<IdentityData>>> updates;
+ vector<StoredIdentityPart> updates;
for (const auto & r : lookupShared(SharedType<optional<Identity>>::id))
- updates.push_back(Stored<Signed<IdentityData>>::load(r));
+ updates.push_back(StoredIdentityPart::load(r));
if (!updates.empty())
p->identity = p->identity->update(updates);
}