Commit afb3922d authored by Matthieu Tanon's avatar Matthieu Tanon
Browse files

Improve chatroom SecurityLevel logs

parent bdf6f37b
......@@ -331,27 +331,23 @@ ChatRoom::SecurityLevel ClientGroupChatRoom::getSecurityLevel () const {
auto level = participant->getSecurityLevel();
switch (level) {
case AbstractChatRoom::SecurityLevel::Unsafe:
lInfo() << "Participant " << participant->getAddress().asString() << " SecurityLevel = Unsafe";
lInfo() << "ChatRoom SecurityLevel = Unsafe";
lInfo() << "Chatroom SecurityLevel = Unsafe";
return level; // if one device is Unsafe the whole participant is Unsafe (red)
case AbstractChatRoom::SecurityLevel::ClearText:
lInfo() << "Participant " << participant->getAddress().asString() << " SecurityLevel = ClearText";
lInfo() << "ChatRoom SecurityLevel = ClearText";
lInfo() << "Chatroom SecurityLevel = ClearText";
return level; // TODO if all devices are in ClearText the whole participant is in ClearText (grey)
case AbstractChatRoom::SecurityLevel::Encrypted:
lInfo() << "Participant " << participant->getAddress().asString() << " SecurityLevel = Encrypted";
isSafe = false; // if one device is Encrypted the whole participant is Encrypted (orange)
break;
case AbstractChatRoom::SecurityLevel::Safe:
lInfo() << "Participant " << participant->getAddress().asString() << " SecurityLevel = Safe";
break; // if all devices are Safe the whole participant is Safe (green)
}
}
if (isSafe) {
lInfo() << "ChatRoom SecurityLevel = Safe";
lInfo() << "Chatroom SecurityLevel = Safe";
return AbstractChatRoom::SecurityLevel::Safe;
} else {
lInfo() << "ChatRoom SecurityLevel = Encrypted";
lInfo() << "Chatroom SecurityLevel = Encrypted";
return AbstractChatRoom::SecurityLevel::Encrypted;
}
}
......
......@@ -378,20 +378,25 @@ EncryptionEngineListener::EngineType LimeV2::getEngineType () {
}
AbstractChatRoom::SecurityLevel LimeV2::getSecurityLevel (string deviceId) const {
lInfo() << "Asking LIMEv2 for " << deviceId << " PeerDeviceStatus";
stringstream log;
log << "LIMEv2 " << deviceId << " PeerDeviceStatus = ";
lime::PeerDeviceStatus status = belleSipLimeManager->get_peerDeviceStatus(deviceId);
switch (status) {
case lime::PeerDeviceStatus::unknown:
lInfo() << "PeerDeviceStatus = unknown (SecurityLevel = Encrypted)";
log << "unknown (SecurityLevel = Encrypted)";
lInfo() << log.str();
return AbstractChatRoom::SecurityLevel::Encrypted;
case lime::PeerDeviceStatus::untrusted:
lInfo() << "PeerDeviceStatus = untrusted (SecurityLevel = Encrypted)";
log << "untrusted (SecurityLevel = Encrypted)";
lInfo() << log.str();
return AbstractChatRoom::SecurityLevel::Encrypted;
case lime::PeerDeviceStatus::trusted:
lInfo() << "PeerDeviceStatus = trusted (SecurityLevel = Safe)";
log << "trusted (SecurityLevel = Safe)";
lInfo() << log.str();
return AbstractChatRoom::SecurityLevel::Safe;
default:
lInfo() << "PeerDeviceStatus = failed or undefined (SecurityLevel = Unsafe)";
log << "failed or undefined (SecurityLevel = Unsafe)";
lInfo() << log.str();
BCTBX_SLOGD << "LIMEv2 unexpected peer device status for " << deviceId;
return AbstractChatRoom::SecurityLevel::Unsafe;
}
......
......@@ -111,17 +111,13 @@ AbstractChatRoom::SecurityLevel Participant::getSecurityLevel () const {
auto level = device->getSecurityLevel();
switch (level) {
case AbstractChatRoom::SecurityLevel::Unsafe:
lInfo() << "Device " << device->getAddress().asString() << " SecurityLevel = Unsafe";
return level; // if one device is Unsafe the whole participant is Unsafe (red)
case AbstractChatRoom::SecurityLevel::ClearText:
lInfo() << "Device " << device->getAddress().asString() << " SecurityLevel = ClearText";
return level; // TODO if all devices are in ClearText the whole participant is in ClearText (grey)
case AbstractChatRoom::SecurityLevel::Encrypted:
lInfo() << "Device " << device->getAddress().asString() << " SecurityLevel = Encrypted";
isSafe = false; // if one device is Encrypted the whole participant is Encrypted (orange)
break;
case AbstractChatRoom::SecurityLevel::Safe:
lInfo() << "Device " << device->getAddress().asString() << " SecurityLevel = Safe";
break; // if all devices are Safe the whole participant is Safe (green)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment