summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-24 12:27:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-24 12:27:21 +0000
commit9c8e399b431a9b0995efd24752a47efbe6e84ade (patch)
tree9ee230f9d7cd19b1ff0c6f67a9e754454a059f8c
parentafe5082c1a5126f5ba2973afaeaf16846302a295 (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
-rw-r--r--include/delphi/m_file.inc42
-rw-r--r--include/m_file.h72
-rw-r--r--plugins/AVS/src/poll.cpp2
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp2
-rw-r--r--plugins/BasicHistory/src/EventList.cpp4
-rw-r--r--plugins/BasicHistory/src/Options.cpp2
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp6
-rw-r--r--plugins/CmdLine/src/utils.cpp2
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp2
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp52
-rw-r--r--plugins/Scriver/src/msgs.cpp2
-rw-r--r--plugins/SpellChecker/src/utils.cpp2
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp4
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp4
-rw-r--r--plugins/Utils/mir_buffer.h2
-rw-r--r--plugins/WebView/src/webview_opts.cpp2
-rw-r--r--plugins/WebView/src/webview_services.cpp4
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp4
-rw-r--r--protocols/AimOscar/src/utility.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp4
-rw-r--r--protocols/IRCG/src/input.cpp2
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp5
-rw-r--r--protocols/SkypeClassic/src/skype.cpp35
-rw-r--r--protocols/Tlen/src/tlen_misc.cpp4
-rw-r--r--protocols/Tlen/src/tlen_muc.cpp6
-rw-r--r--protocols/Tlen/src/tlen_presence.cpp2
-rw-r--r--protocols/Tlen/src/tlen_svc.cpp4
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp11
-rw-r--r--protocols/Tlen/src/tlen_voice.cpp5
-rw-r--r--protocols/Xfire/src/main.cpp4
-rw-r--r--protocols/Yahoo/src/im.cpp2
-rw-r--r--protocols/Yahoo/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/yahoo.cpp6
-rw-r--r--src/core/stdfile/file.cpp126
-rw-r--r--src/core/stdfile/file.h10
-rw-r--r--src/core/stdfile/filerecvdlg.cpp6
-rw-r--r--src/core/stdfile/filesenddlg.cpp262
-rw-r--r--src/core/stdfile/filexferdlg.cpp22
-rw-r--r--src/core/stdfile/ftmanager.cpp2
-rw-r--r--src/core/stdmsg/src/msglog.cpp2
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp2
-rw-r--r--src/modules/chat/clist.cpp2
-rw-r--r--src/modules/clist/clcfiledrop.cpp2
-rw-r--r--src/modules/clist/clcitems.cpp2
-rw-r--r--src/modules/clist/clistmod.cpp2
-rw-r--r--src/modules/clist/contact.cpp4
48 files changed, 374 insertions, 382 deletions
diff --git a/include/delphi/m_file.inc b/include/delphi/m_file.inc
index 224aa41d8f..760ade5646 100644
--- a/include/delphi/m_file.inc
+++ b/include/delphi/m_file.inc
@@ -25,36 +25,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
const
{
- wParam : HCONTACT
+ wParam : MCONTACT
lParam : 0
Affects: Brings up the send file dialog for a contact, see notes
- Returns: 0 on success [non zero] on failure
+ Returns: file selection dialog's handle or 0 on error
Notes : Returns immediately without waiting for the send
}
MS_FILE_SENDFILE:PAnsiChar = 'SRFile/SendCommand';
{
- wParam : HCONTACT
+ wParam : MCONTACT
lParam : pointer to an array of PAnsiChar's the first nil item
terminates the list -- see notes
Affects: Brings up the send file dialog with specifieed files already chosen
the user is not prevented from editing the list --
- Returns: 0 on success [non zero] on failure -- returns immediately without
- waiting for the send to finish
+ Returns: file selection dialog's handle or 0 on error
+ returns immediately without waiting for the send to finish
Notes : both directories and files can be given
Version: v0.1.2.1+
}
MS_FILE_SENDSPECIFICFILES:PAnsiChar = 'SRFile/SendSpecificFiles';
-{
- v0.9.0+
- wParam=(WPARAM)(HANDLE)hContact
- lParam=(LPARAM)(const TCHAR**)ppFiles
- returns 0 on success or nonzero on failure
- returns immediately, without waiting for the send
-}
+ {
+ wParam : MCONTACT
+ lParam : pointer to an array of PWideChar's the first nil item
+ terminates the list -- see notes
+ Returns: file selection dialog's handle or 0 on error
+ returns immediately, without waiting for the send
+ }
MS_FILE_SENDSPECIFICFILEST:PAnsiChar = 'SRFile/SendSpecificFilesT';
-
+
{
wParam : HCONTACT
lParam : Pointer to a buffer
@@ -62,10 +62,24 @@ const
should be at least MAX_PATH long (defined with WinAPI),
the returned path may not exist -- see notes
Returns: Returns 0 on success [non zero] on failure
- notes : If HCONTACT is NULL(0) the path returned is the path
+ Notes : If HCONTACT is NULL(0) the path returned is the path
without the postfix contact name.
Version: v0.1.2.2+
}
MS_FILE_GETRECEIVEDFILESFOLDER:PAnsiChar = 'SRFile/GetReceivedFilesFolder';
+ {
+ wParam : HCONTACT
+ lParam : file selection dialog's window
+ Notes : notifies a caller about file send start
+ }
+ ME_FILEDLG_SUCCEEDED:PAnsiChar = 'SRFile/Dlg/Succeeded';
+
+ {
+ wParam : HCONTACT
+ lParam : file selection dialog's window
+ Notes : notifies a caller about file send cancellation
+ }
+ ME_FILEDLG_CANCELED:PAnsiChar = 'SRFile/Dlg/Canceled';
+
{$ENDIF}
diff --git a/include/m_file.h b/include/m_file.h
index 98597bb745..ccb39cd66d 100644
--- a/include/m_file.h
+++ b/include/m_file.h
@@ -25,45 +25,51 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_FILE_H__
#define M_FILE_H__ 1
-//brings up the send file dialog for a contact
-//wParam = (WPARAM)(HANDLE)hContact
-//lParam = 0
-//returns 0 on success or nonzero on failure
-//returns immediately, without waiting for the send
+// brings up the send file dialog for a contact
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// returns file selection dialog's handle or 0 on error
+// returns immediately, without waiting for the send
#define MS_FILE_SENDFILE "SRFile/SendCommand"
-//brings up the send file dialog with the specified files already chosen
-//v0.1.2.1+
-//wParam = (WPARAM)(HANDLE)hContact
-//lParam = (LPARAM)(const char**)ppFiles
-//returns 0 on success or nonzero on failure
-//returns immediately, without waiting for the send
-//the user is not prevented from changing the filename with the 'choose again'
-//button
-//ppFiles is a NULL-terminated array of fully qualified filenames.
-//To send subdirectories, include their name in the list without a trailing
-//backslash. In order to keep contained files in their correct place on
-//receiving, the subdirectory they're in must preceed the file. This applies
-//to subdirectories themselves too: they must be preceeded by their container
-//if you want to send the container and keep the original directory inside it.
+// brings up the send file dialog with the specified files already chosen
+// returns immediately, without waiting for the send
+// wParam = (WPARAM)(HANDLE)hContact
+// lParam = (LPARAM)(const char**)ppFiles
+// returns file selection dialog's handle or 0 on error
+// returns immediately, without waiting for the send
+// the user is not prevented from changing the filename with the 'choose again' button
+// ppFiles is a NULL-terminated array of fully qualified filenames.
+// To send subdirectories, include their name in the list without a trailing
+// backslash. In order to keep contained files in their correct place on
+// receiving, the subdirectory they're in must preceed the file. This applies
+// to subdirectories themselves too: they must be preceeded by their container
+// if you want to send the container and keep the original directory inside it.
#define MS_FILE_SENDSPECIFICFILES "SRFile/SendSpecificFiles"
-//v0.9.0+
-//wParam = (WPARAM)(HANDLE)hContact
-//lParam = (LPARAM)(const TCHAR**)ppFiles
-//returns 0 on success or nonzero on failure
-//returns immediately, without waiting for the send
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(const TCHAR**)ppFiles
+// returns file selection dialog's handle or 0 on error
+// returns immediately, without waiting for the send
#define MS_FILE_SENDSPECIFICFILEST "SRFile/SendSpecificFilesT"
-//get the received files folder v0.1.2.2+
-//wParam = (WPARAM)(HANDLE)hContact
-//lParam = (LPARAM)(char *)pszOutput
-//returns 0 on success or nonzero on failure
-//pszOutput must be at least MAX_PATH characters long
-//If hContact is NULL this function will retrieve the received files folder
-//name without any appended user names.
-//Note that the directory name returned by this function does not necessarily
-//exist.
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(char *)pszOutput
+// returns 0 on success or nonzero on failure
+// pszOutput must be at least MAX_PATH characters long
+// If hContact is NULL this function will retrieve the received files folder
+// name without any appended user names.
+// Note that the directory name returned by this function does not necessarily exist.
#define MS_FILE_GETRECEIVEDFILESFOLDER "SRFile/GetReceivedFilesFolder"
+// notifies a caller about file send start
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HWND)hwndDialog
+#define ME_FILEDLG_SUCCEEDED "SRFile/Dlg/Succeeded"
+
+// notifies a caller about file send cancellation
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HWND)hwndDialog
+#define ME_FILEDLG_CANCELED "SRFile/Dlg/Canceled"
+
#endif // M_FILE_H__
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index a7faa9007c..d017ef3aa3 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -211,7 +211,7 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto)
if (szProto != NULL && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
// Can have avatar, but must request it?
- if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, (WPARAM) hContact, 0))
+ if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0))
|| (PollCheckProtocol(szProto) && PollCheckContact(hContact, szProto)))
{
// Request it
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index f5a31ace20..1f3fad458e 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -166,7 +166,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_MESSAGE),FALSE);
}
/* check if proto is installed that supports file transfers and check if a file transfer dialog is available */
- if ((!AnyProtoHasCaps(PF1_FILESEND) && !AnyProtoHasCaps(PF1_FILERECV)) || !ServiceExists(MS_FILE_SENDFILE)) { /* no srfile present? */
+ if (!AnyProtoHasCaps(PF1_FILESEND) && !AnyProtoHasCaps(PF1_FILERECV)) { /* no srfile present? */
CheckDlgButton(hwndDlg,IDC_CHECK_FILETRANSFER,FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_FILETRANSFER),FALSE);
}
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index bb6efe76f7..64d37517cb 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -344,7 +344,7 @@ void EventList::InitNames()
{
TCHAR str[200];
if (hContact) {
- _tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR ));
+ _tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR ));
mir_sntprintf(str,200,TranslateT("History for %s"),contactName);
}
else {
@@ -390,7 +390,7 @@ void EventList::AddGroup(const EventIndex& ev)
std::wstring EventList::GetContactName()
{
if (hContact)
- return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR );
+ return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR );
return TranslateT("System");
}
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 202f25e69c..9c712ad8c1 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -1588,7 +1588,7 @@ void SaveList(HWND hwnd, MCONTACT hSystem, TaskOptions* to)
to->isSystem = SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM)hSystem, 0) != 0;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hItem = (HANDLE) SendMessage(hwnd, CLM_FINDCONTACT, (WPARAM) hContact, 0);
+ HANDLE hItem = (HANDLE) SendMessage(hwnd, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM) hItem, 0))
to->contacts.push_back(hContact);
}
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index 2cc5b4400f..866c319b88 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -1760,8 +1760,8 @@ DWORD WINAPI OpenMessageWindowThread(void *data)
MCONTACT hContact = (MCONTACT) data;
if (hContact)
{
- CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0);
- CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM) hContact, 0);
+ CallServiceSync(MS_MSG_SENDMESSAGE, hContact, 0);
+ CallServiceSync("SRMsg/LaunchMessageWindow", hContact, 0);
}
return 0;
@@ -2149,7 +2149,7 @@ void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply rep
if (hContact)
{
- CallService(block ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, (WPARAM) hContact, IGNOREEVENT_ALL);
+ CallService(block ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_ALL);
}
}
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp
index a4d8a43251..4c5336eaaf 100644
--- a/plugins/CmdLine/src/utils.cpp
+++ b/plugins/CmdLine/src/utils.cpp
@@ -337,7 +337,7 @@ MCONTACT GetContactFromID(TCHAR *szID, char *szProto)
GetContactProto(hContact, cProtocol, sizeof(cProtocol));
TCHAR *szHandle = GetContactID(hContact, cProtocol);
- tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0);
+ tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0);
STRNCPY(dispName, tmp, sizeof(dispName));
if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 1dc0c2bb16..0f86c1779a 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -806,7 +806,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact,bool bEnable)
&& !db_get_b(NULL, "SRMsg", "UnknownTyping", 1))
return;
// End user check
- CallService(MS_PROTO_SELFISTYPING, (WPARAM) hContact, bEnable?PROTOTYPE_SELFTYPING_ON:PROTOTYPE_SELFTYPING_OFF);
+ CallService(MS_PROTO_SELFISTYPING, hContact, bEnable ? PROTOTYPE_SELFTYPING_ON : PROTOTYPE_SELFTYPING_OFF);
}
//************************************************************************
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index 82c92f15cb..ba355b9895 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -432,7 +432,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
}
// Make contact name
- TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR);
+ TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
lstrcpyn(contact->szname, tmp, SIZEOF(contact->szname));
PROTOACCOUNT *acc = ProtoGetAccount(pszProto);
@@ -476,7 +476,7 @@ void EnableButtons(HWND hwndDlg, MCONTACT hContact)
// Is a meta?
if (ServiceExists(MS_MC_GETMOSTONLINECONTACT))
{
- MCONTACT hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0);
+ MCONTACT hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
if (hSub != NULL)
hContact = hSub;
}
@@ -499,7 +499,7 @@ void EnableButtons(HWND hwndDlg, MCONTACT hContact)
EnableWindow(GetDlgItem(hwndDlg, IDC_HISTORY), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_MENU), TRUE);
- HICON ico = ImageList_GetIcon(hIml, CallService(MS_CLIST_GETCONTACTICON, (WPARAM) hContact, 0), ILD_IMAGE);
+ HICON ico = ImageList_GetIcon(hIml, CallService(MS_CLIST_GETCONTACTICON, hContact, 0), ILD_IMAGE);
SendMessage(GetDlgItem(hwndDlg, IDC_ICO), STM_SETICON, (WPARAM) ico, 0);
}
}
@@ -844,9 +844,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (hContact == NULL)
break;
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM) hContact, 0);
+ CallService(MS_CLIST_CONTACTDOUBLECLICKED, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
}
break;
@@ -864,9 +864,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_MESSAGE)))
break;
- CallService(MS_MSG_SENDMESSAGET, (WPARAM) hContact, 0);
+ CallService(MS_MSG_SENDMESSAGET, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
}
@@ -892,8 +892,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
}
+ break;
+
case HOTKEY_FILE:
case IDC_FILE:
{
@@ -909,12 +910,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILE)))
break;
- CallService(MS_FILE_SENDFILE, (WPARAM) hContact, 0);
+ CallService(MS_FILE_SENDFILE, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
}
+ break;
+
case HOTKEY_URL:
case IDC_URL:
{
@@ -930,12 +932,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_URL)))
break;
- CallService(MS_URL_SENDURL, (WPARAM) hContact, 0);
+ CallService(MS_URL_SENDURL, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
}
+ break;
+
case HOTKEY_INFO:
case IDC_USERINFO:
{
@@ -951,12 +954,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_USERINFO)))
break;
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM) hContact, 0);
+ CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
}
+ break;
+
case HOTKEY_HISTORY:
case IDC_HISTORY:
{
@@ -972,12 +976,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_HISTORY)))
break;
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM) hContact, 0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", hContact);
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
}
+ break;
+
case HOTKEY_MENU:
case IDC_MENU:
{
@@ -995,7 +1000,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MENU), &rc);
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) hContact, 0);
+ HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -1006,8 +1011,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD) hContact);
- break;
}
+ break;
+
case HOTKEY_ALL_CONTACTS:
case IDC_SHOW_ALL_CONTACTS:
{
@@ -1034,8 +1040,6 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// Return selection
CheckText(hEdit, sztext);
-
- break;
}
}
break;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 2b9a150689..cb5212c82e 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -292,7 +292,7 @@ static void RestoreUnreadMessageAlerts(void)
else {
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), (char*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR));
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle);
}
}
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index 3b740f6372..028d76c8e7 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -729,7 +729,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch
int caps = (isProtocol ? CallProtoService(group, PS_GETCAPS, PFLAGNUM_4, 0) : 0);
if (caps & PF4_INFOSETTINGSVC)
- rc = CallProtoService(group, PS_GETINFOSETTING, (WPARAM) hContact, (LPARAM) &cgs);
+ rc = CallProtoService(group, PS_GETINFOSETTING, hContact, (LPARAM) &cgs);
else {
rc = CallService(MS_DB_CONTACT_GETSETTING_STR_EX, hContact, (LPARAM)&cgs);
if (rc == CALLSERVICE_NOTFOUND)
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index db12bee1a7..a2e3a22b6b 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -264,7 +264,7 @@ void LogSpamToFile(MCONTACT hContact, tstring message)
// Name, UID and Protocol Log line
LogProtocol=DBGetContactSettingStringPAN(hContact,"Protocol","p",_T(""));
- LogContactName=(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR);
+ LogContactName=(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
LogContactId=(LogProtocol==_T(""))?_T(""):GetContactUid(hContact,LogProtocol);
// Name, UID and Protocol Log line
@@ -380,7 +380,7 @@ void HistoryLogFunc(MCONTACT hContact, std::string message)
std::string msg = message;
msg.append("\n");
msg.append("Protocol: ").append(GetContactProto(hContact)).append(" Contact: ");
- msg.append(toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR))).append(" ID: ");
+ msg.append(toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))).append(" ID: ");
msg.append(toUTF8(GetContactUid(hContact,toUTF16(GetContactProto(hContact)))));
HistoryLog(NULL, (char*)msg.c_str(), EVENTTYPE_MESSAGE, DBEF_READ);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index ed9860f02f..6ffbed423c 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1830,13 +1830,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (mim_hotkey_check) {
case TABSRMM_HK_SETUSERPREFS:
- CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)dat->hContact, 0);
+ CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
return(_dlgReturn(hwndDlg, 1));
case TABSRMM_HK_NUDGE:
SendNudge(dat);
return(_dlgReturn(hwndDlg, 1));
case TABSRMM_HK_SENDFILE:
- CallService(MS_FILE_SENDFILE, (WPARAM)dat->hContact, 0);
+ CallService(MS_FILE_SENDFILE, dat->hContact, 0);
return(_dlgReturn(hwndDlg, 1));
case TABSRMM_HK_QUOTEMSG:
SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index 4e81ce3b10..03a8d69c75 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -791,7 +791,7 @@ void CTooltipNotify::LoadList(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, MODULENAME, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
@@ -806,7 +806,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown
m_sOptions.bIgnoreUnknown = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 0 : 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) {
BYTE bChecked = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0));
db_set_b(hContact, MODULENAME, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index f24496beeb..bdbb776594 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -91,7 +91,7 @@ LPSTR Proto(MCONTACT hContact)
{
if (hContact) {
INT_PTR result;
- result = CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM) hContact, NULL);
+ result = CallService(MS_PROTO_GETCONTACTBASEACCOUNT, hContact, NULL);
return (LPSTR) ((result == CALLSERVICE_NOTFOUND) ? NULL : result);
}
return NULL;
@@ -123,7 +123,7 @@ MCONTACT Add()
**/
BYTE Delete(MCONTACT hContact)
{
- return CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0) != 0;
+ return CallService(MS_DB_CONTACT_DELETE, hContact, 0) != 0;
}
/**
diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h
index 77e8832f7d..45c8af0e20 100644
--- a/plugins/Utils/mir_buffer.h
+++ b/plugins/Utils/mir_buffer.h
@@ -463,7 +463,7 @@ static void ReplaceVars(Buffer<TCHAR> *buffer, MCONTACT hContact, TCHAR **variab
size_t foundLen = i - j + 1;
if (foundLen == 9 && _tcsncmp(&buffer->str[j], _T("%contact%"), 9) == 0)
{
- buffer->replace(j, i + 1, (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR));
+ buffer->replace(j, i + 1, (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
}
else if (foundLen == 6 && _tcsncmp(&buffer->str[j], _T("%date%"), 6) == 0)
{
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index fe02eb5d21..d15e771219 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -722,7 +722,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
//if alerts is unticked delete the cache
if (!(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)))
- SiteDeleted((WPARAM) hContact, 0);
+ SiteDeleted(hContact, 0);
if (eventIndex == 0) // string present
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ALERT_STRING))))
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 7c73059b64..0289f0a096 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -367,8 +367,8 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam)
if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
return NULL;
- MCONTACT hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) MODULENAME);
+ MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)MODULENAME);
/////////write to db
db_set_b(hContact, MODULENAME, ON_TOP_KEY, 0);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 1e0dbd1e8a..f6282045a3 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -67,7 +67,7 @@ TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)
int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
{
if (commonData.bIgnoreSubcontacts) {
- MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0);
+ MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
if ((hMetacontact) && (hMetacontact != hContact)) //not main metacontact
return 0;
}
@@ -110,7 +110,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
{
if (commonData.bIgnoreSubcontacts) {
- MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0);
+ MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
if (hMetacontact && hMetacontact != hContact) //not main metacontact
return 0;
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 864e4edeba..6fa8530527 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -197,7 +197,7 @@ MCONTACT CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempo
if (addIfNeeded) {
MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
if (hContact) {
- if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) == 0) {
+ if (CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName) == 0) {
setString(hContact, AIM_KEY_SN, norm_sn);
setString(hContact, AIM_KEY_NK, sn);
debugLogA("Adding contact %s to client side list.",norm_sn);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index e5c25da860..3e3e9fb723 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1544,9 +1544,9 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
return NULL;
}
- if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) != 0) {
+ if (CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName) != 0) {
// For some reason we failed to register the protocol for this contact
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
debugLogA("getcontact(): Failed to register GG contact %d", uin);
return NULL;
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 8d7cf7138a..3288a69a40 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -656,7 +656,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hConta
TCHAR* p = (TCHAR*)temp.c_str();
pp[0] = p;
pp[1] = NULL;
- CallService(MS_FILE_SENDSPECIFICFILES, hContact, (LPARAM)pp);
+ CallService(MS_FILE_SENDSPECIFICFILEST, hContact, (LPARAM)pp);
}
}
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index dc3b1d9418..3ea38670c1 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -517,15 +517,12 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
// send file
if (!_tcsicmp(szCommand, _T("sendfile"))) {
- if (!ServiceExists(MS_FILE_SENDFILE))
- return 1;
-
MCONTACT hContact = HContactFromJID(szJid, TRUE);
if (hContact == NULL)
hContact = DBCreateContact(szJid, szJid, TRUE, TRUE);
if (hContact == NULL)
return 1;
- CallService(MS_FILE_SENDFILE, hContact, (LPARAM)NULL);
+ CallService(MS_FILE_SENDFILE, hContact, NULL);
return 0;
}
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp
index 1310b0bc60..2f464287cd 100644
--- a/protocols/SkypeClassic/src/skype.cpp
+++ b/protocols/SkypeClassic/src/skype.cpp
@@ -1949,41 +1949,6 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
if (sex) db_set_b(hContact, SKYPE_PROTONAME, "Gender", sex);
} else db_unset(hContact, SKYPE_PROTONAME, "Gender");
} else
- /* if (!strcmp(ptr, "AVATAR" )){
- LOG("WndProc", "AVATAR");
- if (!(hContact=find_contact(nick)))
- SkypeSend("GET USER %s BUDDYSTATUS", nick);
- else
- {
- TCHAR *unicode = NULL;
-
- if(utf8_decode((ptr+9), &Avatar)==-1) break;
-
- if( ServiceExists(MS_AV_SETAVATAR) )
- {
- CallService(MS_AV_SETAVATAR,(WPARAM) hContact,(LPARAM) Avatar);
- }
- else
- {
-
- if(db_set_ts(hContact, "ContactPhoto", "File", Avatar))
- {
- #if defined( _UNICODE )
- char buff[TEXT_LEN];
- WideCharToMultiByte(code_page, 0, Avatar, -1, buff, TEXT_LEN, 0, 0);
- buff[TEXT_LEN] = 0;
- db_set_s(hContact, "ContactPhoto", "File", buff);
- #endif
- }
-
- }
-
-
- }
- free(buf);
- break;
- }
- */
if (!strcmp(ptr, "MOOD_TEXT")){
LOG(("WndProc MOOD_TEXT"));
diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp
index 2879edfb82..c7205a31cd 100644
--- a/protocols/Tlen/src/tlen_misc.cpp
+++ b/protocols/Tlen/src/tlen_misc.cpp
@@ -46,7 +46,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick)
if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)proto->m_szModuleName);
// strip resource if present
s = TlenLoginFromJID(jid);
_strlwr(s);
@@ -114,7 +114,7 @@ MCONTACT TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL te
if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if (nick != NULL && nick[0] != '\0')
db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp
index fc87a29b09..02f4d220df 100644
--- a/protocols/Tlen/src/tlen_muc.cpp
+++ b/protocols/Tlen/src/tlen_muc.cpp
@@ -244,7 +244,7 @@ int TlenProtocol::MUCHandleEvent(WPARAM wParam, LPARAM lParam)
mir_snprintf(str, SIZEOF(str), "%s/%s", mucce->pszID, nick);
hContact = TlenDBCreateContact(this, str, nick, TRUE); //(char *)mucce->pszUID
db_set_b(hContact, m_szModuleName, "bChat", TRUE);
- CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
+ CallService(MS_MSG_SENDMESSAGE, hContact, NULL);
}
else {
DBVARIANT dbv;
@@ -253,7 +253,7 @@ int TlenProtocol::MUCHandleEvent(WPARAM wParam, LPARAM lParam)
mir_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
db_free(&dbv);
hContact = TlenDBCreateContact(this, str, nick, TRUE);
- CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
+ CallService(MS_MSG_SENDMESSAGE, hContact, NULL);
}
}
}
@@ -977,7 +977,7 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr)
if (!db_get(hContact, szProto, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.pItems[queryResult.iItemsNum].pszID = mir_strdup(dbv.pszVal);
- queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
+ queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
queryResult.iItemsNum++;
}
db_free(&dbv);
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp
index 57bd773bf0..e36f859f65 100644
--- a/protocols/Tlen/src/tlen_presence.cpp
+++ b/protocols/Tlen/src/tlen_presence.cpp
@@ -146,7 +146,7 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto)
}
if (item != NULL && item->isTyping) {
item->isTyping = FALSE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
}
proto->debugLogA("%s offline, set contact status to %d", from, status);
}
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp
index 6221fb5032..53b657bc1e 100644
--- a/protocols/Tlen/src/tlen_svc.cpp
+++ b/protocols/Tlen/src/tlen_svc.cpp
@@ -184,7 +184,7 @@ static MCONTACT AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD fl
// not already there: add
jid = mir_strdup(newJid); _strlwr(jid);
hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM) proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if ((nick=TlenNickFromJID(newJid)) == NULL)
nick = mir_strdup(newJid);
@@ -963,7 +963,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam)
jid = dbv.pszVal;
if ((item=TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
- newNick = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_NOMYHANDLE));
+ newNick = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_NOMYHANDLE));
} else if (cws->value.pszVal != NULL) {
newNick = settingToChar(cws);
} else {
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index e4eafbda90..d1ad131949 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -676,7 +676,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info)
if (item->isTyping) {
item->isTyping = FALSE;
if ((hContact=TlenHContactFromJID(info->proto, fromJid)) != NULL)
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
}
}
@@ -1041,12 +1041,11 @@ static void TlenProcessM(XmlNode *node, ThreadData *info)
bAlert = IsAuthorized(info->proto, fLogin);
}
if (bAlert) {
- if (info->proto->tlenOptions.useNudge) {
- NotifyEventHooks(info->proto->hTlenNudge,(WPARAM) hContact,0);
- } else {
- if (info->proto->tlenOptions.logAlerts) {
+ if (info->proto->tlenOptions.useNudge)
+ NotifyEventHooks(info->proto->hTlenNudge, hContact, 0);
+ else {
+ if (info->proto->tlenOptions.logAlerts)
TlenLogMessage(info->proto, hContact, 0, Translate("An alert has been received."));
- }
SkinPlaySound("TlenAlertNotify");
}
}
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp
index 148fb26919..ce97653f71 100644
--- a/protocols/Tlen/src/tlen_voice.cpp
+++ b/protocols/Tlen/src/tlen_voice.cpp
@@ -947,9 +947,8 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
- if ((hContact=TlenHContactFromJID(proto, jid)) != NULL) {
- return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
- }
+ if ((hContact=TlenHContactFromJID(proto, jid)) != NULL)
+ return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
}
return mir_strdup(id);
}
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index f5178659e5..86334fb692 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1604,7 +1604,7 @@ MCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan
// here we create a new one since no one is to be found
hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
if ( hContact ) {
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)protocolname );
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)protocolname);
if ( InList )
db_unset(hContact, "CList", "NotOnList");
@@ -3307,7 +3307,7 @@ INT_PTR BlockFriend(WPARAM hContact, LPARAM lParam)
}
}
}
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 1);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 1);
db_free(&dbv);
}
return 0;
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index bee33002bc..31e47510ec 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -132,7 +132,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
pre.lParam = 0;
// Turn off typing
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
ProtoChainRecvMsg(hContact, &pre);
// ack the message we just got
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index 68b80dbb35..3b0f6e7494 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -255,7 +255,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason )
debugLogA("Rejecting buddy:%s msg: %s", who, u_reason);
reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason);
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
return 0;
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 25488ce8a8..51e1ea569b 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -725,7 +725,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg)
* Make sure the contact is temporary so we could delete it w/o extra traffic
*/
db_set_b( hContact, "CList", "NotOnList", 1 );
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
else LOG(("[ext_rejected] Buddy not on our buddy list"));
@@ -757,7 +757,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status
ShowPopup( TranslateT("Invalid Contact"), TranslateT("The ID you tried to add is invalid."), NULL);
/* Make it TEMP first, we don't want to send any extra packets for FALSE ids */
db_set_b( hContact, "CList", "NotOnList", 1 );
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
break;
@@ -767,7 +767,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status
ShowPopup( TranslateT("Invalid Contact"), TranslateT("Unknown Error."), NULL);
/* Make it TEMP first, we don't want to send any extra packets for FALSE ids */
db_set_b( hContact, "CList", "NotOnList", 1 );
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
break;
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)