From a228b0e44e9da5c5ef2f871f0cce63a4e8ae18ac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 17 Jun 2024 12:17:44 +0300 Subject: =?UTF-8?q?fixes=20#4466=20(Telegram:=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B5=20=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=B8=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=20=D0=B1=D0=BB=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D0=BF=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BF=D1=80=D0=BE=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D0=B8=20=D1=81=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir_app/src/clui.cpp | 2 +- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/proto_utils.cpp | 11 +++++++++++ src/mir_app/src/srmm_main.cpp | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index e21acbd1af..fd692cf5aa 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -147,7 +147,7 @@ public: { szProto = Proto_GetBaseAccountName(hContact); bHasServer = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1) & PF1_SERVERCLIST) != 0; - bHasHistory = ProtoServiceExists(szProto, PS_EMPTY_SRV_HISTORY); + bHasHistory = Proto_CanDeleteHistory(szProto, hContact); bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4) & PF4_DELETEFORALL) != 0; chkDelHistory.OnChange = Callback(this, &CDeleteContactDlg::onChange_Server); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 9486812235..1547a72621 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -985,3 +985,4 @@ g_hevEventSetJson @1109 NONAME ??1MJsonWebSocket@@QAE@XZ @1121 NONAME ??_7MJsonWebSocket@@6B@ @1122 NONAME ?process@MJsonWebSocket@@EAEXPBEI@Z @1123 NONAME +_Proto_CanDeleteHistory@8 @1124 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a1a44174a0..07dd86a478 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -985,3 +985,4 @@ g_hevEventSetJson @1103 NONAME ??1MJsonWebSocket@@QEAA@XZ @1115 NONAME ??_7MJsonWebSocket@@6B@ @1116 NONAME ?process@MJsonWebSocket@@EEAAXPEBE_K@Z @1117 NONAME +Proto_CanDeleteHistory @1118 NONAME diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 78a0f33c69..10702e1473 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -105,6 +105,17 @@ MIR_APP_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, MCONTACT hContact, ///////////////////////////////////////////////////////////////////////////////////////// +MIR_APP_DLL(bool) Proto_CanDeleteHistory(const char *szModule, MCONTACT hContact) +{ + if (!ProtoServiceExists(szModule, PS_EMPTY_SRV_HISTORY)) + return false; + + // CallProtoService can return CALLSERVICE_NOTFOUND, we don't care + return CallProtoService(szModule, PS_CAN_EMPTY_HISTORY, hContact) != 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + void PROTO_INTERFACE::setAllContactStatuses(int iStatus, bool bSkipChats) { for (auto &hContact : AccContacts()) { diff --git a/src/mir_app/src/srmm_main.cpp b/src/mir_app/src/srmm_main.cpp index a053a0a6e9..36c83e7ecc 100644 --- a/src/mir_app/src/srmm_main.cpp +++ b/src/mir_app/src/srmm_main.cpp @@ -46,7 +46,7 @@ public: chkForEveryone(this, IDC_BOTH) { szProto = Proto_GetBaseAccountName(hContact); - bDelHistory = ProtoServiceExists(szProto, PS_EMPTY_SRV_HISTORY); + bDelHistory = Proto_CanDeleteHistory(szProto, hContact); bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4) & PF4_DELETEFORALL) != 0; } -- cgit v1.2.3