diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-24 12:27:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-24 12:27:21 +0000 |
commit | 9c8e399b431a9b0995efd24752a47efbe6e84ade (patch) | |
tree | 9ee230f9d7cd19b1ff0c6f67a9e754454a059f8c /src | |
parent | afe5082c1a5126f5ba2973afaeaf16846302a295 (diff) |
- added ME_FILEDLG_CANCELED & ME_FILEDLG_SUCCEEDED events to support async file selection dialog;
- return value of MS_FILE_SENDFILE* services changed: now it returns a dialog handle;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8253 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdfile/file.cpp | 126 | ||||
-rw-r--r-- | src/core/stdfile/file.h | 10 | ||||
-rw-r--r-- | src/core/stdfile/filerecvdlg.cpp | 6 | ||||
-rw-r--r-- | src/core/stdfile/filesenddlg.cpp | 262 | ||||
-rw-r--r-- | src/core/stdfile/filexferdlg.cpp | 22 | ||||
-rw-r--r-- | src/core/stdfile/ftmanager.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/clist.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clcfiledrop.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clcitems.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clistmod.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/contact.cpp | 4 |
13 files changed, 226 insertions, 218 deletions
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 08d5b250b5..3252ed5e5c 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -25,18 +25,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
#include "file.h"
+HANDLE hDlgSucceeded, hDlgCanceled;
+
TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s);
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR *r);
static HGENMENU hSRFileMenuItem;
-TCHAR *GetContactID(MCONTACT hContact)
+TCHAR* GetContactID(MCONTACT hContact)
{
- TCHAR *theValue = {0};
+ TCHAR *theValue = 0;
char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) {
DBVARIANT dbv;
- if ( !db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) {
+ if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
return theValue;
@@ -47,12 +49,12 @@ TCHAR *GetContactID(MCONTACT hContact) ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
return (TCHAR *)ci.pszVal;
case CNFT_DWORD:
- return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR)*32), 10);
+ return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR)* 32), 10);
}
}
}
@@ -64,8 +66,7 @@ static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) struct FileSendData fsd;
fsd.hContact = hContact;
fsd.ppFiles = NULL;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
- return 0;
+ return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
}
static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)
@@ -78,15 +79,15 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) while (ppFiles[count] != NULL)
count++;
- fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
- for (int i=0; i < count; i++)
- fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
- fsd.ppFiles[ count ] = NULL;
+ fsd.ppFiles = (const TCHAR**)alloca((count + 1) * sizeof(void*));
+ for (int i = 0; i < count; i++)
+ fsd.ppFiles[i] = mir_a2t(ppFiles[i]);
+ fsd.ppFiles[count] = NULL;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
for (int j = 0; j < count; j++)
mir_free((void*)fsd.ppFiles[j]);
- return 0;
+ return (INT_PTR)hWnd;
}
static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam)
@@ -94,8 +95,7 @@ static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) FileSendData fsd;
fsd.hContact = hContact;
fsd.ppFiles = (const TCHAR**)lParam;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
- return 0;
+ return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
}
static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
@@ -116,7 +116,7 @@ static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) void PushFileEvent(MCONTACT hContact, HANDLE hdbe, LPARAM lParam)
{
- CLISTEVENT cle = {0};
+ CLISTEVENT cle = { 0 };
cle.cbSize = sizeof(cle);
cle.hContact = hContact;
cle.hDbEvent = hdbe;
@@ -135,7 +135,8 @@ void PushFileEvent(MCONTACT hContact, HANDLE hdbe, LPARAM lParam) cle.hIcon = LoadSkinIcon(SKINICON_EVENT_FILE);
cle.pszService = "SRFile/RecvFile";
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- } }
+ }
+}
static int FileEventAdded(WPARAM wParam, LPARAM lParam)
{
@@ -145,7 +146,7 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) dbei.cbBlob = sizeof(DWORD);
dbei.pBlob = (PBYTE)&dwSignature;
db_event_get((HANDLE)lParam, &dbei);
- if (dbei.flags & (DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
+ if (dbei.flags & (DBEF_SENT | DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
return 0;
PushFileEvent(wParam, (HANDLE)lParam, 0);
@@ -171,20 +172,20 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed)
{
- if ( !unitsOverride) {
- if (size<1000) unitsOverride = UNITS_BYTES;
- else if (size<100*1024) unitsOverride = UNITS_KBPOINT1;
- else if (size<1024*1024) unitsOverride = UNITS_KBPOINT0;
- else if (size<1024*1024*1024) unitsOverride = UNITS_MBPOINT2;
+ if (!unitsOverride) {
+ if (size < 1000) unitsOverride = UNITS_BYTES;
+ else if (size < 100 * 1024) unitsOverride = UNITS_KBPOINT1;
+ else if (size < 1024 * 1024) unitsOverride = UNITS_KBPOINT0;
+ else if (size < 1024 * 1024 * 1024) unitsOverride = UNITS_MBPOINT2;
else unitsOverride = UNITS_GBPOINT3;
}
if (unitsUsed) *unitsUsed = unitsOverride;
- switch(unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break;
- default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break;
+ switch (unitsOverride) {
+ case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits ? _T(" ") : _T(""), appendUnits ? TranslateT("bytes") : _T("")); break;
+ case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size / 1024.0, appendUnits ? _T(" KB") : _T("")); break;
+ case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size / 1024), appendUnits ? _T(" KB") : _T("")); break;
+ case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20) / 1024.0, appendUnits ? _T(" GB") : _T("")); break;
+ default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size / 1048576.0, appendUnits ? _T(" MB") : _T("")); break;
}
}
@@ -196,8 +197,7 @@ void FreeFilesMatrix(TCHAR ***files) // Free each filename in the pointer array
TCHAR **pFile = *files;
- while (*pFile != NULL)
- {
+ while (*pFile != NULL) {
mir_free(*pFile);
*pFile = NULL;
pFile++;
@@ -212,7 +212,7 @@ void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts) {
mir_free(fts->tszCurrentFile);
if (fts->ptszFiles) {
- for (int i=0;i<fts->totalFiles;i++) mir_free(fts->ptszFiles[i]);
+ for (int i = 0; i < fts->totalFiles; i++) mir_free(fts->ptszFiles[i]);
mir_free(fts->ptszFiles);
}
mir_free(fts->tszWorkingDir);
@@ -224,7 +224,7 @@ void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFE if (src->tszCurrentFile) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
if (src->ptszFiles) {
dest->ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*src->totalFiles);
- for (int i=0; i < src->totalFiles; i++)
+ for (int i = 0; i < src->totalFiles; i++)
dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
}
if (src->tszWorkingDir) dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
@@ -237,16 +237,16 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->hContact = src->hContact;
dest->flags = src->flags;
if (dest->totalFiles != src->totalFiles) {
- for (int i=0;i<dest->totalFiles;i++) mir_free(dest->ptszFiles[i]);
+ for (int i = 0; i < dest->totalFiles; i++) mir_free(dest->ptszFiles[i]);
mir_free(dest->ptszFiles);
dest->ptszFiles = NULL;
dest->totalFiles = src->totalFiles;
}
if (src->ptszFiles) {
- if ( !dest->ptszFiles)
+ if (!dest->ptszFiles)
dest->ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)*src->totalFiles);
- for (int i=0; i < src->totalFiles; i++)
- if ( !dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) {
+ for (int i = 0; i < src->totalFiles; i++)
+ if (!dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) {
mir_free(dest->ptszFiles[i]);
if (src->ptszFiles[i])
dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
@@ -255,7 +255,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS }
}
else if (dest->ptszFiles) {
- for (int i=0; i < dest->totalFiles; i++)
+ for (int i = 0; i < dest->totalFiles; i++)
mir_free(dest->ptszFiles[i]);
mir_free(dest->ptszFiles);
dest->ptszFiles = NULL;
@@ -264,7 +264,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->currentFileNumber = src->currentFileNumber;
dest->totalBytes = src->totalBytes;
dest->totalProgress = src->totalProgress;
- if (src->tszWorkingDir && ( !dest->tszWorkingDir || PFTS_CompareWithTchar(src, src->tszWorkingDir, dest->tszWorkingDir))) {
+ if (src->tszWorkingDir && (!dest->tszWorkingDir || PFTS_CompareWithTchar(src, src->tszWorkingDir, dest->tszWorkingDir))) {
mir_free(dest->tszWorkingDir);
if (src->tszWorkingDir)
dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
@@ -272,7 +272,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->tszWorkingDir = NULL;
}
- if ( !dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar(src, src->tszCurrentFile, dest->tszCurrentFile)) {
+ if (!dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar(src, src->tszCurrentFile, dest->tszCurrentFile)) {
mir_free(dest->tszCurrentFile);
if (src->tszCurrentFile)
dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
@@ -293,7 +293,7 @@ static void RemoveUnreadFileEvents(void) while (hDbEvent) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
+ if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
db_event_markRead(hContact, hDbEvent);
hDbEvent = db_event_next(hDbEvent);
}
@@ -336,10 +336,9 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM) return 0;
}
-INT_PTR openContRecDir(WPARAM wparam, LPARAM)
+INT_PTR openContRecDir(WPARAM hContact, LPARAM)
{
TCHAR szContRecDir[MAX_PATH];
- MCONTACT hContact = (MCONTACT)wparam;
GetContactReceivedFilesDir(hContact, szContRecDir, SIZEOF(szContRecDir), TRUE);
ShellExecute(0, _T("open"), szContRecDir, 0, 0, SW_SHOW);
return 0;
@@ -355,13 +354,12 @@ INT_PTR openRecDir(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
-static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, char* szDescr)
+static void sttRecvCreateBlob(DBEVENTINFO &dbei, int fileCount, char **pszFiles, char *szDescr)
{
dbei.cbBlob = sizeof(DWORD);
- {
- for (int i=0; i < fileCount; i++)
- dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
- }
+
+ for (int i = 0; i < fileCount; i++)
+ dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
dbei.cbBlob += lstrlenA(szDescr) + 1;
@@ -370,7 +368,7 @@ static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, *(DWORD*)dbei.pBlob = 0;
BYTE* p = dbei.pBlob + sizeof(DWORD);
- for (int i=0; i < fileCount; i++) {
+ for (int i = 0; i < fileCount; i++) {
strcpy((char*)p, pszFiles[i]);
p += lstrlenA(pszFiles[i]) + 1;
}
@@ -379,30 +377,27 @@ static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
{
- CCSDATA* ccs = (CCSDATA*)lParam;
+ CCSDATA *ccs = (CCSDATA*)lParam;
PROTORECVFILET* pre = (PROTORECVFILET*)ccs->lParam;
if (pre->fileCount == 0)
return 0;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = GetContactProto(ccs->hContact);
dbei.timestamp = pre->timestamp;
dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0;
dbei.eventType = EVENTTYPE_FILE;
- char** pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
- {
- for (int i=0; i < pre->fileCount; i++)
- pszFiles[i] = Utf8EncodeT(pre->ptszFiles[i]);
- }
- char* szDescr = Utf8EncodeT(pre->tszDescription);
+ char **pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
+ for (int i = 0; i < pre->fileCount; i++)
+ pszFiles[i] = Utf8EncodeT(pre->ptszFiles[i]);
+
+ char *szDescr = Utf8EncodeT(pre->tszDescription);
dbei.flags |= DBEF_UTF;
sttRecvCreateBlob(dbei, pre->fileCount, pszFiles, szDescr);
- {
- for (int i=0; i < pre->fileCount; i++)
- mir_free(pszFiles[i]);
- }
+
+ for (int i = 0; i < pre->fileCount; i++)
+ mir_free(pszFiles[i]);
mir_free(szDescr);
HANDLE hdbe = db_event_add(ccs->hContact, &dbei);
@@ -428,6 +423,9 @@ int LoadSendRecvFileModule(void) HookEvent(ME_OPT_INITIALISE, FileOptInitialise);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu);
+ hDlgSucceeded = CreateHookableEvent(ME_FILEDLG_SUCCEEDED);
+ hDlgCanceled = CreateHookableEvent(ME_FILEDLG_CANCELED);
+
CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFileT);
CreateServiceFunction(MS_FILE_SENDFILE, SendFileCommand);
@@ -439,8 +437,8 @@ int LoadSendRecvFileModule(void) CreateServiceFunction("SRFile/OpenContRecDir", openContRecDir);
CreateServiceFunction("SRFile/OpenRecDir", openRecDir);
- SkinAddNewSoundEx("RecvFile", LPGEN("File"), LPGEN("Incoming"));
- SkinAddNewSoundEx("FileDone", LPGEN("File"), LPGEN("Complete"));
+ SkinAddNewSoundEx("RecvFile", LPGEN("File"), LPGEN("Incoming"));
+ SkinAddNewSoundEx("FileDone", LPGEN("File"), LPGEN("Complete"));
SkinAddNewSoundEx("FileFailed", LPGEN("File"), LPGEN("Error"));
SkinAddNewSoundEx("FileDenied", LPGEN("File"), LPGEN("Denied"));
return 0;
diff --git a/src/core/stdfile/file.h b/src/core/stdfile/file.h index 2c21d5987f..f86bc57fe6 100644 --- a/src/core/stdfile/file.h +++ b/src/core/stdfile/file.h @@ -37,13 +37,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_FILEEXISTSDLGREPLY (WM_USER+200)
#define M_PRESHUTDOWN (WM_USER+201)
-struct FileSendData {
+struct FileSendData
+{
MCONTACT hContact;
const TCHAR **ppFiles;
};
#define BYTESRECVEDHISTORYCOUNT 10 //the number of bytes recved is sampled once a second and the last 10 are used to get the transfer speed
-struct FileDlgData {
+struct FileDlgData
+{
HWND hwndTransfer;
HANDLE fs;
MCONTACT hContact;
@@ -109,8 +111,10 @@ int FileOptInitialise(WPARAM wParam, LPARAM lParam); HWND FtMgr_Show(bool bForceActivate, bool bFromMenu);
void FtMgr_Destroy();
-HWND FtMgr_AddTransfer(struct FileDlgData *dat);
+HWND FtMgr_AddTransfer(FileDlgData *dat);
void FreeFileDlgData(FileDlgData* dat);
TCHAR *GetContactID(MCONTACT hContact);
+
+extern HANDLE hDlgSucceeded, hDlgCanceled;
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index 8688fa6882..c21d71795f 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -204,9 +204,9 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct FileDlgData *dat;
+ FileDlgData *dat;
- dat = (struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -215,7 +215,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CLISTEVENT* cle = (CLISTEVENT*)lParam;
- dat = (struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData));
+ dat = (FileDlgData*)mir_calloc(sizeof(FileDlgData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->hContact = cle->hContact;
dat->hDbEvent = cle->hDbEvent;
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp index f56907c99b..7b56745a75 100644 --- a/src/core/stdfile/filesenddlg.cpp +++ b/src/core/stdfile/filesenddlg.cpp @@ -27,27 +27,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <sys/stat.h>
#include "file.h"
-static void SetFileListAndSizeControls(HWND hwndDlg, struct FileDlgData *dat)
+static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat)
{
int fileCount = 0, dirCount = 0, totalSize = 0, i;
struct _stat statbuf;
TCHAR str[64];
- for (i=0; dat->files[i]; i++) {
+ for (i = 0; dat->files[i]; i++) {
if (_tstat(dat->files[i], &statbuf) == 0) {
if (statbuf.st_mode & _S_IFDIR)
dirCount++;
else
fileCount++;
totalSize += statbuf.st_size;
- } }
+ }
+ }
GetSensiblyFormattedSize(totalSize, str, SIZEOF(str), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str);
- if (i>1) {
+ if (i > 1) {
TCHAR szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat, SIZEOF(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")), TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories")));
+ mir_sntprintf(szFormat, SIZEOF(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1 ? _T("%d file") : _T("%d files")), TranslateTS(dirCount == 1 ? _T("%d directory") : _T("%d directories")));
mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount);
}
else if (fileCount) {
@@ -65,7 +66,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg, struct FileDlgData *dat) EnableWindow(GetDlgItem(hwndDlg, IDOK), fileCount || dirCount);
}
-static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHAR *buf)
+static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
{
DWORD dwFileAttributes;
@@ -104,16 +105,15 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA // Fill the array
pBuf = buf + fileOffset;
nTemp = 0;
- while (*pBuf)
- {
+ while (*pBuf) {
// Allocate space for path+filename
int cbFileNameLen = lstrlen(pBuf);
dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
- CopyMemory(dat->files[nTemp], buf, (fileOffset-1)*sizeof(TCHAR));
- dat->files[nTemp][fileOffset-1] = '\\';
- _tcscpy(dat->files[nTemp] + fileOffset - (buf[fileOffset-2] == '\\'?1:0), pBuf);
+ CopyMemory(dat->files[nTemp], buf, (fileOffset - 1)*sizeof(TCHAR));
+ dat->files[nTemp][fileOffset - 1] = '\\';
+ _tcscpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
// Move pointers to next file...
pBuf += cbFileNameLen + 1;
@@ -123,8 +123,7 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA dat->files[nNumberOfFiles] = NULL;
}
// ...the selection is a single file
- else
- {
+ else {
if ((dat->files = (TCHAR **)mir_alloc(2 * sizeof(TCHAR*))) == NULL) // Leaks when aborted
return;
@@ -141,47 +140,50 @@ void __cdecl ChooseFilesThread(void* param) {
HWND hwndDlg = (HWND)param;
TCHAR filter[128], *pfilter;
- TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR)*32767);
- if (buf == NULL)
+ TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR)* 32767);
+ if (buf == NULL) {
PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)(TCHAR*)NULL);
+ return;
+ }
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
+ lstrcpy(filter, TranslateT("All files"));
+ lstrcat(filter, _T(" (*)"));
+ pfilter = filter + lstrlen(filter) + 1;
+ lstrcpy(pfilter, _T("*"));
+ pfilter = filter + lstrlen(filter) + 1;
+ pfilter[0] = '\0';
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = buf; *buf = 0;
+ ofn.nMaxFile = 32767;
+ ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ if (GetOpenFileName(&ofn))
+ PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)buf);
else {
- OPENFILENAME ofn = {0};
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = hwndDlg;
- lstrcpy(filter, TranslateT("All files"));
- lstrcat(filter, _T(" (*)"));
- pfilter = filter + lstrlen(filter)+1;
- lstrcpy(pfilter, _T("*"));
- pfilter = filter + lstrlen(filter)+1;
- pfilter[ 0 ] = '\0';
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = buf; *buf = 0;
- ofn.nMaxFile = 32767;
- ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- if (GetOpenFileName(&ofn))
- PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)buf);
- else {
- mir_free(buf);
- PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)(TCHAR*)NULL);
-} } }
+ mir_free(buf);
+ PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL);
+ }
+}
static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM)
{
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE)|WS_CLIPSIBLINGS);
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_CLIPSIBLINGS);
return TRUE;
}
static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_CHAR:
- if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
+ if (wParam == '\n' && GetKeyState(VK_CONTROL) & 0x8000) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
break;
case WM_SYSCHAR:
- if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
+ if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU) & 0x8000) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
@@ -192,83 +194,80 @@ static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct FileDlgData *dat;
-
- dat = (struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
- {
- struct FileSendData *fsd = (struct FileSendData*)lParam;
-
- dat = (struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData));
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- dat->hContact = fsd->hContact;
- dat->send = 1;
- dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN);
- dat->fs = NULL;
- dat->dwTicks = GetTickCount();
-
TranslateDialogDefault(hwndDlg);
- EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MSG), SendEditSubclassProc);
-
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
- Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
-
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
-
- if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
- int totalCount, i;
- for (totalCount = 0;fsd->ppFiles[totalCount];totalCount++);
- dat->files = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(totalCount+1)); // Leaks
- for (i=0;i<totalCount;i++)
- dat->files[i] = mir_tstrdup(fsd->ppFiles[i]);
- dat->files[totalCount] = NULL;
- SetFileListAndSizeControls(hwndDlg, dat);
- }
{
+ struct FileSendData *fsd = (struct FileSendData*)lParam;
+
+ dat = (FileDlgData*)mir_calloc(sizeof(FileDlgData));
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
+ dat->hContact = fsd->hContact;
+ dat->send = 1;
+ dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN);
+ dat->fs = NULL;
+ dat->dwTicks = GetTickCount();
+
+ EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MSG), SendEditSubclassProc);
+
+ Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
+ Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
+
+ if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
+ int totalCount, i;
+ for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
+ dat->files = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(totalCount + 1)); // Leaks
+ for (i = 0; i < totalCount; i++)
+ dat->files[i] = mir_tstrdup(fsd->ppFiles[i]);
+ dat->files[totalCount] = NULL;
+ SetFileListAndSizeControls(hwndDlg, dat);
+ }
+
TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
char *szProto = GetContactProto(dat->hContact);
if (szProto) {
- CONTACTINFO ci;
int hasName = 0;
char buf[128];
- ZeroMemory(&ci, sizeof(ci));
- ci.cbSize = sizeof(ci);
+ CONTACTINFO ci = { sizeof(ci) };
ci.hContact = dat->hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
- if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- switch(ci.type) {
- case CNFT_ASCIIZ:
- hasName = 1;
- mir_snprintf(buf, SIZEOF(buf), "%s", ci.pszVal);
- mir_free(ci.pszVal);
- break;
- case CNFT_DWORD:
- hasName = 1;
- mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
- break;
- } }
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ switch (ci.type) {
+ case CNFT_ASCIIZ:
+ hasName = 1;
+ mir_snprintf(buf, SIZEOF(buf), "%s", ci.pszVal);
+ mir_free(ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ hasName = 1;
+ mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
+ break;
+ }
+ }
if (hasName)
SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- } }
+ }
- if (fsd->ppFiles == NULL) {
- EnableWindow(hwndDlg, FALSE);
- dat->closeIfFileChooseCancelled = 1;
- PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE));
+ if (fsd->ppFiles == NULL) {
+ EnableWindow(hwndDlg, FALSE);
+ dat->closeIfFileChooseCancelled = 1;
+ PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE));
+ }
}
return TRUE;
- }
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
@@ -279,11 +278,14 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto = GetContactProto(dat->hContact);
if (szProto) {
- HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
- } } } }
+ }
+ }
+ }
+ }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case M_FILECHOOSEDONE:
@@ -299,44 +301,50 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_COMMAND:
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
- switch (LOWORD(wParam))
- {
- case IDC_CHOOSE:
- EnableWindow(hwndDlg, FALSE);
- //GetOpenFileName() creates its own message queue which prevents any incoming events being processed
- forkthread(ChooseFilesThread, 0, hwndDlg);
- break;
- case IDOK:
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSE), FALSE);
-
- GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath));
- GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
- GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
- dat->hwndTransfer = FtMgr_AddTransfer(dat);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- DestroyWindow(hwndDlg);
- return TRUE;
-
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- return TRUE;
-
- case IDC_USERMENU:
- { RECT rc;
+
+ switch (LOWORD(wParam)) {
+ case IDC_CHOOSE:
+ EnableWindow(hwndDlg, FALSE);
+ forkthread(ChooseFilesThread, 0, hwndDlg);
+ break;
+
+ case IDOK:
+ NotifyEventHooks(hDlgSucceeded, dat->hContact, (LPARAM)hwndDlg);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSE), FALSE);
+
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath));
+ GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
+ GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
+ dat->hwndTransfer = FtMgr_AddTransfer(dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ DestroyWindow(hwndDlg);
+ return TRUE;
+
+ case IDCANCEL:
+ NotifyEventHooks(hDlgCanceled, dat->hContact, (LPARAM)hwndDlg);
+ DestroyWindow(hwndDlg);
+ return TRUE;
+
+ case IDC_USERMENU:
+ {
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ RECT rc;
GetWindowRect((HWND)lParam, &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
- break;
}
- case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0);
- return TRUE;
- case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
- return TRUE;
+ break;
+
+ case IDC_DETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0);
+ return TRUE;
+
+ case IDC_HISTORY:
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
+ return TRUE;
}
break;
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index e6e303871c..349301b1cb 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HM_RECVEVENT (WM_USER+10)
-static int CheckVirusScanned(HWND hwnd, struct FileDlgData *dat, int i)
+static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i)
{
if (dat->send) return 1;
if (dat->fileVirusScanned == NULL) return 0;
@@ -48,10 +48,9 @@ TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s) {
if (flags & PFTS_UTF)
return Utf8DecodeW((char*)s);
- else if (flags & PFTS_UNICODE)
+ if (flags & PFTS_UNICODE)
return mir_tstrdup(s);
- else
- return mir_a2t((char*)s);
+ return mir_a2t((char*)s);
}
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR *r)
@@ -62,14 +61,13 @@ int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR mir_free(ts);
return res;
}
- else if (ft->flags & PFTS_UNICODE)
+ if (ft->flags & PFTS_UNICODE)
return _tcscmp(s, r);
- else {
- TCHAR *ts = mir_a2t((char*)s);
- int res = _tcscmp(ts, r);
- mir_free(ts);
- return res;
- }
+
+ TCHAR *ts = mir_a2t((char*)s);
+ int res = _tcscmp(ts, r);
+ mir_free(ts);
+ return res;
}
static void SetOpenFileButtonStyle(HWND hwndButton, int enabled)
@@ -131,7 +129,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) mir_free(info);
}
-static void SetFilenameControls(HWND hwndDlg, struct FileDlgData *dat, PROTOFILETRANSFERSTATUS *fts)
+static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFERSTATUS *fts)
{
TCHAR msg[MAX_PATH];
TCHAR *fnbuf = NULL, *fn = NULL;
diff --git a/src/core/stdfile/ftmanager.cpp b/src/core/stdfile/ftmanager.cpp index df7ce4a72a..835cf80922 100644 --- a/src/core/stdfile/ftmanager.cpp +++ b/src/core/stdfile/ftmanager.cpp @@ -231,7 +231,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA {
TFtProgressData *prg = (TFtProgressData *)wParam;
for (i=0; i < dat->wnds->realCount; ++i) {
- struct FileDlgData *trdat = (struct FileDlgData *)GetWindowLongPtr(dat->wnds->items[i]->hwnd, GWLP_USERDATA);
+ FileDlgData *trdat = (FileDlgData *)GetWindowLongPtr(dat->wnds->items[i]->hwnd, GWLP_USERDATA);
if (trdat->transferStatus.totalBytes && trdat->fs && !trdat->send && (trdat->transferStatus.totalBytes == trdat->transferStatus.totalProgress))
prg->scan++;
else if (trdat->transferStatus.totalBytes && trdat->fs) { // in progress
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index be5e960c5f..c0307ea826 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -282,7 +282,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE }
if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM) hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM) hDbEvent);
}
else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
db_event_markRead(hContact, hDbEvent);
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 10cd22a428..c60e1f002f 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -450,7 +450,7 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index 85d6720dfe..d548d8db2c 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -219,7 +219,7 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fm cle.ptszTooltip = TranslateTS(szBuf);
if (type) {
if (!CallService(MS_CLIST_GETEVENT, hContact, 0))
- CallService(MS_CLIST_ADDEVENT, (WPARAM) hContact, (LPARAM) &cle);
+ CallService(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle);
}
else {
if (CallService(MS_CLIST_GETEVENT, hContact, 0))
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 9cb9e01f03..57945bbedf 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -233,7 +233,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt AddToFileList(&ppFiles, &totalCount, szFilename);
}
- if (!CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles))
+ if (!CallService(MS_FILE_SENDSPECIFICFILEST, hContact, (LPARAM)ppFiles))
*pdwEffect = DROPEFFECT_COPY;
for (i=0; ppFiles[i]; i++)
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index a1c52bb02f..291f4aa64e 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -186,7 +186,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) i = cli.pfnAddItemToGroup(group, index + 1);
char *szProto = GetContactProto(hContact);
group->cl.items[i]->type = CLCIT_CONTACT;
- group->cl.items[i]->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) hContact, 0);
+ group->cl.items[i]->iImage = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
group->cl.items[i]->hContact = hContact;
group->cl.items[i]->proto = szProto;
if (szProto != NULL && !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 7fb4d55709..cd5059ceca 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -536,7 +536,7 @@ void UnloadContactListModule() for (MCONTACT hContact = db_find_first(); hContact != NULL; ) {
MCONTACT hNext = db_find_next(hContact);
if (db_get_b(hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
hContact = hNext;
}
ImageList_Destroy(hCListImages);
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 7931c1d7d1..0baab503ee 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -55,8 +55,8 @@ static int GetContactStatus(MCONTACT hContact) void fnChangeContactIcon(MCONTACT hContact, int iIcon, int add)
{
- CallService(add ? MS_CLUI_CONTACTADDED : MS_CLUI_CONTACTSETICON, (WPARAM) hContact, iIcon);
- NotifyEventHooks(hContactIconChangedEvent, (WPARAM) hContact, iIcon);
+ CallService(add ? MS_CLUI_CONTACTADDED : MS_CLUI_CONTACTSETICON, hContact, iIcon);
+ NotifyEventHooks(hContactIconChangedEvent, hContact, iIcon);
}
int GetStatusModeOrdering(int statusMode)
|