Commit 4b111911 authored by Benjamin REIS's avatar Benjamin REIS

check capabilities before addresses to compare faster

parent 32b56526
......@@ -199,19 +199,19 @@ shared_ptr<AbstractChatRoom> Core::findOneToOneChatRoom (
// One to one client group chat room
// The only participant's address must match the participantAddress argument
if (
(capabilities & ChatRoom::Capabilities::Conference) &&
!chatRoom->getParticipants().empty() &&
localAddress == curLocalAddress &&
! chatRoom->getParticipants().empty() &&
participantAddress.getAddressWithoutGruu() == chatRoom->getParticipants().front()->getAddress() &&
(capabilities & ChatRoom::Capabilities::Conference)
participantAddress.getAddressWithoutGruu() == chatRoom->getParticipants().front()->getAddress()
)
return chatRoom;
// One to one basic chat room (addresses without gruu)
// The peer address must match the participantAddress argument
if (
(capabilities & ChatRoom::Capabilities::Basic) &&
localAddress.getAddressWithoutGruu() == curLocalAddress.getAddressWithoutGruu() &&
participantAddress.getAddressWithoutGruu() == chatRoom->getPeerAddress().getAddressWithoutGruu() &&
(capabilities & ChatRoom::Capabilities::Basic)
participantAddress.getAddressWithoutGruu() == chatRoom->getPeerAddress().getAddressWithoutGruu()
)
return chatRoom;
}
......
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