summaryrefslogtreecommitdiff
path: root/src/modules/srfile/filexferdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/srfile/filexferdlg.cpp')
-rw-r--r--src/modules/srfile/filexferdlg.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp
index c4a41e750f..fa72e91f10 100644
--- a/src/modules/srfile/filexferdlg.cpp
+++ b/src/modules/srfile/filexferdlg.cpp
@@ -28,10 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int CheckVirusScanned(HWND hwnd,struct FileDlgData *dat,int i)
{
- if(dat->send) return 1;
- if(dat->fileVirusScanned == NULL) return 0;
- if(dat->fileVirusScanned[i]) return 1;
- if(DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1)==0) return 1;
+ if (dat->send) return 1;
+ if (dat->fileVirusScanned == NULL) return 0;
+ if (dat->fileVirusScanned[i]) return 1;
+ if (DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1)==0) return 1;
return IDYES==MessageBox(hwnd,TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"),TranslateT("File Received"),MB_YESNO|MB_DEFBUTTON2);
}
@@ -127,7 +127,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
if (!DBGetContactSettingTString(NULL,"SRFile", "ScanCmdLine", &dbv))
{
- if(dbv.ptszVal[0])
+ if (dbv.ptszVal[0])
{
TCHAR *pszReplace;
si.cb=sizeof(si);
@@ -140,8 +140,8 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace+2);
}
else lstrcpyn(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine));
- if(CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) {
- if(WaitForSingleObject(pi.hProcess,3600*1000)==WAIT_OBJECT_0)
+ if (CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) {
+ if (WaitForSingleObject(pi.hProcess,3600*1000)==WAIT_OBJECT_0)
PostMessage(info->hwndReply,M_VIRUSSCANDONE,info->returnCode,0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
@@ -264,7 +264,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->hNotifyEvent=HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_RECVEVENT);
dat->transferStatus.currentFileNumber = -1;
- if(dat->send) {
+ if (dat->send) {
dat->fs=(HANDLE)CallContactService(dat->hContact,PSS_FILET,(WPARAM)dat->szMsg,(LPARAM)dat->files);
SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT);
SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1);
@@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CreateDirectoryTreeT(dat->szSavePath);
dat->fs=(HANDLE)CallContactService(dat->hContact,PSS_FILEALLOWT,(WPARAM)dat->fs,(LPARAM)dat->szSavePath);
dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
- if(DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) dat->resumeBehaviour=FILERESUME_ASK;
+ if (DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) dat->resumeBehaviour=FILERESUME_ASK;
else dat->resumeBehaviour=DBGetContactSettingByte(NULL,"SRFile","IfExists",FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT);
}
@@ -320,7 +320,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SetDlgItemText(hwndDlg, IDC_CONTACTNAME, cli.pfnGetContactDisplayName( dat->hContact, 0 ));
- if(!dat->waitingForAcceptance) SetTimer(hwndDlg,1,1000,NULL);
+ if (!dat->waitingForAcceptance) SetTimer(hwndDlg,1,1000,NULL);
return TRUE;
case WM_TIMER:
MoveMemory(dat->bytesRecvedHistory+1,dat->bytesRecvedHistory,sizeof(dat->bytesRecvedHistory)-sizeof(dat->bytesRecvedHistory[0]));
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
FILETIME ft;
GetSensiblyFormattedSize((dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])/dat->bytesRecvedHistorySize,szSpeed,SIZEOF(szSpeed),0,1,NULL);
- if(dat->bytesRecvedHistory[0]==dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])
+ if (dat->bytesRecvedHistory[0]==dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])
lstrcpy(szTime,_T("??:??:??"));
else {
li.QuadPart=BIGI(10000000)*(dat->transferStatus.currentFileSize-dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
@@ -342,7 +342,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
FileTimeToSystemTime(&ft,&st);
GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER,&st,NULL,szTime,SIZEOF(szTime));
}
- if(dat->bytesRecvedHistory[0]!=dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) {
+ if (dat->bytesRecvedHistory[0]!=dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) {
li.QuadPart=BIGI(10000000)*(dat->transferStatus.totalBytes-dat->transferStatus.totalProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart;
FileTimeToSystemTime(&ft,&st);
@@ -454,7 +454,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TCHAR *p = pszNewFileName;
for (size_t pszlen=0; pszlen < cbFileNameLen; pszlen++) {
*p++ = pszFilename[pszlen];
- if (pszFilename[pszlen]=='&')
+ if (pszFilename[pszlen] == '&')
*p++ = '&';
}
*p = '\0';
@@ -500,7 +500,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->fs) CallContactService(dat->hContact,PSS_FILECANCEL,(WPARAM)dat->fs,0);
dat->fs=NULL;
mir_free(szOriginalFilename);
- if(pfr->szFilename) mir_free((char*)pfr->szFilename);
+ if (pfr->szFilename) mir_free((char*)pfr->szFilename);
mir_free(pfr);
return 0;
case FILERESUME_RESUMEALL:
@@ -512,13 +512,13 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
pfr->action=FILERESUME_RENAME;
{ TCHAR *pszExtension,*pszFilename;
int i;
- if((pszFilename = _tcsrchr(szOriginalFilename,'\\'))==NULL) pszFilename=szOriginalFilename;
- if((pszExtension = _tcsrchr(pszFilename+1,'.'))==NULL) pszExtension=pszFilename+lstrlen(pszFilename);
- if(pfr->szFilename) mir_free((TCHAR*)pfr->szFilename);
+ if ((pszFilename = _tcsrchr(szOriginalFilename,'\\'))==NULL) pszFilename=szOriginalFilename;
+ if ((pszExtension = _tcsrchr(pszFilename+1,'.'))==NULL) pszExtension=pszFilename+lstrlen(pszFilename);
+ if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename);
pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*((pszExtension-szOriginalFilename)+21+lstrlen(pszExtension)));
- for(i=1;;i++) {
+ for (i=1;;i++) {
_stprintf((TCHAR*)pfr->szFilename,_T("%.*s (%u)%s"),pszExtension-szOriginalFilename,szOriginalFilename,i,pszExtension);
- if(_taccess(pfr->szFilename,0)!=0)
+ if (_taccess(pfr->szFilename,0)!=0)
break;
}
}
@@ -526,17 +526,17 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
mir_free(szOriginalFilename);
CallProtoService(szProto,PS_FILERESUMET,(WPARAM)dat->fs,(LPARAM)pfr);
- if(pfr->szFilename) mir_free((char*)pfr->szFilename);
+ if (pfr->szFilename) mir_free((char*)pfr->szFilename);
mir_free(pfr);
break;
}
case HM_RECVEVENT:
{ ACKDATA *ack=(ACKDATA*)lParam;
if (ack->hProcess!=dat->fs) break; /* icq abuses this sometimes */
- if(ack->hContact!=dat->hContact) break;
- if(ack->type!=ACKTYPE_FILE) break;
+ if (ack->hContact!=dat->hContact) break;
+ if (ack->type!=ACKTYPE_FILE) break;
- if(dat->waitingForAcceptance) {
+ if (dat->waitingForAcceptance) {
SetTimer(hwndDlg,1,1000,NULL);
dat->waitingForAcceptance=0;
}
@@ -550,10 +550,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case ACKRESULT_NEXTFILE:
SetFtStatus(hwndDlg, LPGENT("Moving to next file..."), FTS_TEXT);
SetDlgItemTextA(hwndDlg,IDC_FILENAME,"");
- if(dat->transferStatus.currentFileNumber==1 && dat->transferStatus.totalFiles>1 && !dat->send)
+ if (dat->transferStatus.currentFileNumber==1 && dat->transferStatus.totalFiles>1 && !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1);
- if(dat->transferStatus.currentFileNumber!=-1 && dat->files && !dat->send && DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE)==VIRUSSCAN_DURINGDL) {
- if(GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
+ if (dat->transferStatus.currentFileNumber!=-1 && dat->files && !dat->send && DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE)==VIRUSSCAN_DURINGDL) {
+ if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg,M_VIRUSSCANDONE,dat->transferStatus.currentFileNumber,0);
else {
virusscanthreadstartinfo *vstsi;
@@ -576,7 +576,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT);
- if(dat->resumeBehaviour==FILERESUME_ASK) {
+ if (dat->resumeBehaviour==FILERESUME_ASK) {
TDlgProcFileExistsParam param = { hwndDlg, fts };
ShowWindow(hwndDlg,SW_SHOWNORMAL);
CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILEEXISTS),hwndDlg,DlgProcFileExists,(LPARAM)&param);
@@ -693,7 +693,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
struct virusscanthreadstartinfo *vstsi;
vstsi=(struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
vstsi->hwndReply=hwndDlg;
- if(useScanner==VIRUSSCAN_DURINGDL) {
+ if (useScanner==VIRUSSCAN_DURINGDL) {
vstsi->returnCode=dat->transferStatus.currentFileNumber;
if ( GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) {
PostMessage(hwndDlg,M_VIRUSSCANDONE,vstsi->returnCode,0);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
vstsi->returnCode = -1;
}
SetFtStatus(hwndDlg, LPGENT("Scanning for viruses..."), FTS_TEXT);
- if(vstsi) forkthread((void (*)(void*))RunVirusScannerThread,0,vstsi);
+ if (vstsi) forkthread((void (*)(void*))RunVirusScannerThread,0,vstsi);
} else {
dat->fs=NULL; /* protocol will free structure */
}
@@ -724,12 +724,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
} break; // case HM_RECVEVENT
case M_VIRUSSCANDONE:
{ int done=1,i;
- if((int)wParam==-1) {
- for(i=0;i<dat->transferStatus.totalFiles;i++) dat->fileVirusScanned[i]=1;
+ if ((int)wParam==-1) {
+ for (i=0;i<dat->transferStatus.totalFiles;i++) dat->fileVirusScanned[i]=1;
}
else {
dat->fileVirusScanned[wParam]=1;
- for(i=0;i<dat->transferStatus.totalFiles;i++) if(!dat->fileVirusScanned[i]) {done=0; break;}
+ for (i=0;i<dat->transferStatus.totalFiles;i++) if (!dat->fileVirusScanned[i]) {done=0; break;}
}
if (done)
{
@@ -772,7 +772,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
void FreeFileDlgData( FileDlgData* dat )
{
- if(dat->fs)
+ if (dat->fs)
CallContactService(dat->hContact,PSS_FILECANCEL,(WPARAM)dat->fs,0);
dat->fs = NULL;