Client node now displays in all participants and presences, some additional checkups before querying empty clients, refactoring
This commit is contained in:
parent
76a9c5da0c
commit
21b40a9ccb
19 changed files with 407 additions and 317 deletions
|
@ -22,10 +22,125 @@ Shared::ClientId::ClientId():
|
|||
hash()
|
||||
{}
|
||||
|
||||
Shared::ClientId::ClientId(const QString& p_node, const QString& p_ver, const QString& p_hash):
|
||||
node(p_node),
|
||||
verification(p_ver),
|
||||
hash(p_hash)
|
||||
{}
|
||||
|
||||
|
||||
Shared::ClientId::ClientId(const Shared::ClientId& other):
|
||||
node(other.node),
|
||||
verification(other.verification),
|
||||
hash(other.hash)
|
||||
{}
|
||||
|
||||
Shared::ClientId & Shared::ClientId::operator=(const Shared::ClientId& other) {
|
||||
node = other.node;
|
||||
verification = other.verification;
|
||||
hash = other.hash;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator==(const Shared::ClientId& other) const {
|
||||
return hash == other.hash && verification == other.verification && node == other.node;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator!=(const Shared::ClientId& other) const {
|
||||
return hash != other.hash && verification != other.verification && node != other.node;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator<(const Shared::ClientId& other) const {
|
||||
if (hash < other.hash)
|
||||
return true;
|
||||
|
||||
if (hash > other.hash)
|
||||
return false;
|
||||
|
||||
if (verification < other.verification)
|
||||
return true;
|
||||
|
||||
if (verification > other.verification)
|
||||
return false;
|
||||
|
||||
if (node < other.node)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator>(const Shared::ClientId& other) const {
|
||||
if (hash > other.hash)
|
||||
return true;
|
||||
|
||||
if (hash < other.hash)
|
||||
return false;
|
||||
|
||||
if (verification > other.verification)
|
||||
return true;
|
||||
|
||||
if (verification < other.verification)
|
||||
return false;
|
||||
|
||||
if (node > other.node)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator<=(const Shared::ClientId& other) const {
|
||||
if (hash < other.hash)
|
||||
return true;
|
||||
|
||||
if (hash > other.hash)
|
||||
return false;
|
||||
|
||||
if (verification < other.verification)
|
||||
return true;
|
||||
|
||||
if (verification > other.verification)
|
||||
return false;
|
||||
|
||||
if (node < other.node)
|
||||
return true;
|
||||
|
||||
if (node > other.node)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::operator>=(const Shared::ClientId& other) const {
|
||||
if (hash > other.hash)
|
||||
return true;
|
||||
|
||||
if (hash < other.hash)
|
||||
return false;
|
||||
|
||||
if (verification > other.verification)
|
||||
return true;
|
||||
|
||||
if (verification < other.verification)
|
||||
return false;
|
||||
|
||||
if (node > other.node)
|
||||
return true;
|
||||
|
||||
if (node < other.node)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString Shared::ClientId::getId() const {
|
||||
return node + "/" + verification;
|
||||
}
|
||||
|
||||
bool Shared::ClientId::valid() const {
|
||||
return node.size() > 0 && verification.size() > 0 && hash.size() > 0;
|
||||
}
|
||||
|
||||
QDataStream & Shared::ClientId::operator<<(QDataStream& stream) {
|
||||
stream >> node;
|
||||
stream >> verification;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue