mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
feat(MainDb): add a security to delete basic chat room on migration when peer sip address is a server sip address chat room
This commit is contained in:
parent
1024c1942b
commit
b9b2ca6311
1 changed files with 17 additions and 2 deletions
|
|
@ -89,8 +89,10 @@ public:
|
|||
} catch (const soci::soci_error &e) {
|
||||
lWarning() << "Catched exception in MainDb::" << info.name << ".";
|
||||
soci::soci_error::error_category category = e.get_error_category();
|
||||
if ((category == soci::soci_error::connection_error
|
||||
|| category == soci::soci_error::unknown) && info.mainDb->forceReconnect()) {
|
||||
if (
|
||||
(category == soci::soci_error::connection_error || category == soci::soci_error::unknown) &&
|
||||
info.mainDb->forceReconnect()
|
||||
) {
|
||||
mResult = mFunction();
|
||||
return;
|
||||
}
|
||||
|
|
@ -2528,6 +2530,19 @@ void MainDb::migrateBasicToClientGroupChatRoom (
|
|||
const long long &localSipAddressId = d->insertSipAddress(newChatRoomId.getLocalAddress().asString());
|
||||
const int &capabilities = clientGroupChatRoom->getCapabilities();
|
||||
|
||||
{
|
||||
shared_ptr<AbstractChatRoom> buggyChatRoom = getCore()->findChatRoom(newChatRoomId);
|
||||
if (buggyChatRoom) {
|
||||
lError() << "Chat room was found with the same chat room id of a new migrated ClientGroupChatRoom!!!";
|
||||
AbstractChatRoom::CapabilitiesMask capabilities = buggyChatRoom->getCapabilities();
|
||||
if (capabilities & AbstractChatRoom::Capabilities::Basic) {
|
||||
lError() << "Delete invalid basic chat room...";
|
||||
Core::deleteChatRoom(buggyChatRoom);
|
||||
} else
|
||||
lError() << "Unable to delete invalid chat room with capabilities: " << capabilities << ".";
|
||||
}
|
||||
}
|
||||
|
||||
*session << "UPDATE chat_room"
|
||||
" SET capabilities = :capabilities,"
|
||||
" peer_sip_address_id = :peerSipAddressId,"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue