summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-05 18:04:01 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-05 18:04:01 +0300
commit8449b1715de83ee5c997c8aac613e7efac9460d3 (patch)
treec3db7f88aa6a3db3036e49fc54cde6fc58e71ac0
parent7ced6103bd526de1980707bc019b03b2f0b64d00 (diff)
fixes #4608 (Telegram: у избранного должна быть недоступна опция "удалить историю для всех")
-rw-r--r--plugins/NewStory/src/history_control.cpp2
-rw-r--r--protocols/Telegram/src/proto.cpp13
-rw-r--r--protocols/Telegram/src/server.cpp2
3 files changed, 12 insertions, 5 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 0aabbdb74c..1454165994 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -340,7 +340,7 @@ public:
{
if (char *szProto = Proto_GetBaseAccountName(hContact)) {
bDelHistory = Proto_CanDeleteHistory(szProto, hContact);
- bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_DELETEFORALL) != 0;
+ bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, hContact) & PF4_DELETEFORALL) != 0;
}
}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index b270c760d7..07cba42bc9 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -334,8 +334,10 @@ int CTelegramProto::AuthRequest(MCONTACT hContact, const wchar_t *)
return 0;
}
-INT_PTR CTelegramProto::GetCaps(int type, MCONTACT)
+INT_PTR CTelegramProto::GetCaps(int type, MCONTACT hContact)
{
+ uint32_t ret;
+
switch (type) {
case PFLAGNUM_1:
return PF1_IM | PF1_FILE | PF1_CHAT | PF1_SEARCHBYNAME | PF1_ADDSEARCHRES | PF1_MODEMSGRECV | PF1_SERVERCLIST;
@@ -344,9 +346,12 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY;
case PFLAGNUM_4:
- return PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS
- | PF4_SERVERMSGID | PF4_DELETEFORALL | PF4_REPLY | PF4_GROUPCHATFILES;
-
+ ret = PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS
+ | PF4_SERVERMSGID | PF4_REPLY | PF4_GROUPCHATFILES;
+ if (GetId(hContact) != m_iOwnId)
+ ret |= PF4_DELETEFORALL;
+ return ret;
+
case PFLAGNUM_5:
return PF2_SHORTAWAY | PF2_LONGAWAY;
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index f7ef21a95f..5e71eafedc 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -504,6 +504,8 @@ INT_PTR CTelegramProto::SvcCanEmptyHistory(WPARAM hContact, LPARAM)
TG_SUPER_GROUP tmp(pUser->id, 0);
if (auto *pGroup = m_arSuperGroups.find(&tmp))
return !pGroup->group->is_channel_;
+
+ return 1;
}
return 0;