From 9e24ff326b8b21ad40482c448ba43934cc92747c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 11 Apr 2025 14:54:36 +0300 Subject: =?UTF-8?q?fixes=20#4973=20(Telegram:=20=D0=B5=D1=81=D0=BB=D0=B8?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B1=D0=B5=D1=81=D0=B5=D0=B4=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20=D0=B0=D0=BA=D0=BA?= =?UTF-8?q?=D0=B0=D1=83=D0=BD=D1=82,=20=D1=82=D0=BE=D1=82=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B7=D1=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/options.cpp | 4 +++- protocols/Telegram/src/proto.cpp | 8 +++++--- protocols/Telegram/src/proto.h | 1 + protocols/Telegram/src/resource.h | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/options.cpp b/protocols/Telegram/src/options.cpp index c326e2925b..04a741e829 100644 --- a/protocols/Telegram/src/options.cpp +++ b/protocols/Telegram/src/options.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . class COptionsDlg : public CTelegramDlgBase { CCtrlButton btnLogout; - CCtrlCheck chkHideChats, chkCompressFiles, chkIncludePreviews, chkResidentChannels; + CCtrlCheck chkHideChats, chkCompressFiles, chkIncludePreviews, chkResidentChannels, chkDeleteContacts; CCtrlCombo cmbCountry; CCtrlEdit edtGroup, edtPhone, edtDeviceName; ptrW m_wszOldGroup; @@ -37,6 +37,7 @@ public: edtGroup(this, IDC_DEFGROUP), edtDeviceName(this, IDC_DEVICE_NAME), chkCompressFiles(this, IDC_COMPRESS_FILES), + chkDeleteContacts(this, IDC_DELETE_CONTACTS), chkIncludePreviews(this, IDC_USE_PREVIEW), chkResidentChannels(this, IDC_RESIDENT_CHANNELS), m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup)) @@ -48,6 +49,7 @@ public: if (bFullDlg) { CreateLink(chkCompressFiles, ppro->m_bCompressFiles); + CreateLink(chkDeleteContacts, ppro->m_bDeleteContacts); CreateLink(chkIncludePreviews, ppro->m_bIncludePreviews); CreateLink(chkResidentChannels, ppro->m_bResidentChannels); } diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index a1678331d2..6e59c6c983 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -60,6 +60,7 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : m_bUsePopups(this, "UsePopups", true), m_bCompressFiles(this, "CompressFiles", true), m_bHideGroupchats(this, "HideChats", true), + m_bDeleteContacts(this, "DeleteContacts", false), m_bIncludePreviews(this, "IncludePreview", true), m_bResidentChannels(this, "ResidentChannels", false) { @@ -196,9 +197,10 @@ void CTelegramProto::OnShutdown() { m_bTerminated = true; - for (auto &cc : m_arUsers) - if (cc->isBot && !cc->chatId && cc->hContact != INVALID_CONTACT_ID) - Contact::RemoveFromList(cc->hContact); + if (m_bDeleteContacts) + for (auto &cc : m_arUsers) + if (cc->isBot && !cc->chatId && cc->hContact != INVALID_CONTACT_ID) + Contact::RemoveFromList(cc->hContact); } int CTelegramProto::OnWindowEvent(WPARAM wParam, LPARAM lParam) diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 57eb9a2f35..f00e59353f 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -457,6 +457,7 @@ public: CMOption m_bIncludePreviews; // include URL previews into message text CMOption m_bResidentChannels; // don't store channel messages in a database CMOption m_bCompressFiles; // embed pictures & videos into a message on send + CMOption m_bDeleteContacts; // delete contacts from Miranda when they are deleted from server CMOption m_iTimeDiff1; // set this status to m_iStatus1 after this interval of secs CMOption m_iStatus1; CMOption m_iTimeDiff2; // set this status to m_iStatus2 after this interval of secs diff --git a/protocols/Telegram/src/resource.h b/protocols/Telegram/src/resource.h index b916cc8bec..7f1fda4af3 100644 --- a/protocols/Telegram/src/resource.h +++ b/protocols/Telegram/src/resource.h @@ -18,6 +18,7 @@ #define IDC_PHONE 1001 #define IDC_DEFGROUP 1002 #define IDC_HIDECHATS 1003 +#define IDC_DELETE_CONTACTS 1004 #define IDC_DEVICE_NAME 1005 #define IDC_DIFF1 1006 #define IDC_DIFF2 1007 -- cgit v1.2.3