diff options
author | George Hazan <george.hazan@gmail.com> | 2024-06-17 12:17:44 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-06-17 12:17:44 +0300 |
commit | a228b0e44e9da5c5ef2f871f0cce63a4e8ae18ac (patch) | |
tree | 2a45928340873b2fbec55501ca4803ac36a45037 /src | |
parent | 9aee9deca972b405a09033456ec2f270eea96cd3 (diff) |
fixes #4466 (Telegram: при очистке истории канала нужно блокировать опции про удаление истории с сервера)
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clui.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 11 | ||||
-rw-r--r-- | src/mir_app/src/srmm_main.cpp | 2 |
5 files changed, 15 insertions, 2 deletions
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; } |