extracted clientId from clientInfo to use it in the presence information later

This commit is contained in:
Blue 2023-03-13 22:07:10 +03:00
parent 8ec0af3205
commit 76a9c5da0c
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 137 additions and 38 deletions

View file

@ -32,20 +32,16 @@ const std::map<QString, QCryptographicHash::Algorithm> Shared::ClientInfo::hashe
Shared::ClientInfo::ClientInfo():
identities(),
extensions(),
node(),
verification(),
hash(),
id(),
specificPresence() {}
QString Shared::ClientInfo::getId() const {
return node + "/" + verification;
return id.getId();
}
QDataStream & Shared::ClientInfo::operator >> (QDataStream& stream) const {
stream << node;
stream << verification;
stream << hash;
stream << id;
stream << (quint8)identities.size();
for (const Shared::Identity& identity : identities) {
stream << identity;
@ -59,9 +55,7 @@ QDataStream & Shared::ClientInfo::operator >> (QDataStream& stream) const {
}
QDataStream & Shared::ClientInfo::operator << (QDataStream& stream) {
stream >> node;
stream >> verification;
stream >> hash;
stream >> id;
quint8 size;
stream >> size;
@ -82,7 +76,7 @@ QDataStream & Shared::ClientInfo::operator << (QDataStream& stream) {
}
bool Shared::ClientInfo::valid() const {
std::map<QString, QCryptographicHash::Algorithm>::const_iterator itr = hashes.find(hash);
std::map<QString, QCryptographicHash::Algorithm>::const_iterator itr = hashes.find(id.hash);
if (itr == hashes.end()) {
return false;
}
@ -98,7 +92,7 @@ bool Shared::ClientInfo::valid() const {
QString result = calc.result().toBase64();
return result == verification;
return result == id.verification;
}
QDataStream& operator << (QDataStream& stream, const Shared::ClientInfo& info) {