summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/core.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-09 20:00:47 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-09 20:00:47 +0300
commitdbc48cc0ec4df774c257d5175d62bce16e2437e3 (patch)
tree525937d7b3e549bb75a817571dcecc0f7e32f82d /protocols/Gadu-Gadu/src/core.cpp
parent4d29366657d2ee93db4913a5a07af0d26820c058 (diff)
PROTO_INTERFACE::OnContactDeleted to be able to block the contact's deletion
Diffstat (limited to 'protocols/Gadu-Gadu/src/core.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 67c00622d1..93432deea9 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1197,35 +1197,32 @@ void GaduProto::broadcastnewstatus(int newStatus)
////////////////////////////////////////////////////////////
// When contact is deleted
-void GaduProto::OnContactDeleted(MCONTACT hContact)
+bool GaduProto::OnContactDeleted(MCONTACT hContact)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN);
// Terminate conference if contact is deleted
- if (isChatRoom(hContact) && uin && gc_enabled)
- {
+ if (isChatRoom(hContact) && uin && gc_enabled) {
CMStringW wszRoomId(FORMAT, L"%d", uin);
GGGC *chat = gc_lookup(wszRoomId);
debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, wszRoomId.c_str());
- if (chat)
- {
+ if (chat) {
// Destroy chat entry
free(chat->recipients);
list_remove(&chats, chat, 1);
+
// Terminate chat window / shouldn't cascade entry is deleted
Chat_Control(chat->si, SESSION_OFFLINE);
Chat_Terminate(chat->si);
chat->si = nullptr;
}
- return;
}
-
- if (uin && isonline())
- {
+ else if (uin && isonline()) {
gg_EnterCriticalSection(&sess_mutex, "contactdeleted", 25, "sess_mutex", 1);
gg_remove_notify_ex(m_sess, uin, GG_USER_NORMAL);
gg_LeaveCriticalSection(&sess_mutex, "contactdeleted", 25, 1, "sess_mutex", 1);
}
+ return true;
}
////////////////////////////////////////////////////////////