| 1356 | } |
| 1357 | |
| 1358 | void MessageList::OpenAttachment(AttachmentItem* pItem) |
| 1359 | { |
| 1360 | std::string fileName, url; |
| 1361 | Attachment* pAttach = pItem->m_pAttachment; |
| 1362 | fileName = pAttach->m_fileName; |
| 1363 | url = pAttach->m_actualUrl; |
| 1364 | |
| 1365 | // Check if the file name is a potentially dangerous download |
| 1366 | if (IsPotentiallyDangerousDownload(fileName)) |
| 1367 | { |
| 1368 | LPCTSTR urlTStr = ConvertCppStringToTString(url); |
| 1369 | TCHAR buffer[4096]; |
| 1370 | WAsnprintf(buffer, _countof(buffer), TmGetTString(IDS_DANGEROUS_DOWNLOAD), urlTStr); |
| 1371 | buffer[_countof(buffer) - 1] = 0; |
| 1372 | free((void*)urlTStr); |
| 1373 | int result = MessageBox( |
| 1374 | g_Hwnd, |
| 1375 | buffer, |
| 1376 | GetTextManager()->GetTString(IDS_DANGEROUS_DOWNLOAD_TITLE), |
| 1377 | MB_ICONWARNING | MB_YESNO |
| 1378 | ); |
| 1379 | |
| 1380 | if (result != IDYES) |
| 1381 | return; |
| 1382 | } |
| 1383 | |
| 1384 | if (pAttach->IsImage()) |
| 1385 | { |
| 1386 | CreateImageViewer( |
| 1387 | pAttach->m_proxyUrl, |
| 1388 | pAttach->m_actualUrl, |
| 1389 | pAttach->m_fileName, |
| 1390 | pAttach->m_width, |
| 1391 | pAttach->m_height |
| 1392 | ); |
| 1393 | return; |
| 1394 | } |
| 1395 | |
| 1396 | DownloadFileDialog(GetParent(m_hwnd), url, pAttach->m_fileName); |
| 1397 | } |
| 1398 | |
| 1399 | void MessageList::OpenInteractable(InteractableItem* pItem, MessageItem* pMsg) |
| 1400 | { |
no test coverage detected