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

check capabilities before addresses to compare faster

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