Skip to content
Snippets Groups Projects
Commit 1c68d4f9 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversation: move sendProfile

The problem with the previous method is that it was only sent one
side at the clone. At least, here we know that  both sides are connected
and in the same conversation.

Change-Id: I37bd5f921ad798a259c3262060e1158e58394697
parent e6b5217f
No related branches found
No related tags found
No related merge requests found
......@@ -1372,7 +1372,6 @@ Conversation::sync(const std::string& member,
start = 0;
sthis->downloadFile(wr.interactionId, wr.fileId, wr.path, member, deviceId, start);
}
account->sendProfile(sthis->id(), member, deviceId);
}
});
}
......@@ -1954,7 +1953,22 @@ Conversation::onNeedSocket(NeedSocketCb needSocket)
void
Conversation::addSwarmChannel(std::shared_ptr<dhtnet::ChannelSocket> channel)
{
auto deviceId = channel->deviceId();
// Transmit avatar if necessary
// We do this here, because at this point we know both sides are connected and in
// the same conversation
// addSwarmChannel is a bit more complex, but it should be the best moment to do this.
auto cert = channel->peerCertificate();
if (!cert || !cert->issuer)
return;
auto member = cert->issuer->getId().toString();
pimpl_->swarmManager_->addChannel(std::move(channel));
dht::ThreadPool::io().run([member, deviceId, a = pimpl_->account_, w=weak_from_this()]{
auto sthis = w.lock();
if (auto account = a.lock()) {
account->sendProfile(sthis->id(), member, deviceId.toString());
}
});
}
uint32_t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment