summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-07-16 21:24:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-07-16 21:24:16 +0300
commitdfa0a59f0ca06c9e7880bb55cdd7a6d09dc50eff (patch)
tree24623157565fb09d3d51c4b9e3e83888b316b0a4
parentcd4272ca22d47cdf673bfb0e5ec353acca3d9569 (diff)
fixes #3116 (Jabber: удаление комнаты из списка контактов не позволяет зайти в неё снова)
-rw-r--r--src/mir_app/src/chat_svc.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index d962856c90..1c34b4cbf2 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -755,16 +755,26 @@ static INT_PTR JoinChat(WPARAM hContact, LPARAM lParam)
return 0;
}
-static INT_PTR LeaveChat(WPARAM hContact, LPARAM lParam)
+static INT_PTR LeaveChat(WPARAM hContact, LPARAM)
{
if (hContact) {
char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto)
- CallProtoService(szProto, PS_LEAVECHAT, hContact, lParam);
+ CallProtoService(szProto, PS_LEAVECHAT, hContact, 0);
}
return 0;
}
+static int OnContactDeleted(WPARAM hContact, LPARAM)
+{
+ char *szProto = Proto_GetBaseAccountName(hContact);
+ if (szProto && Contact_IsGroupChat(hContact, szProto))
+ if (Contact_GetStatus(hContact) != ID_STATUS_OFFLINE)
+ CallProtoService(szProto, PS_LEAVECHAT, hContact, 0);
+
+ return 0;
+}
+
static INT_PTR MuteChat(WPARAM hContact, LPARAM param)
{
db_set_b(hContact, "SRMM", "MuteMode", param);
@@ -781,7 +791,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM)
char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// display this menu item only for chats
- if (db_get_b(hContact, szProto, "ChatRoom", 0)) {
+ if (Contact_IsGroupChat(hContact, szProto)) {
bIsChat = true;
// still hide it for offline protos
if (Proto_GetStatus(szProto) != ID_STATUS_OFFLINE) {
@@ -892,6 +902,7 @@ int LoadChatModule(void)
{
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
HookEvent(ME_FONT_RELOAD, FontsChanged);