summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-22 17:02:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-22 17:02:52 +0300
commita14e6388fd3266c6815a4ebaad3a942896c3e80a (patch)
tree84147df60f4be482f3c5074ce1f8adcdbf46b4a2
parent061a20a9cf305cf5fabe2a35b7d8a86eb8d6b154 (diff)
if one needs to remove a chat's contact, just remove it and don't fuck my brain
-rw-r--r--include/m_chat.h4
-rw-r--r--libs/win32/mir_app.libbin237018 -> 236998 bytes
-rw-r--r--libs/win64/mir_app.libbin233948 -> 233928 bytes
-rw-r--r--protocols/Discord/src/dispatch.cpp6
-rw-r--r--protocols/Facebook/src/groupchats.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp2
-rw-r--r--protocols/ICQ-WIM/src/groupchats.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp2
-rw-r--r--src/mir_app/src/chat.h2
-rw-r--r--src/mir_app/src/chat_manager.cpp7
-rw-r--r--src/mir_app/src/chat_svc.cpp13
-rw-r--r--src/mir_app/src/mir_app.def4
-rw-r--r--src/mir_app/src/mir_app64.def4
13 files changed, 22 insertions, 26 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 5cb316087a..2ac337e3cd 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -420,11 +420,11 @@ MIR_APP_DLL(int) Chat_SetStatusEx(SESSION_INFO *si, int flags, const wchar_t *ws
#define WINDOW_CLEARLOG 6 // clear the log of the room window
MIR_APP_DLL(int) Chat_Control(SESSION_INFO *si, int command);
-MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si, bool bRemoveContact = false);
+MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si);
// these functions broadcast a command to all windows of specified szModule
MIR_APP_DLL(int) Chat_Control(const char *szModule, int command);
-MIR_APP_DLL(int) Chat_Terminate(const char *szModule, bool bRemoveContact = false);
+MIR_APP_DLL(int) Chat_Terminate(const char *szModule);
/////////////////////////////////////////////////////////////////////////////////////////
// Use this function to get information on different aspects of the sessions that are registered with Chat.
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 4f09e3492e..f52f22e315 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index a2b5e64bba..4d5d29aecc 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 10c39e8241..d0619f3c02 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -109,7 +109,7 @@ void CDiscordProto::OnCommandChannelDeleted(const JSONNode &pRoot)
else {
CDiscordGuild *pGuild = FindGuild(guildId);
if (pGuild != nullptr) {
- Chat_Terminate(pUser->si, true);
+ db_delete_contact(pUser->si->hContact);
pUser->si = nullptr;
}
}
@@ -185,11 +185,11 @@ void CDiscordProto::OnCommandGuildDeleted(const JSONNode &pRoot)
for (auto &it : arUsers.rev_iter())
if (it->pGuild == pGuild) {
- Chat_Terminate(it->si, true);
+ db_delete_contact(it->si->hContact);
arUsers.removeItem(&it);
}
- Chat_Terminate(pGuild->pParentSi, true);
+ db_delete_contact(pGuild->pParentSi->hContact);
pGuild->pParentSi = nullptr;
arGuilds.remove(pGuild);
diff --git a/protocols/Facebook/src/groupchats.cpp b/protocols/Facebook/src/groupchats.cpp
index cc56860e5a..3717d65eef 100644
--- a/protocols/Facebook/src/groupchats.cpp
+++ b/protocols/Facebook/src/groupchats.cpp
@@ -245,7 +245,7 @@ int FacebookProto::Chat_KickUser(SESSION_INFO *si, const wchar_t *pwszUid)
static void __cdecl DestroyRoomThread(SESSION_INFO *si)
{
::Sleep(100);
- Chat_Terminate(si, true);
+ db_delete_contact(si->hContact);
}
void FacebookProto::Chat_Leave(SESSION_INFO *si)
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 08e31d7e23..71c5726c0b 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1221,7 +1221,7 @@ void GaduProto::OnContactDeleted(MCONTACT hContact)
list_remove(&chats, chat, 1);
// Terminate chat window / shouldn't cascade entry is deleted
Chat_Control(chat->si, SESSION_OFFLINE);
- Chat_Terminate(chat->si, wszRoomId);
+ Chat_Terminate(chat->si);
chat->si = nullptr;
}
return;
diff --git a/protocols/ICQ-WIM/src/groupchats.cpp b/protocols/ICQ-WIM/src/groupchats.cpp
index d59e7c6a74..42c1b21c64 100644
--- a/protocols/ICQ-WIM/src/groupchats.cpp
+++ b/protocols/ICQ-WIM/src/groupchats.cpp
@@ -160,7 +160,7 @@ void CIcqProto::LeaveDestroyChat(SESSION_INFO *si)
Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/buddylist/hideChat")
<< AIMSID(this) << WCHAR_PARAM("buddy", si->ptszID) << INT64_PARAM("lastMsgId", getId(si->hContact, DB_KEY_LASTMSGID)));
- Chat_Terminate(si, true);
+ db_delete_contact(si->hContact);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index f4c9dd1353..48a5a98d8b 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -641,7 +641,7 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat)
return;
if (close_window)
- Chat_Terminate(m_szModuleName, cc->m_si->ptszID);
+ Chat_Terminate(cc->m_si);
else
Chat_Control(cc->m_si, SESSION_OFFLINE);
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index d36a72af71..baa328fd99 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -68,7 +68,7 @@ MODULEINFO* MM_FindModule(const char *pszModule);
BOOL SM_AddEvent(SESSION_INFO *si, GCEVENT *gce, bool bIsHighlighted);
BOOL SM_ChangeNick(SESSION_INFO *si, GCEVENT *gce);
-void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false);
+void SM_FreeSession(SESSION_INFO *si);
char* SM_GetUsers(SESSION_INFO *si);
BOOL SM_GiveStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszStatus);
void SM_RemoveAll(void);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index dc6e7aaa1b..400eb08aca 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -163,7 +163,7 @@ static SESSION_INFO* SM_CreateSession(void)
return new SESSION_INFO();
}
-void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact)
+void SM_FreeSession(SESSION_INFO *si)
{
if (g_clistApi.pfnGetEvent(si->hContact, 0))
g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
@@ -175,9 +175,6 @@ void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact)
Chat_DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
- if (si->hContact && bRemoveContact)
- db_delete_contact(si->hContact);
-
// contact may have been deleted here already, since function may be called after deleting
// contact so the handle may be invalid, therefore db_get_b shall return 0
if (si->hContact && Contact::IsGroupChat(si->hContact, si->pszModule)) {
@@ -411,7 +408,7 @@ BOOL SM_ChangeNick(SESSION_INFO *si, GCEVENT *gce)
void SM_RemoveAll(void)
{
for (auto &it : g_arSessions.rev_iter()) {
- SM_FreeSession(it, false);
+ SM_FreeSession(it);
g_arSessions.removeItem(&it);
}
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 0731fb09b4..47ad6d4954 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -373,7 +373,6 @@ struct ChatTerminateParam
{
const char *pszModule;
SESSION_INFO *si;
- bool bRemoveContact;
};
static INT_PTR __stdcall stubRoomTerminate(void *param)
@@ -381,7 +380,7 @@ static INT_PTR __stdcall stubRoomTerminate(void *param)
ChatTerminateParam *p = (ChatTerminateParam*)param;
if (p->si) {
g_arSessions.remove(p->si);
- SM_FreeSession(p->si, p->bRemoveContact);
+ SM_FreeSession(p->si);
}
else {
if (p->pszModule == nullptr)
@@ -390,23 +389,23 @@ static INT_PTR __stdcall stubRoomTerminate(void *param)
// remove all sessions with matching module name
for (auto &si : g_arSessions.rev_iter())
if (si->iType != GCW_SERVER && !mir_strcmpi(si->pszModule, p->pszModule))
- SM_FreeSession(g_arSessions.removeItem(&si), p->bRemoveContact);
+ SM_FreeSession(g_arSessions.removeItem(&si));
}
return TRUE;
}
-MIR_APP_DLL(int) Chat_Terminate(const char *szModule, bool bRemoveContact)
+MIR_APP_DLL(int) Chat_Terminate(const char *szModule)
{
- ChatTerminateParam param = { szModule, 0, bRemoveContact };
+ ChatTerminateParam param = { szModule, 0 };
return CallFunctionSync(stubRoomTerminate, &param);
}
-MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si, bool bRemoveContact)
+MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si)
{
if (!g_arSessions.find(si))
return GC_EVENT_ERROR;
- ChatTerminateParam param = { 0, si, bRemoveContact };
+ ChatTerminateParam param = { 0, si };
return CallFunctionSync(stubRoomTerminate, &param);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index bca07ef01d..e9f04abf2f 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -814,8 +814,8 @@ Srmm_CreateHotkey @886 NONAME
?Chat_SetStatusEx@@YGHPBDHPB_W@Z @929 NONAME
?Chat_SetStatusbarText@@YGHPAUSESSION_INFO@@PB_W@Z @930 NONAME
?Chat_SetUserInfo@@YGHPAUSESSION_INFO@@PAX@Z @931 NONAME
-?Chat_Terminate@@YGHPAUSESSION_INFO@@_N@Z @932 NONAME
-?Chat_Terminate@@YGHPBD_N@Z @933 NONAME
+?Chat_Terminate@@YGHPAUSESSION_INFO@@@Z @932 NONAME
+?Chat_Terminate@@YGHPBD@Z @933 NONAME
?Chat_Control@@YGHPBDH@Z @934 NONAME
?UpdateChatLog@CSrmmBaseDialog@@IAEXXZ @935 NONAME
?OnMarkRead@PROTO_INTERFACE@@UAEXII@Z @936 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b1ec756b7f..ba56983a07 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -814,8 +814,8 @@ Srmm_CreateHotkey @886 NONAME
?Chat_SetStatusEx@@YAHPEBDHPEB_W@Z @929 NONAME
?Chat_SetStatusbarText@@YAHPEAUSESSION_INFO@@PEB_W@Z @930 NONAME
?Chat_SetUserInfo@@YAHPEAUSESSION_INFO@@PEAX@Z @931 NONAME
-?Chat_Terminate@@YAHPEAUSESSION_INFO@@_N@Z @932 NONAME
-?Chat_Terminate@@YAHPEBD_N@Z @933 NONAME
+?Chat_Terminate@@YAHPEAUSESSION_INFO@@@Z @932 NONAME
+?Chat_Terminate@@YAHPEBD@Z @933 NONAME
?Chat_Control@@YAHPEBDH@Z @934 NONAME
?UpdateChatLog@CSrmmBaseDialog@@IEAAXXZ @935 NONAME
?OnMarkRead@PROTO_INTERFACE@@UEAAXII@Z @936 NONAME