diff options
author | George Hazan <ghazan@miranda.im> | 2023-02-10 12:54:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-02-10 12:54:20 +0300 |
commit | ef0ba268b340eaf1217a96d763342c25668588b4 (patch) | |
tree | 17396375e213043c2ce1c59b50b7f30488dcb83d /src/mir_core | |
parent | 33733576589076f080ddfa000b899843016a2597 (diff) |
Protocols: preventing recursive contact deletion
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/src/db.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 5b2048c2bb..23584d2fb1 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -98,7 +98,7 @@ MIR_CORE_DLL(MCONTACT) db_add_contact(void) return hNew;
}
-MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact)
+MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact, bool bFromProto)
{
ptrW wszPhoto(db_get_wsa(hContact, "ContactPhoto", "File"));
if (wszPhoto != nullptr) {
@@ -109,6 +109,10 @@ MIR_CORE_DLL(int) db_delete_contact(MCONTACT hContact) #endif
}
+ if (!bFromProto)
+ if (auto *ppro = Proto_GetInstance(hContact))
+ ppro->OnContactDeleted(hContact);
+
Netlib_Logf(nullptr, "Contact deleted: %d", hContact);
return (g_pCurrDb) ? g_pCurrDb->DeleteContact(hContact) : 0;
}
|