From 7a11ce58becfc750e5b4a9bb07102f8d334bbcf6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 Apr 2023 13:41:41 +0300 Subject: Telegram: silent file transfers don't require f/t manager, but simply create offline events --- src/core/stdfile/src/file.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/core/stdfile') diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 159a421fe6..b1f8f3670f 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -358,6 +358,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) blob.write(dbei); } + bool bShow = (pre->dwFlags & PRFF_SILENT) == 0; MEVENT hdbe = db_event_add(ccs->hContact, &dbei); CLISTEVENT cle = {}; @@ -365,19 +366,21 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) cle.hDbEvent = hdbe; cle.lParam = pre->lParam; - if (g_plugin.bAutoAccept && Contact::OnList(ccs->hContact)) + if (bShow && g_plugin.bAutoAccept && Contact::OnList(ccs->hContact)) LaunchRecvDialog(&cle); else { Skin_PlaySound("RecvFile"); - wchar_t szTooltip[256]; - mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(ccs->hContact)); - cle.szTooltip.w = szTooltip; + if (bShow) { + wchar_t szTooltip[256]; + mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(ccs->hContact)); + cle.szTooltip.w = szTooltip; - cle.flags |= CLEF_UNICODE; - cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); - cle.pszService = "SRFile/RecvFile"; - g_clistApi.pfnAddEvent(&cle); + cle.flags |= CLEF_UNICODE; + cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); + cle.pszService = "SRFile/RecvFile"; + g_clistApi.pfnAddEvent(&cle); + } } return hdbe; -- cgit v1.2.3