summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-07-18 19:53:25 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-07-18 19:53:25 +0300
commit33b3b58a18079f9dad1a0576f1fd947a39633319 (patch)
tree0573009db985116c22df61b213c3c68d636741e1 /src
parent004641be43a542a04e8cabdaca8fe8a4706a4b17 (diff)
option to download offline files automatically also fixes #3579 (ICQ: устаревают ссылки на оффлайновые файлы)
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/file.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp
index 2e221cb9f6..67476b2dbc 100644
--- a/src/mir_app/src/file.cpp
+++ b/src/mir_app/src/file.cpp
@@ -410,25 +410,34 @@ MEVENT Proto_RecvFile(MCONTACT hContact, PROTORECVFILE *pre)
MEVENT hdbe = db_event_add(hContact, &dbei);
- CLISTEVENT cle = {};
- cle.hContact = hContact;
- cle.hDbEvent = hdbe;
- cle.lParam = pre->lParam;
-
- if (!bSent && !bSilent && File::bAutoAccept && Contact::OnList(hContact))
- LaunchRecvDialog(&cle);
- else {
- Skin_PlaySound("RecvFile");
-
- if (!bSent && !Contact::IsGroupChat(hContact)) {
- wchar_t szTooltip[256];
- mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(hContact));
-
- cle.szTooltip.w = szTooltip;
- cle.flags |= CLEF_UNICODE;
- cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
- cle.pszService = (bSilent) ? MS_MSG_READMESSAGE : "SRFile/RecvFile";
- g_clistApi.pfnAddEvent(&cle);
+ // yes, we can receive a file that was sent from another device. let's ignore it
+ if (!bSent) {
+ CLISTEVENT cle = {};
+ cle.hContact = hContact;
+ cle.hDbEvent = hdbe;
+ cle.lParam = pre->lParam;
+
+ if (!bSilent && File::bAutoAccept && Contact::OnList(hContact))
+ LaunchRecvDialog(&cle);
+ else {
+ Skin_PlaySound("RecvFile");
+
+ // load offline files always (if OfflineSize = 0)
+ // or if they are less than a limit (if a transfer has specified file size)
+ if (bSilent && File::bOfflineAuto)
+ if (File::iOfflineSize == 0 || (blob.getSize() > 0 && blob.getSize() < File::iOfflineSize * 1024))
+ Srmm_DownloadOfflineFile(hdbe, false);
+
+ if (!Contact::IsGroupChat(hContact)) {
+ wchar_t szTooltip[256];
+ mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(hContact));
+
+ cle.szTooltip.w = szTooltip;
+ cle.flags |= CLEF_UNICODE;
+ cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
+ cle.pszService = (bSilent) ? MS_MSG_READMESSAGE : "SRFile/RecvFile";
+ g_clistApi.pfnAddEvent(&cle);
+ }
}
}