summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-27 15:15:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-27 15:15:33 +0000
commitd6eee2018898f2442883a0aa77ad095b75572cfb (patch)
tree8fbfe32690b9b32e5d47b1958a02f6f6a5fbf000 /plugins
parent2d37d969153b5fad810984182f747755c1cbc616 (diff)
fix for 64-bit issues & warnings
git-svn-id: http://svn.miranda-ng.org/main/trunk@15043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AssocMgr/src/dde.cpp240
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp2
-rw-r--r--plugins/Clist_nicer/src/clc.cpp4
-rw-r--r--plugins/Clist_nicer/src/clcidents.cpp4
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp2
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp3
-rw-r--r--plugins/Exchange/src/dlg_handlers.cpp50
-rw-r--r--plugins/Exchange/src/utils.cpp18
-rw-r--r--plugins/FavContacts/src/menu.cpp2
-rw-r--r--plugins/FavContacts/src/options.cpp4
-rw-r--r--plugins/FloatingContacts/src/main.cpp2
-rw-r--r--plugins/HistoryStats/src/bandctrlimpl.cpp6
-rw-r--r--plugins/HistoryStats/src/bandctrlimpl.h31
-rw-r--r--plugins/HistoryStats/src/dlgfilterwords.cpp2
-rw-r--r--plugins/HistoryStats/src/dlgoption_subglobal.cpp2
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl.cpp6
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl.h12
-rw-r--r--plugins/HistorySweeperLight/src/options.cpp2
-rw-r--r--plugins/MenuItemEx/src/main.cpp6
-rw-r--r--plugins/MirFox/src/MirandaUtils.cpp12
-rw-r--r--plugins/MirLua/src/m_windows.cpp4
-rw-r--r--plugins/MirOTR/Libgpg-error/estream.c2
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp2
-rw-r--r--plugins/MirOTR/src/dialogs.cpp656
-rw-r--r--plugins/MirOTR/src/options.cpp6
-rw-r--r--plugins/MirOTR/src/otr.cpp18
-rw-r--r--plugins/MirOTR/src/utils.cpp2
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp6
-rw-r--r--plugins/MirandaG15/src/LCDFramework/ConStream.cppbin3624 -> 3625 bytes
-rw-r--r--plugins/NewAwaySysMod/src/ContactList.cpp4
-rw-r--r--plugins/NewAwaySysMod/src/MsgTree.cpp2
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp2
-rw-r--r--plugins/NotifyAnything/src/main.cpp4
-rw-r--r--plugins/Ping/src/pinggraph.cpp2
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp2
-rw-r--r--plugins/SMS/src/recvdlg.cpp168
-rw-r--r--plugins/SMS/src/senddlg.cpp1101
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/msgwindow.cpp4
-rw-r--r--plugins/SecureIM/src/crypt_misc.cpp2
-rw-r--r--plugins/Sessions/Src/Options.cpp4
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp6
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp2
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp4
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
-rw-r--r--plugins/WebView/src/webview_alerts.cpp10
-rw-r--r--plugins/WebView/src/webview_services.cpp10
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp12
-rw-r--r--plugins/wbOSD/src/events.cpp4
-rw-r--r--plugins/wbOSD/src/main.cpp6
-rw-r--r--plugins/wbOSD/src/options.cpp604
-rw-r--r--plugins/wbOSD/src/stdafx.h4
-rw-r--r--plugins/wbOSD/src/wbOSD.cpp243
56 files changed, 1636 insertions, 1682 deletions
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp
index 17706ab018..ba69dd9fac 100644
--- a/plugins/AssocMgr/src/dde.cpp
+++ b/plugins/AssocMgr/src/dde.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HINSTANCE hInst;
static HWND hwndDdeMsg;
/* Misc */
-static HANDLE hHookModulesLoaded,hHookPreShutdown;
+static HANDLE hHookModulesLoaded, hHookPreShutdown;
/************************* Open Handler ***************************/
@@ -34,13 +34,13 @@ static void __stdcall FileActionAsync(void *param)
{
TCHAR *pszFilePath = (TCHAR*)param;
/* invoke main handler */
- switch(InvokeFileHandler(pszFilePath)) { /* pszFilePath is always a long path name */
- case 0: /* success */ break;
- case CALLSERVICE_NOTFOUND:
- ShowInfoMessage(NIIF_ERROR,Translate("Miranda NG could not open file"),Translate("Miranda NG was not able to open \"%S\".\n\nThere is no registered handler for this file type."),pszFilePath);
- break;
- default:
- ShowInfoMessage(NIIF_ERROR,Translate("Miranda NG could not open file"),Translate("Miranda NG was not able to open \"%S\".\n\nThe file could not be processed."),pszFilePath);
+ switch (InvokeFileHandler(pszFilePath)) { /* pszFilePath is always a long path name */
+ case 0: /* success */ break;
+ case CALLSERVICE_NOTFOUND:
+ ShowInfoMessage(NIIF_ERROR, Translate("Miranda NG could not open file"), Translate("Miranda NG was not able to open \"%S\".\n\nThere is no registered handler for this file type."), pszFilePath);
+ break;
+ default:
+ ShowInfoMessage(NIIF_ERROR, Translate("Miranda NG could not open file"), Translate("Miranda NG was not able to open \"%S\".\n\nThe file could not be processed."), pszFilePath);
}
mir_free(pszFilePath); /* async param */
}
@@ -50,13 +50,13 @@ static void __stdcall UrlActionAsync(void *param)
{
TCHAR *pszUrl = (TCHAR*)param;
/* invoke main handler */
- switch(InvokeUrlHandler(pszUrl)) {
- case 0: /* success */ break;
- case CALLSERVICE_NOTFOUND:
- ShowInfoMessage(NIIF_ERROR,Translate("Miranda NG could not open URL"),Translate("Miranda NG was not able to open \"%S\".\n\nThere is no registered handler for this URL type."),pszUrl);
- break;
- default:
- ShowInfoMessage(NIIF_ERROR,Translate("Miranda NG could not open URL"),Translate("Miranda NG was not able to open \"%S\".\n\nThe given URL is invalid and cannot be parsed."),pszUrl);
+ switch (InvokeUrlHandler(pszUrl)) {
+ case 0: /* success */ break;
+ case CALLSERVICE_NOTFOUND:
+ ShowInfoMessage(NIIF_ERROR, Translate("Miranda NG could not open URL"), Translate("Miranda NG was not able to open \"%S\".\n\nThere is no registered handler for this URL type."), pszUrl);
+ break;
+ default:
+ ShowInfoMessage(NIIF_ERROR, Translate("Miranda NG could not open URL"), Translate("Miranda NG was not able to open \"%S\".\n\nThe given URL is invalid and cannot be parsed."), pszUrl);
}
mir_free(pszUrl); /* async param */
}
@@ -70,116 +70,117 @@ static void __stdcall UrlActionAsync(void *param)
// returns an empty string if the string does not have enough arguments
static TCHAR* GetExecuteParam(TCHAR **ppszString)
{
- TCHAR *pszParam,*p;
+ TCHAR *pszParam, *p;
BOOL fQuoted;
-
- fQuoted=(**ppszString==_T('"'));
- pszParam=*ppszString;
- if(fQuoted) pszParam++;
- p=_tcschr(pszParam,(TCHAR)(fQuoted?_T('"'):_T(',')));
- if(p!=NULL) {
- *(p++)=0;
- if(fQuoted && *p==_T(',')) p++;
- } else p=&pszParam[mir_tstrlen(pszParam)];
- *ppszString=p;
+
+ fQuoted = (**ppszString == _T('"'));
+ pszParam = *ppszString;
+ if (fQuoted) pszParam++;
+ p = _tcschr(pszParam, (TCHAR)(fQuoted ? _T('"') : _T(',')));
+ if (p != NULL) {
+ *(p++) = 0;
+ if (fQuoted && *p == _T(',')) p++;
+ }
+ else p = &pszParam[mir_tstrlen(pszParam)];
+ *ppszString = p;
return pszParam;
}
-static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
- case WM_DDE_INITIATE:
+ switch (msg) {
+ case WM_DDE_INITIATE:
{
- ATOM hSzApp=LOWORD(lParam); /* no UnpackDDElParam() here */
- ATOM hSzTopic=HIWORD(lParam);
- if ((hSzApp==GlobalFindAtom(DDEAPP) && hSzTopic==GlobalFindAtom(DDETOPIC)) || !hSzApp) {
- hSzApp=GlobalAddAtom(DDEAPP);
- hSzTopic=GlobalAddAtom(DDETOPIC);
- if(hSzApp && hSzTopic)
+ ATOM hSzApp = LOWORD(lParam); /* no UnpackDDElParam() here */
+ ATOM hSzTopic = HIWORD(lParam);
+ if ((hSzApp == GlobalFindAtom(DDEAPP) && hSzTopic == GlobalFindAtom(DDETOPIC)) || !hSzApp) {
+ hSzApp = GlobalAddAtom(DDEAPP);
+ hSzTopic = GlobalAddAtom(DDETOPIC);
+ if (hSzApp && hSzTopic)
/* PackDDElParam() only for posted msgs */
- SendMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,MAKELPARAM(hSzApp,hSzTopic));
- if(hSzApp) GlobalDeleteAtom(hSzApp);
- if(hSzTopic) GlobalDeleteAtom(hSzTopic);
+ SendMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, MAKELPARAM(hSzApp, hSzTopic));
+ if (hSzApp) GlobalDeleteAtom(hSzApp);
+ if (hSzTopic) GlobalDeleteAtom(hSzTopic);
}
return 0;
}
- case WM_DDE_EXECUTE: /* posted message */
+ case WM_DDE_EXECUTE: /* posted message */
{
HGLOBAL hCommand;
TCHAR *pszCommand;
DDEACK ack;
memset(&ack, 0, sizeof(ack));
- if(UnpackDDElParam(msg,lParam,NULL,(PUINT_PTR)&hCommand)) {
+ if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hCommand)) {
/* ANSI execute command can't happen for shell */
- if(IsWindowUnicode((HWND)wParam)) {
+ if (IsWindowUnicode((HWND)wParam)) {
pszCommand = (TCHAR*)GlobalLock(hCommand);
- if(pszCommand!=NULL) {
- TCHAR *pszAction,*pszArg;
- pszAction=GetExecuteParam(&pszCommand);
- pszArg=GetExecuteParam(&pszCommand);
- if(pszArg!=NULL) {
+ if (pszCommand != NULL) {
+ TCHAR *pszAction = GetExecuteParam(&pszCommand);
+ TCHAR *pszArg = GetExecuteParam(&pszCommand);
+ if (pszArg != NULL) {
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
- if (!mir_tstrcmpi(pszAction,_T("file")))
- CallFunctionAsync(FileActionAsync,pszArg);
- else if (!mir_tstrcmpi(pszAction,_T("url")))
- CallFunctionAsync(UrlActionAsync,pszArg);
+ if (!mir_tstrcmpi(pszAction, _T("file")))
+ CallFunctionAsync(FileActionAsync, pszArg);
+ else if (!mir_tstrcmpi(pszAction, _T("url")))
+ CallFunctionAsync(UrlActionAsync, pszArg);
}
GlobalUnlock(hCommand);
}
-
}
-
- lParam=ReuseDDElParam(lParam,msg,WM_DDE_ACK,*(PUINT)&ack,(UINT)hCommand);
- if (!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
+
+ lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT_PTR)hCommand);
+ if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) {
GlobalFree(hCommand);
- FreeDDElParam(WM_DDE_ACK,lParam);
+ FreeDDElParam(WM_DDE_ACK, lParam);
}
}
- return 0;
}
- case WM_DDE_TERMINATE:
- PostMessage((HWND)wParam,msg,(WPARAM)hwnd,0); /* ack reply */
- return 0;
- case WM_DDE_REQUEST:
- case WM_DDE_ADVISE:
- case WM_DDE_UNADVISE:
- case WM_DDE_POKE:
+ return 0;
+
+ case WM_DDE_TERMINATE:
+ PostMessage((HWND)wParam, msg, (WPARAM)hwnd, 0); /* ack reply */
+ return 0;
+
+ case WM_DDE_REQUEST:
+ case WM_DDE_ADVISE:
+ case WM_DDE_UNADVISE:
+ case WM_DDE_POKE:
/* fail safely for those to avoid memory leak in lParam */
{
ATOM hSzItem;
DDEACK ack;
memset(&ack, 0, sizeof(ack));
- if(UnpackDDElParam(msg,lParam,NULL,(PUINT_PTR)&hSzItem)) {
- lParam=ReuseDDElParam(lParam,msg,WM_DDE_ACK,*(PUINT)&ack,(UINT)hSzItem);
- if (!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
- if(hSzItem) GlobalDeleteAtom(hSzItem);
- FreeDDElParam(WM_DDE_ACK,lParam);
+ if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hSzItem)) {
+ lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT)hSzItem);
+ if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) {
+ if (hSzItem) GlobalDeleteAtom(hSzItem);
+ FreeDDElParam(WM_DDE_ACK, lParam);
}
}
return 0;
}
}
- return DefWindowProc(hwnd,msg,wParam,lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
// CloseHandle() the return value
static HANDLE StartupMainProcess(TCHAR *pszDatabasePath)
{
- TCHAR *p,szPath[MAX_PATH];
+ TCHAR *p, szPath[MAX_PATH];
/* we are inside RunDll32 here */
- if (!GetModuleFileName(hInst,szPath,_countof(szPath))) return NULL;
- p=_tcsrchr(szPath,_T('\\'));
- if(p!=NULL) { *p=0; p=_tcsrchr(szPath,_T('\\')); }
- if(p==NULL) return NULL;
- mir_tstrcpy(++p,_T("miranda32.exe"));
+ if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return NULL;
+ p = _tcsrchr(szPath, _T('\\'));
+ if (p != NULL) { *p = 0; p = _tcsrchr(szPath, _T('\\')); }
+ if (p == NULL) return NULL;
+ mir_tstrcpy(++p, _T("miranda32.exe"));
/* inherit startup data from RunDll32 process */
STARTUPINFO si;
GetStartupInfo(&si);
PROCESS_INFORMATION pi;
- if (!CreateProcess(szPath,pszDatabasePath,NULL,NULL,TRUE,GetPriorityClass(GetCurrentProcess()),NULL,NULL,&si,&pi))
+ if (!CreateProcess(szPath, pszDatabasePath, NULL, NULL, TRUE, GetPriorityClass(GetCurrentProcess()), NULL, NULL, &si, &pi))
return NULL;
CloseHandle(pi.hThread);
return pi.hProcess;
@@ -189,31 +190,31 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath)
extern "C" {
#endif
-// entry point for RunDll32, this is also WaitForDDEW
-__declspec(dllexport) void CALLBACK WaitForDDE(HWND,HINSTANCE,TCHAR *pszCmdLine,int)
-{
- HANDLE pHandles[2];
- DWORD dwTick;
-
- /* wait for dde window to be available (avoiding race condition) */
- pHandles[0]=CreateEvent(NULL,TRUE,FALSE,WNDCLASS_DDEMSGWINDOW);
- if(pHandles[0]!=NULL) {
- pHandles[1]=StartupMainProcess(pszCmdLine); /* obeys nCmdShow using GetStartupInfo() */
- if(pHandles[1]!=NULL) {
- dwTick=GetTickCount();
- /* either process terminated or dde window created */
- if(WaitForMultipleObjects(_countof(pHandles),pHandles,FALSE,DDEMESSAGETIMEOUT)==WAIT_OBJECT_0) {
- dwTick=GetTickCount()-dwTick;
- if(dwTick<DDEMESSAGETIMEOUT)
- WaitForInputIdle(pHandles[1],DDEMESSAGETIMEOUT-dwTick);
+ // entry point for RunDll32, this is also WaitForDDEW
+ __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, TCHAR *pszCmdLine, int)
+ {
+ HANDLE pHandles[2];
+ DWORD dwTick;
+
+ /* wait for dde window to be available (avoiding race condition) */
+ pHandles[0] = CreateEvent(NULL, TRUE, FALSE, WNDCLASS_DDEMSGWINDOW);
+ if (pHandles[0] != NULL) {
+ pHandles[1] = StartupMainProcess(pszCmdLine); /* obeys nCmdShow using GetStartupInfo() */
+ if (pHandles[1] != NULL) {
+ dwTick = GetTickCount();
+ /* either process terminated or dde window created */
+ if (WaitForMultipleObjects(_countof(pHandles), pHandles, FALSE, DDEMESSAGETIMEOUT) == WAIT_OBJECT_0) {
+ dwTick = GetTickCount() - dwTick;
+ if (dwTick < DDEMESSAGETIMEOUT)
+ WaitForInputIdle(pHandles[1], DDEMESSAGETIMEOUT - dwTick);
+ }
+ CloseHandle(pHandles[1]);
}
- CloseHandle(pHandles[1]);
+ CloseHandle(pHandles[0]);
}
- CloseHandle(pHandles[0]);
+ /* shell called WaitForInputIdle() on us to detect when dde is ready,
+ * we are ready now: exit helper process */
}
- /* shell called WaitForInputIdle() on us to detect when dde is ready,
- * we are ready now: exit helper process */
-}
#ifdef __cplusplus
}
@@ -221,35 +222,35 @@ __declspec(dllexport) void CALLBACK WaitForDDE(HWND,HINSTANCE,TCHAR *pszCmdLine,
/************************* Misc ***********************************/
-static int DdePreShutdown(WPARAM,LPARAM)
+static int DdePreShutdown(WPARAM, LPARAM)
{
/* dde needs to be stopped before any plugins are unloaded */
- if(hwndDdeMsg!=NULL) DestroyWindow(hwndDdeMsg);
- UnregisterClass(WNDCLASS_DDEMSGWINDOW,hInst);
+ if (hwndDdeMsg != NULL) DestroyWindow(hwndDdeMsg);
+ UnregisterClass(WNDCLASS_DDEMSGWINDOW, hInst);
return 0;
}
-static int DdeModulesLoaded2(WPARAM,LPARAM)
+static int DdeModulesLoaded2(WPARAM, LPARAM)
{
/* create message window */
WNDCLASS wcl;
- wcl.lpfnWndProc=DdeMessageWindow;
- wcl.cbClsExtra=0;
- wcl.cbWndExtra=0;
- wcl.hInstance=hInst;
- wcl.hCursor=NULL;
- wcl.lpszClassName=WNDCLASS_DDEMSGWINDOW;
- wcl.hbrBackground=NULL;
- wcl.hIcon=NULL;
- wcl.lpszMenuName=NULL;
- wcl.style=0;
+ wcl.lpfnWndProc = DdeMessageWindow;
+ wcl.cbClsExtra = 0;
+ wcl.cbWndExtra = 0;
+ wcl.hInstance = hInst;
+ wcl.hCursor = NULL;
+ wcl.lpszClassName = WNDCLASS_DDEMSGWINDOW;
+ wcl.hbrBackground = NULL;
+ wcl.hIcon = NULL;
+ wcl.lpszMenuName = NULL;
+ wcl.style = 0;
RegisterClass(&wcl);
/* Note: use of HWND_MESSAGE does not fit for DDE as the window must be a top-level one */
- hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW,NULL,0,0,0,0,0,NULL,NULL,hInst,NULL);
+ hwndDdeMsg = CreateWindow(WNDCLASS_DDEMSGWINDOW, NULL, 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
/* make known dde startup code is passed */
- HANDLE hEvent=OpenEvent(EVENT_MODIFY_STATE,FALSE,WNDCLASS_DDEMSGWINDOW);
- if(hEvent!=NULL) {
+ HANDLE hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, WNDCLASS_DDEMSGWINDOW);
+ if (hEvent != NULL) {
SetEvent(hEvent);
CloseHandle(hEvent);
}
@@ -260,19 +261,19 @@ static int DdeModulesLoaded2(WPARAM,LPARAM)
return 0;
}
-static int DdeModulesLoaded(WPARAM,LPARAM)
+static int DdeModulesLoaded(WPARAM, LPARAM)
{
/* dde needs to be loaded after all the other plugins got loaded,
* hook again to get the latest position in chain */
UnhookEvent(hHookModulesLoaded);
- hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,DdeModulesLoaded2);
+ hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, DdeModulesLoaded2);
return 0;
}
void InitDde(void)
{
- hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,DdeModulesLoaded);
- hHookPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,DdePreShutdown);
+ hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, DdeModulesLoaded);
+ hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, DdePreShutdown);
}
void UninitDde(void)
@@ -280,4 +281,3 @@ void UninitDde(void)
UnhookEvent(hHookModulesLoaded);
UnhookEvent(hHookPreShutdown);
}
-
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index a032cf2454..6100ca79d4 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -83,7 +83,7 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
case WM_INITDIALOG:
g_hDlgPass = hDlg;
hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DLGPASSWD));
- dwOldIcon = SetClassLongPtr(hDlg, GCLP_HICON, (LONG)hIcon); // set alt+tab icon
+ dwOldIcon = SetClassLongPtr(hDlg, GCLP_HICON, (INT_PTR)hIcon); // set alt+tab icon
SendDlgItemMessage(hDlg, IDC_EDIT1, EM_LIMITTEXT, MAXPASSLEN, 0);
if (IsAeroMode())
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index a3244218a4..f28def0cbd 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -333,7 +333,7 @@ LBL_Def:
if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
- hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
+ hSelItem = (UINT_PTR)pcli->pfnContactToHItem(selcontact);
pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0);
recalcScrollBar = 1;
FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL);
@@ -350,7 +350,7 @@ LBL_Def:
break;
if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed
if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
- hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
+ hSelItem = (UINT_PTR)pcli->pfnContactToHItem(selcontact);
pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0);
contactRemoved = TRUE;
recalcScrollBar = 1;
diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp
index d4f49e2cd3..289c79e18d 100644
--- a/plugins/Clist_nicer/src/clcidents.cpp
+++ b/plugins/Clist_nicer/src/clcidents.cpp
@@ -66,8 +66,8 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact,
if (nowVisible)
index++;
if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) ||
- (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (MCONTACT)hItem) ||
- (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (MCONTACT)((UINT_PTR)hItem & ~HCONTACT_ISINFO))) {
+ (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (UINT_PTR)hItem) ||
+ (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == ((UINT_PTR)hItem & ~HCONTACT_ISINFO))) {
if (isVisible) {
if (!nowVisible)
*isVisible = 0;
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index 35530e8ec0..05f8c0e839 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -1286,7 +1286,7 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account
void __cdecl OpenMessageWindowThread(void *data)
{
- MCONTACT hContact = (MCONTACT)data;
+ MCONTACT hContact = (UINT_PTR)data;
if (hContact) {
CallServiceSync(MS_MSG_SENDMESSAGET, hContact, 0);
}
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index 92144dcb05..0f07fb1934 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -319,7 +319,7 @@ int FindMatchA(const char *text, char *search, int options)
return (options & F_CASE) ? !strcmp(text, search) : !stricmp(text, search);
// on empty string strstr() returns full string while StrStrI() returns NULL
- return (options & F_CASE) ? (int)strstr(text, search) : (int)StrStrIA(text, search);
+ return (options & F_CASE) ? (INT_PTR)strstr(text, search) : (INT_PTR)StrStrIA(text, search);
}
@@ -332,7 +332,7 @@ int FindMatchW(const WCHAR *text, WCHAR *search, int options)
return (options & F_CASE) ? !wcscmp(text, search) : !wcsicmp(text, search);
// on empty string strstr() returns full string while StrStrI() returns NULL
- return (options & F_CASE) ? (int)wcsstr(text, search) : (int)StrStrIW(text, search);
+ return (options & F_CASE) ? (INT_PTR)wcsstr(text, search) : (INT_PTR)StrStrIW(text, search);
}
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index a150797ccb..4282a362d1 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -119,8 +119,7 @@ void __stdcall EnableTabSrmmButtonSync(void *arg)
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.bbbFlags = BBSF_RELEASED;
- MCONTACT hContact = (MCONTACT)arg;
- CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd);
+ CallService(MS_BB_SETBUTTONSTATE, (UINT_PTR)arg, (LPARAM)&bbd);
}
int CDropbox::OnFileDialogCancelled(WPARAM, LPARAM lParam)
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp
index badc63fc33..0839e0a5d2 100644
--- a/plugins/Exchange/src/dlg_handlers.cpp
+++ b/plugins/Exchange/src/dlg_handlers.cpp
@@ -29,13 +29,13 @@ static WNDPROC OldListProc;
INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing; //true when dialog is being created
-
+
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
{
bInitializing = 1;
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
dbv.type = DBVT_ASCIIZ;
int bCheck = db_get_b(NULL, ModuleName, "Check", 1);
@@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, ModuleName, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL) db_get_b(NULL, ModuleName, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)db_get_b(NULL, ModuleName, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPT)); //disable the popups checkbox if no popup module is present
CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED);
@@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck);
int retries = db_get_b(NULL, ModuleName, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
- SetDlgItemInt(hWnd,IDC_MAX_RETRIES,retries,FALSE);
+ SetDlgItemInt(hWnd, IDC_MAX_RETRIES, retries, FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT));
@@ -104,7 +104,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
@@ -121,17 +121,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
db_set_ts(NULL, ModuleName, "Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd,IDC_PORT_EDIT,NULL,FALSE));
+ db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, NULL, FALSE));
- db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd,IDC_INTERVAL_EDIT,NULL,FALSE));
- db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd,IDC_RECONNECT_INTERVAL,NULL,FALSE));
+ db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, NULL, FALSE));
db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd,IDC_MAX_RETRIES,NULL,FALSE));
+ db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, NULL, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
@@ -165,7 +165,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYDOWN:
if (wParam == 'X')
- SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
break;
@@ -192,9 +192,9 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
{
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hiMailIcon);
- LVCOLUMN col = {0};
+ LVCOLUMN col = { 0 };
HWND hList = GetDlgItem(hWnd, IDC_EMAILS_LIST);
- OldListProc = (WNDPROC) SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR) ListSubclassProc);
+ OldListProc = (WNDPROC)SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR)ListSubclassProc);
ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.cx = 100;
@@ -223,8 +223,8 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
HWND hList = GetDlgItem(hWnd, IDC_EMAILS_LIST);
ListView_DeleteAllItems(hList);
int count = GetWindowLongPtr(hWnd, GWLP_USERDATA);
- LVITEM item = {0};
- TEmailHeader email = {0};
+ LVITEM item = { 0 };
+ TEmailHeader email = { 0 };
email.cbSize = sizeof(TEmailHeader);
TCHAR sender[1024] = _T("");
TCHAR subject[1024] = _T("");
@@ -235,8 +235,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
email.szSubject = subject;
item.mask = LVIF_TEXT;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
exchangeServer.GetEmailHeader(i, &email);
item.iItem = i;
item.iSubItem = 0;
@@ -268,7 +267,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
{
HDWP hdWnds = BeginDeferWindowPos(3);
RECT rParent;
- WINDOWPOS *wndPos = (WINDOWPOS *) lParam;
+ WINDOWPOS *wndPos = (WINDOWPOS *)lParam;
if ((!wndPos) || (wndPos->flags & SWP_NOSIZE))
break;
@@ -299,7 +298,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
for (int i = 0; i < count; i++) {
if (ListView_GetCheckState(hList, i)) {
TCHAR emailID[2048]; //uhh ohh
- LVITEM item = {0};
+ LVITEM item = { 0 };
item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 2;
@@ -310,8 +309,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
}
}
count = exchangeServer.GetUnreadEmailsCount();
- if (count > 0)
- {
+ if (count > 0) {
SetWindowLongPtr(hWnd, GWLP_USERDATA, count);
SendMessage(hWnd, EXM_UPDATE_EMAILS, 0, 0);
}
@@ -330,12 +328,10 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
switch (HIWORD(wParam)) {
case STN_CLICKED:
- {
- int count = (int) PUGetPluginData(hWnd);
- ShowEmailsWindow(count);
- PUDeletePopup(hWnd);
- break;
- }
+ int count = (INT_PTR)PUGetPluginData(hWnd);
+ ShowEmailsWindow(count);
+ PUDeletePopup(hWnd);
+ break;
}
break;
@@ -344,4 +340,4 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
-} \ No newline at end of file
+}
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp
index 32a7a79c01..97589f181f 100644
--- a/plugins/Exchange/src/utils.cpp
+++ b/plugins/Exchange/src/utils.cpp
@@ -86,7 +86,7 @@ char *BinToHex(int size, PBYTE data)
{
char *szresult = NULL;
int maxSize = size * 2 + HEX_SIZE + 1;
- szresult = (char *) new char[ maxSize ];
+ szresult = (char *) new char[maxSize];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
bin2hex(data, size, szresult + HEX_SIZE);
return szresult;
@@ -94,11 +94,11 @@ char *BinToHex(int size, PBYTE data)
void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData)
{
- TCHAR buffer[32] = {0};
- _tcsncpy(buffer, _T("0x"),_countof(_T("0x")));
+ TCHAR buffer[32] = { 0 };
+ _tcsncpy(buffer, _T("0x"), _countof(_T("0x")));
_tcsncpy(buffer + 2, inData, HEX_SIZE);
_stscanf(buffer, _T("%x"), &size);
- outData = (unsigned char*)new char[size*2];
+ outData = (unsigned char*)new char[size * 2];
TCHAR *tmp = inData + HEX_SIZE;
buffer[4] = '\0'; //mark the end of the string
@@ -110,7 +110,7 @@ void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData)
int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int size)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
int res = 1;
dbv.type = DBVT_ASCIIZ;
if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
@@ -204,7 +204,7 @@ void __cdecl CheckEmailWorkerThread(void *data)
{
mir_cslock lck(csCheck);
- int bForceAttempt = (int) data;
+ int bForceAttempt = (INT_PTR)data;
if (!exchangeServer.IsConnected())
exchangeServer.Connect(bForceAttempt);
@@ -222,9 +222,9 @@ int ThreadCheckEmail(int bForceAttempt)
void _popupUtil(TCHAR* szMsg)
{
- POPUPDATAT ppd = {0};
+ POPUPDATAT ppd = { 0 };
ppd.lchIcon = hiMailIcon;
- _tcsncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME-1);
- _tcsncpy(ppd.lptzText, szMsg,MAX_SECONDLINE-1);
+ _tcsncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME - 1);
+ _tcsncpy(ppd.lptzText, szMsg, MAX_SECONDLINE - 1);
PUAddPopupT(&ppd); //show a popup to tell the user what we're doing.
}
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp
index 1605aade4f..ea979685fa 100644
--- a/plugins/FavContacts/src/menu.cpp
+++ b/plugins/FavContacts/src/menu.cpp
@@ -472,7 +472,7 @@ int ShowMenu(bool centered)
szColumn.cx = szColumn.cy = 0;
}
- int groupID = -((int)Clist_GroupExists(favList[i]->getGroup()) + 1);
+ int groupID = -((INT_PTR)Clist_GroupExists(favList[i]->getGroup()) + 1);
AppendMenu(hMenu,
MF_OWNERDRAW | MF_SEPARATOR | ((prevGroup && g_Options.bUseColumns) ? MF_MENUBREAK : 0),
diff --git a/plugins/FavContacts/src/options.cpp b/plugins/FavContacts/src/options.cpp
index aa895c4856..39d0578537 100644
--- a/plugins/FavContacts/src/options.cpp
+++ b/plugins/FavContacts/src/options.cpp
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
break;
case CLN_NEWCONTACT:
- iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem;
+ iSelection = (INT_PTR)((NMCLISTCONTROL *)lParam)->hItem;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0) == iSelection) {
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK, iSelection,
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
break;
case CLN_CHECKCHANGED:
- iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem;
+ iSelection = (INT_PTR)((NMCLISTCONTROL *)lParam)->hItem;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0) == iSelection) {
hSelectedContact = hContact;
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index e96410aef8..3629d57510 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -649,7 +649,7 @@ void RegHotkey(MCONTACT hContact, HWND hwnd)
chKey = szKey[0];
- RegisterHotKey(hwnd, (int)hwnd, nModifiers, VkKeyScan(chKey));
+ RegisterHotKey(hwnd, (INT_PTR)hwnd, nModifiers, VkKeyScan(chKey));
}
}
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp
index 227c514ed2..d9a0151797 100644
--- a/plugins/HistoryStats/src/bandctrlimpl.cpp
+++ b/plugins/HistoryStats/src/bandctrlimpl.cpp
@@ -18,7 +18,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam,
switch (msg) {
case WM_NCCREATE:
- pCtrl = new BandCtrlImpl(hWnd, reinterpret_cast<int>(reinterpret_cast<CREATESTRUCT*>(lParam)->hMenu));
+ pCtrl = new BandCtrlImpl(hWnd, reinterpret_cast<INT_PTR>(reinterpret_cast<CREATESTRUCT*>(lParam)->hMenu));
SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(pCtrl));
return TRUE;
@@ -186,7 +186,7 @@ void BandCtrlImpl::unregisterClass()
UnregisterClass(m_ClassName, g_hInst);
}
-BandCtrlImpl::BandCtrlImpl(HWND hWnd, int nOwnId) :
+BandCtrlImpl::BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(NULL),
m_hTheme(NULL), m_hImageList(NULL), m_hImageListD(NULL), m_hTooltip(NULL),
m_nCurHot(-1), m_nCurFocused(-1), m_nCurPressed(-1), m_bCurPressedDD(false),
@@ -624,7 +624,7 @@ void BandCtrlImpl::recalcButtonRects()
if (!m_hTooltip)
m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL);
- TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, i + 1, m_Items[i].rItem, NULL,
+ TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, NULL,
const_cast<TCHAR*>(m_Items[i].tooltip.c_str()), // lpszText
};
diff --git a/plugins/HistoryStats/src/bandctrlimpl.h b/plugins/HistoryStats/src/bandctrlimpl.h
index 31320a9e40..a9df939a00 100644
--- a/plugins/HistoryStats/src/bandctrlimpl.h
+++ b/plugins/HistoryStats/src/bandctrlimpl.h
@@ -43,25 +43,26 @@ public:
static void unregisterClass();
private:
- HWND m_hWnd;
- int m_nOwnId;
- HFONT m_hFont;
- HTHEME m_hTheme;
- std::vector<ItemData> m_Items;
+ HWND m_hWnd;
+ UINT_PTR m_nOwnId;
+ HFONT m_hFont;
+ HTHEME m_hTheme;
HIMAGELIST m_hImageList;
HIMAGELIST m_hImageListD;
- SIZE m_IconSize;
- HWND m_hTooltip;
- int m_nCurHot;
- int m_nCurFocused;
- int m_nCurPressed;
- bool m_bCurPressedDD;
- int m_nLayout;
- int m_nDDWidth;
- HICON m_hDDIcon;
+ SIZE m_IconSize;
+ HWND m_hTooltip;
+ int m_nCurHot;
+ int m_nCurFocused;
+ int m_nCurPressed;
+ bool m_bCurPressedDD;
+ int m_nLayout;
+ int m_nDDWidth;
+ HICON m_hDDIcon;
+
+ std::vector<ItemData> m_Items;
private:
- explicit BandCtrlImpl(HWND hWnd, int nOwnId);
+ explicit BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId);
~BandCtrlImpl();
private:
diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp
index 0bbeb29b7f..4943be405d 100644
--- a/plugins/HistoryStats/src/dlgfilterwords.cpp
+++ b/plugins/HistoryStats/src/dlgfilterwords.cpp
@@ -155,7 +155,7 @@ void DlgFilterWords::onSetAdd()
m_Filters.push_back(pFilter);
- HANDLE hAdded = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast<DWORD>(pFilter));
+ HANDLE hAdded = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast<UINT_PTR>(pFilter));
m_Sets.selectItem(hAdded);
}
diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp
index 09208fa6d0..88a3cec5c7 100644
--- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp
@@ -120,7 +120,7 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA
SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
- return reinterpret_cast<BOOL>(GetSysColorBrush(COLOR_WINDOW));
+ return reinterpret_cast<INT_PTR>(GetSysColorBrush(COLOR_WINDOW));
}
break;
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp
index 71929f166f..2687e385a7 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp
@@ -25,8 +25,8 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar
pCS->style |= WS_CHILD;
pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE);
- pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<int>(pCS->hMenu));
- SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(pCtrl));
+ pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<INT_PTR>(pCS->hMenu));
+ SetWindowLongPtr(hWnd, 0, reinterpret_cast<INT_PTR>(pCtrl));
}
return pCtrl ? TRUE : FALSE;
@@ -415,7 +415,7 @@ void OptionsCtrlImpl::unregisterClass()
UnregisterClass(m_ClassName, g_hInst);
}
-OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, int nOwnId) :
+OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(NULL), m_pfnOldTreeProc(NULL), m_bModified(true), m_hDragItem(NULL)
{
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.h b/plugins/HistoryStats/src/optionsctrlimpl.h
index b2a2ee4d37..e931aa8933 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl.h
+++ b/plugins/HistoryStats/src/optionsctrlimpl.h
@@ -359,15 +359,15 @@ public:
static void unregisterClass();
private:
- HWND m_hWnd;
- int m_nOwnId;
- HWND m_hTree;
- WNDPROC m_pfnOldTreeProc;
- bool m_bModified;
+ HWND m_hWnd;
+ UINT_PTR m_nOwnId;
+ HWND m_hTree;
+ WNDPROC m_pfnOldTreeProc;
+ bool m_bModified;
HTREEITEM m_hDragItem;
private:
- explicit OptionsCtrlImpl(HWND hWnd, int nOwnId);
+ explicit OptionsCtrlImpl(HWND hWnd, UINT_PTR nOwnId);
explicit OptionsCtrlImpl(const OptionsCtrlImpl& other); // no implementation
const OptionsCtrlImpl& operator =(const OptionsCtrlImpl& other); // no implementation
~OptionsCtrlImpl();
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp
index ebbcb9a86d..cdce105537 100644
--- a/plugins/HistorySweeperLight/src/options.cpp
+++ b/plugins/HistorySweeperLight/src/options.cpp
@@ -163,7 +163,7 @@ void SaveSettings(HWND hwndDlg)
}
for (int i = 0; i < g_hWindows.getCount(); i++)
- SetSrmmIcon(MCONTACT(g_hWindows[i]));
+ SetSrmmIcon(UINT_PTR(g_hWindows[i]));
// set tooltips
int st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 21936d2049..f0d217e5da 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -733,7 +733,7 @@ INT_PTR onIgnore(WPARAM wparam, LPARAM lparam)
return 0;
}
-static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param)
+static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, INT_PTR param)
{
CMenuItem mi;
mi.root = hRoot;
@@ -879,7 +879,7 @@ int EnumProtoSubmenu(WPARAM, LPARAM)
{
hProtoItem[i] = AddSubmenuItem(hmenuProto, accs[i]->tszAccountName,
Skin_LoadProtoIcon(accs[i]->szModuleName, ID_STATUS_ONLINE), CMIF_SYSTEM | CMIF_KEEPUNTRANSLATED,
- MS_PROTO, pos++, (int)accs[i]->szModuleName);
+ MS_PROTO, pos++, (INT_PTR)accs[i]->szModuleName);
}
return 0;
}
@@ -993,7 +993,7 @@ static int PluginInit(WPARAM, LPARAM)
ood.cbSize = sizeof(ood);
ood.pszGroup = "Contacts";
ood.pszPage = "Ignore";
- AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), IcoLib_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood);
+ AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), IcoLib_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (INT_PTR)&ood);
mi.position++;
mi.name.t = LPGENT("Copy to Account");
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index b5bb5a0fd6..f442e52536 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -143,7 +143,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_
// targetHandleSzProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hSubContact, 0);
// }
- char *targetHandleSzProto = GetContactProto((MCONTACT)args->targetHandle); //targetHandleSzProto doesnt need mir_free or delete
+ char *targetHandleSzProto = GetContactProto((UINT_PTR)args->targetHandle); //targetHandleSzProto doesnt need mir_free or delete
if (targetHandleSzProto == NULL){
logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandleSzProto == NULL");
return;
@@ -153,7 +153,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_
std::size_t bufSize = strlen(msgBuffer) + 1;
logger->log_p(L"SMTC: bufSize = [%d]", bufSize);
- HANDLE hProcess = sendMessageMiranda((MCONTACT)args->targetHandle, msgBuffer);
+ HANDLE hProcess = sendMessageMiranda((UINT_PTR)args->targetHandle, msgBuffer);
logger->log_p(L"SMTC: hProcess = [" SCNuPTR L"]", hProcess);
MIRFOXACKDATA* myMfAck = NULL;
@@ -184,7 +184,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_
logger->log_p(L"SMTC: ACK found counter = [%d] myMfAck = [" SCNuPTR L"]", counter, myMfAck);
}
- MirandaContact* mirandaContact = args->mirfoxDataPtr->getMirandaContactPtrByHandle((MCONTACT)args->targetHandle);
+ MirandaContact* mirandaContact = args->mirfoxDataPtr->getMirandaContactPtrByHandle((UINT_PTR)args->targetHandle);
const wchar_t* contactNameW = NULL;
TCHAR* tszAccountName = NULL;
if (mirandaContact){
@@ -194,7 +194,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_
tszAccountName = mirandaAccount->tszAccountName;
}
if(myMfAck != NULL && myMfAck->result == ACKRESULT_SUCCESS){
- addMessageToDB((MCONTACT)args->targetHandle, msgBuffer, bufSize, targetHandleSzProto);
+ addMessageToDB((UINT_PTR)args->targetHandle, msgBuffer, bufSize, targetHandleSzProto);
if (mode == MFENUM_SMM_ONLY_SEND){
//show notyfication popup (only in SMM_ONLY_SEND mode)
wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
@@ -342,12 +342,12 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam)
MessageWindowData mwd;
mwd.cbSize = sizeof(MessageWindowData);
- mwd.hContact = (MCONTACT)param->targetHandle;
+ mwd.hContact = (UINT_PTR)param->targetHandle;
mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
MessageWindowInputData mwid;
mwid.cbSize = sizeof(MessageWindowInputData);
- mwid.hContact = (MCONTACT)param->targetHandle;
+ mwid.hContact = (UINT_PTR)param->targetHandle;
mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
delete param;
diff --git a/plugins/MirLua/src/m_windows.cpp b/plugins/MirLua/src/m_windows.cpp
index be943ffad4..9aee495b44 100644
--- a/plugins/MirLua/src/m_windows.cpp
+++ b/plugins/MirLua/src/m_windows.cpp
@@ -238,11 +238,11 @@ static int lua_GetRegValue(lua_State *L)
{
case REG_DWORD:
case REG_DWORD_BIG_ENDIAN:
- lua_pushinteger(L, (int)value);
+ lua_pushinteger(L, (INT_PTR)value);
break;
case REG_QWORD:
- lua_pushnumber(L, (int)value);
+ lua_pushnumber(L, (INT_PTR)value);
break;
case REG_SZ:
diff --git a/plugins/MirOTR/Libgpg-error/estream.c b/plugins/MirOTR/Libgpg-error/estream.c
index 42609ee6eb..f4bda2a1c0 100644
--- a/plugins/MirOTR/Libgpg-error/estream.c
+++ b/plugins/MirOTR/Libgpg-error/estream.c
@@ -4168,7 +4168,7 @@ tmpfd (void)
#ifdef HAVE_W32CE_SYSTEM
int fd = (int)file;
#else
- int fd = _open_osfhandle ((long)file, 0);
+ int fd = _open_osfhandle((INT_PTR)file, 0);
if (fd == -1)
{
CloseHandle (file);
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index 1f349a4c22..354a25e00d 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -202,7 +202,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam)
ConnContext *context = otr_user_state->context_root;
while (context) {
if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || mir_strcmp(proto, context->protocol) == 0)) {
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
if (hContact) {
otrl_message_disconnect(otr_user_state, &ops, (void*)hContact, context->accountname, context->protocol, context->username, OTRL_INSTAG_BEST);
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index 76a690976e..898cffe408 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -1,6 +1,7 @@
#include "stdafx.h"
-struct SmpData {
+struct SmpData
+{
HWND dialog;
TrustLevel oldlevel;
ConnContext *context;
@@ -13,23 +14,23 @@ SmpForContactMap smp_for_contact;
INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
- case WM_DESTROY:{
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if(context)
- otr_abort_smp(context);
- break;}
+ switch (msg) {
+ case WM_DESTROY: {
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (context)
+ otr_abort_smp(context);
+ break; }
case WM_INITDIALOG:
{
if (!lParam) {
DestroyWindow(hwndDlg);
return FALSE;
}
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
SmpData *data = (SmpData*)lParam;
ConnContext *context = data->context;
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
data->dialog = hwndDlg;
//smp_for_contact.insert(SmpForContactMap::value_type(context->app_data, *data));
if (smp_for_contact[context->app_data].dialog) SendMessage(smp_for_contact[context->app_data].dialog, WMU_REFRESHSMP, 0, 0);
@@ -40,7 +41,7 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
mir_free(data);
TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact));
- const TCHAR *name =contact_get_nameT(hContact);
+ const TCHAR *name = contact_get_nameT(hContact);
mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_PROGRESS_TITLE), name, proto);
SetWindowText(hwndDlg, title);
mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_PROGRESS_DESC), name, proto);
@@ -51,32 +52,31 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
// Move window to screen center
// Get the owner window and dialog box rectangles.
HWND hwndOwner; RECT rcOwner, rcDlg, rc;
- if ((hwndOwner = GetParent(hwndDlg)) == NULL)
- {
- hwndOwner = GetDesktopWindow();
+ if ((hwndOwner = GetParent(hwndDlg)) == NULL) {
+ hwndOwner = GetDesktopWindow();
}
- GetWindowRect(hwndOwner, &rcOwner);
- GetWindowRect(hwndDlg, &rcDlg);
- CopyRect(&rc, &rcOwner);
+ GetWindowRect(hwndOwner, &rcOwner);
+ GetWindowRect(hwndDlg, &rcDlg);
+ CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that right and bottom
// values represent the width and height, and then offset the owner again
// to discard space taken up by the dialog box.
- OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect(&rc, -rc.left, -rc.top);
- OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+ OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect(&rc, -rc.left, -rc.top);
+ OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
// The new position is the sum of half the remaining space and the owner's
// original position.
- SetWindowPos(hwndDlg,
- HWND_TOP,
- rcOwner.left + (rc.right / 2),
- rcOwner.top + (rc.bottom / 2),
+ SetWindowPos(hwndDlg,
+ HWND_TOP,
+ rcOwner.left + (rc.right / 2),
+ rcOwner.top + (rc.bottom / 2),
0, 0, // Ignores size arguments.
- SWP_NOSIZE);
+ SWP_NOSIZE);
// end center dialog
@@ -94,50 +94,50 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SendDlgItemMessage(hwndDlg, IDC_PGB_SMP, PBM_SETPOS, wParam, 0);
switch (wParam) {
- case 0:
+ case 0:
+ EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_ERROR));
+ smp_for_contact.erase(context->app_data);
+ break;
+ case 100:
+ {
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), false);
EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_ERROR));
smp_for_contact.erase(context->app_data);
- break;
- case 100:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), false);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
- smp_for_contact.erase(context->app_data);
- if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
- if (context->active_fingerprint->trust && context->active_fingerprint->trust[0]) {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS));
- }
- else {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS_VERIFY));
- }
+ if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
+ if (context->active_fingerprint->trust && context->active_fingerprint->trust[0]) {
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS));
}
else {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_FAILED));
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS_VERIFY));
}
}
- break;
- default:
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, _T(""));
+ else {
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_FAILED));
+ }
+ }
+ break;
+ default:
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, _T(""));
}
}
break;
- case WM_COMMAND:
- switch ( HIWORD( wParam )) {
- case BN_CLICKED:
- {
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch ( LOWORD( wParam )) {
- case IDOK:
- smp_for_contact.erase(context->app_data);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL);
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
- }break;
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ smp_for_contact.erase(context->app_data);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL);
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ }break;
}
}
@@ -145,34 +145,35 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
return FALSE;
}
-void SMPInitUpdateDialog(ConnContext *context, bool responder) {
+void SMPInitUpdateDialog(ConnContext *context, bool responder)
+{
if (!context) return;
SmpData *data = (SmpData*)mir_calloc(sizeof(SmpData));
data->context = context;
data->oldlevel = otr_context_get_trust(context);
data->responder = responder;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), 0, DlgSMPUpdateProc, (LPARAM) data);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), 0, DlgSMPUpdateProc, (LPARAM)data);
}
INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
- case WM_DESTROY:{
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if(context)
- otr_abort_smp(context);
- break;}
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_DESTROY: {
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (context)
+ otr_abort_smp(context);
+ break; }
+ case WM_INITDIALOG:
{
if (!lParam) {
DestroyWindow(hwndDlg);
return FALSE;
}
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
SmpData *data = (SmpData*)lParam;
ConnContext *context = data->context;
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
data->dialog = hwndDlg;
//smp_for_contact.insert(SmpForContactMap::value_type(context->app_data, *data));
if (smp_for_contact[context->app_data].dialog) SendMessage(smp_for_contact[context->app_data].dialog, WMU_REFRESHSMP, 0, 0);
@@ -207,7 +208,8 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
mir_free(data->question);
- } else {
+ }
+ else {
mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT(hContact));
SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
@@ -230,51 +232,50 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// Move window to screen center
// Get the owner window and dialog box rectangles.
HWND hwndOwner; RECT rcOwner, rcDlg, rc;
- if ((hwndOwner = GetParent(hwndDlg)) == NULL)
- {
- hwndOwner = GetDesktopWindow();
+ if ((hwndOwner = GetParent(hwndDlg)) == NULL) {
+ hwndOwner = GetDesktopWindow();
}
- GetWindowRect(hwndOwner, &rcOwner);
- GetWindowRect(hwndDlg, &rcDlg);
- CopyRect(&rc, &rcOwner);
+ GetWindowRect(hwndOwner, &rcOwner);
+ GetWindowRect(hwndDlg, &rcDlg);
+ CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that right and bottom
// values represent the width and height, and then offset the owner again
// to discard space taken up by the dialog box.
- OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect(&rc, -rc.left, -rc.top);
- OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+ OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect(&rc, -rc.left, -rc.top);
+ OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
// The new position is the sum of half the remaining space and the owner's
// original position.
- SetWindowPos(hwndDlg,
- HWND_TOP,
- rcOwner.left + (rc.right / 2),
- rcOwner.top + (rc.bottom / 2),
+ SetWindowPos(hwndDlg,
+ HWND_TOP,
+ rcOwner.left + (rc.right / 2),
+ rcOwner.top + (rc.bottom / 2),
0, 0, // Ignores size arguments.
- SWP_NOSIZE);
+ SWP_NOSIZE);
// end center dialog
-
-
+
+
return TRUE;
}
- case WM_COMMAND:
- switch ( HIWORD( wParam )) {
- case BN_CLICKED:
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
ConnContext *context = (ConnContext *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK:
SMPInitUpdateDialog(context, true);
- {
+ {
int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
- TCHAR *answer = new TCHAR[len+1];
- GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
+ TCHAR *answer = new TCHAR[len + 1];
+ GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1);
T2Utf ans(answer);
otr_continue_smp(context, (const unsigned char *)ans, mir_strlen(ans));
@@ -311,14 +312,14 @@ void SMPInitResponseDialog(ConnContext *context, const TCHAR *question) {
INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
if (!lParam) {
DestroyWindow(hwndDlg);
return FALSE;
}
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
ConnContext *context = (ConnContext*)lParam;
if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
@@ -326,7 +327,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact));
mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto);
mir_free(proto);
@@ -337,32 +338,31 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// Move window to screen center
// Get the owner window and dialog box rectangles.
HWND hwndOwner; RECT rcOwner, rcDlg, rc;
- if ((hwndOwner = GetParent(hwndDlg)) == NULL)
- {
- hwndOwner = GetDesktopWindow();
+ if ((hwndOwner = GetParent(hwndDlg)) == NULL) {
+ hwndOwner = GetDesktopWindow();
}
- GetWindowRect(hwndOwner, &rcOwner);
- GetWindowRect(hwndDlg, &rcDlg);
- CopyRect(&rc, &rcOwner);
+ GetWindowRect(hwndOwner, &rcOwner);
+ GetWindowRect(hwndDlg, &rcDlg);
+ CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that right and bottom
// values represent the width and height, and then offset the owner again
// to discard space taken up by the dialog box.
- OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect(&rc, -rc.left, -rc.top);
- OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+ OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect(&rc, -rc.left, -rc.top);
+ OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
// The new position is the sum of half the remaining space and the owner's
// original position.
- SetWindowPos(hwndDlg,
- HWND_TOP,
- rcOwner.left + (rc.right / 2),
- rcOwner.top + (rc.bottom / 2),
+ SetWindowPos(hwndDlg,
+ HWND_TOP,
+ rcOwner.left + (rc.right / 2),
+ rcOwner.top + (rc.bottom / 2),
0, 0, // Ignores size arguments.
- SWP_NOSIZE);
+ SWP_NOSIZE);
// end center dialog
@@ -374,7 +374,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessage(cmb, CB_SELECTSTRING, -1, (WPARAM)TranslateT(LANG_SMPTYPE_QUESTION));
EnableWindow(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE), TRUE);
-
+
Fingerprint *fp = context->active_fingerprint;
if (!fp) {
DestroyWindow(hwndDlg);
@@ -391,172 +391,179 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0);
SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION));
-
+
SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER));
-
+
ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
SetFocus(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE));
-
+
return FALSE;
}
- case WM_COMMAND:
- switch ( HIWORD( wParam )) {
- case BN_CLICKED:
- {
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- MCONTACT hContact = (MCONTACT)context->app_data;
- TCHAR msg[1024];
- switch ( LOWORD( wParam )) {
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- case IDOK:
- GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, msg, 255);
- if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) {
- if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
- TCHAR msg[512];
- mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
- ShowError(msg);
- }else {
- int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0);
- TCHAR *question = new TCHAR[len+1];
- GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, question, len+1);
- T2Utf quest(question);
- delete question;
-
- len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
- TCHAR *answer = new TCHAR[len+1];
- GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
- T2Utf ans(answer);
- delete answer;
-
- SMPInitUpdateDialog(context, false);
- otr_start_smp(context, quest, (const unsigned char*)ans, mir_strlen(ans));
- }
-
- }else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
- if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
- TCHAR msg[512];
- mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
- ShowError(msg);
- }else {
- int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
- TCHAR *answer = new TCHAR[len+1];
- GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
- T2Utf ans(answer);
- delete[] answer;
-
- SMPInitUpdateDialog(context, false);
- otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans));
- }
-
- }else break;
- DestroyWindow(hwndDlg);
- break;
- case IDYES:
- VerifyFingerprint(context, true);
- DestroyWindow(hwndDlg);
- break;
- case IDNO:
- VerifyFingerprint(context, false);
- DestroyWindow(hwndDlg);
- break;
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ MCONTACT hContact = (UINT_PTR)context->app_data;
+ TCHAR msg[1024];
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ case IDOK:
+ GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, msg, 255);
+ if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_QUESTION), 255) == 0) {
+ if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
+ TCHAR msg[512];
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
+ ShowError(msg);
}
+ else {
+ int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0);
+ TCHAR *question = new TCHAR[len + 1];
+ GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, question, len + 1);
+ T2Utf quest(question);
+ delete question;
+
+ len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
+ TCHAR *answer = new TCHAR[len + 1];
+ GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1);
+ T2Utf ans(answer);
+ delete answer;
+
+ SMPInitUpdateDialog(context, false);
+ otr_start_smp(context, quest, (const unsigned char*)ans, mir_strlen(ans));
}
- break;
- case CBN_SELCHANGE:
- switch ( LOWORD( wParam )) {
- case IDC_CBO_SMP_CHOOSE:
- {
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- MCONTACT hContact = (MCONTACT)context->app_data;
- Fingerprint *fp = context->active_fingerprint;
- if (!fp) {
- DestroyWindow(hwndDlg);
- return TRUE;
- }
- BOOL trusted = false;
- if (fp->trust && fp->trust[0] != '\0') trusted = true;
-
- TCHAR buff[512];
- GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255);
- if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) {
- if (trusted)
- mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact));
- else
- mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact));
-
- SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
-
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION));
-
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER));
-
-
- ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
- ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
- } else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
- if (trusted)
- mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact));
- else
- mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact));
-
- SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
-
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, _T(""));
-
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_PASSWORD));
-
-
- ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
- ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
- } else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_FINGERPRINT), 255)==0) {
- if (trusted)
- mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact));
- else
- mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact));
-
- SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
-
- unsigned char hash[20];
- lib_cs_lock();
- if (!otrl_privkey_fingerprint_raw(otr_user_state, hash, context->accountname, context->protocol)) {
- DestroyWindow(hwndDlg);
- return FALSE;
- }
- otrl_privkey_hash_to_humanT(buff, hash);
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff);
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY));
-
- otrl_privkey_hash_to_humanT(buff, fp->fingerprint);
- SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff);
- SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0);
- SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT));
-
- ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA);
- ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_SHOWNA);
-
- }
- }break;
+
+ }
+ else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255) == 0) {
+ if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
+ TCHAR msg[512];
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
+ ShowError(msg);
+ }
+ else {
+ int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
+ TCHAR *answer = new TCHAR[len + 1];
+ GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1);
+ T2Utf ans(answer);
+ delete[] answer;
+
+ SMPInitUpdateDialog(context, false);
+ otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans));
+ }
+
+ }
+ else break;
+ DestroyWindow(hwndDlg);
+ break;
+ case IDYES:
+ VerifyFingerprint(context, true);
+ DestroyWindow(hwndDlg);
+ break;
+ case IDNO:
+ VerifyFingerprint(context, false);
+ DestroyWindow(hwndDlg);
+ break;
}
+ }
+ break;
+
+ case CBN_SELCHANGE:
+ switch (LOWORD(wParam)) {
+ case IDC_CBO_SMP_CHOOSE:
+ {
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ MCONTACT hContact = (UINT_PTR)context->app_data;
+ Fingerprint *fp = context->active_fingerprint;
+ if (!fp) {
+ DestroyWindow(hwndDlg);
+ return TRUE;
+ }
+ BOOL trusted = false;
+ if (fp->trust && fp->trust[0] != '\0') trusted = true;
+
+ TCHAR buff[512];
+ GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255);
+ if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_QUESTION), 255) == 0) {
+ if (trusted)
+ mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact));
+ else
+ mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact));
+
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
+
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION));
+
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER));
+
+
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
+ ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
+ }
+ else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_PASSWORD), 255) == 0) {
+ if (trusted)
+ mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact));
+ else
+ mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact));
+
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
+
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, _T(""));
+
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_PASSWORD));
+
+
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
+ ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
+ }
+ else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_FINGERPRINT), 255) == 0) {
+ if (trusted)
+ mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact));
+ else
+ mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact));
+
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);
+
+ unsigned char hash[20];
+ lib_cs_lock();
+ if (!otrl_privkey_fingerprint_raw(otr_user_state, hash, context->accountname, context->protocol)) {
+ DestroyWindow(hwndDlg);
+ return FALSE;
+ }
+ otrl_privkey_hash_to_humanT(buff, hash);
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff);
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY));
+
+ otrl_privkey_hash_to_humanT(buff, fp->fingerprint);
+ SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff);
+ SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0);
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT));
+
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA);
+ ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_SHOWNA);
+
+ }
+ }break;
+ }
}
break;
@@ -564,19 +571,21 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-void SMPInitDialog(ConnContext *context) {
+void SMPInitDialog(ConnContext *context)
+{
if (context)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgProcSMPInitProc, (LPARAM) context);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgProcSMPInitProc, (LPARAM)context);
}
-void SMPDialogUpdate(ConnContext *context, int percent) {
+void SMPDialogUpdate(ConnContext *context, int percent)
+{
if (!context) return;
SmpForContactMap::iterator it = smp_for_contact.find(context->app_data);
if (it == smp_for_contact.end()) return;
if (it->second.dialog) PostMessage(it->second.dialog, WMU_REFRESHSMP, percent, 0);
TrustLevel level = otr_context_get_trust(context);
if (!it->second.responder && it->second.oldlevel != level) {
- if (level == TRUST_PRIVATE)
+ if (level == TRUST_PRIVATE)
VerifyFingerprintMessage(context, true);
else if (level == TRUST_UNVERIFIED)
VerifyFingerprintMessage(context, false);
@@ -597,13 +606,14 @@ void SMPDialogUpdate(ConnContext *context, int percent) {
}
*/
}
-void SMPDialogReply(ConnContext *context, const char* question){
+void SMPDialogReply(ConnContext *context, const char* question)
+{
SmpData *data = (SmpData*)mir_calloc(sizeof(SmpData));
data->context = context;
data->oldlevel = TRUST_NOT_PRIVATE;
data->responder = true;
data->question = (question) ? mir_utf8decodeT(question) : NULL;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM)data);
/*
ShowError(_T("SMP requires user password (NOT IMPL YET)"));
otr_abort_smp(context);
@@ -612,15 +622,16 @@ void SMPDialogReply(ConnContext *context, const char* question){
}
unsigned int CALLBACK verify_context_thread(void *param);
-void VerifyContextDialog(ConnContext* context) {
+void VerifyContextDialog(ConnContext* context)
+{
if (!context) return;
CloseHandle((HANDLE)_beginthreadex(0, 0, verify_context_thread, context, 0, 0));
}
INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
if (!lParam) {
EndDialog(hwndDlg, IDCANCEL);
@@ -628,43 +639,42 @@ INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam,
}
SetWindowText(hwndDlg, _T(LANG_OTR_FPVERIFY_TITLE));
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, _T(LANG_OTR_FPVERIFY_TITLE));
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
// Move window to screen center
// Get the owner window and dialog box rectangles.
HWND hwndOwner; RECT rcOwner, rcDlg, rc;
- if ((hwndOwner = GetParent(hwndDlg)) == NULL)
- {
- hwndOwner = GetDesktopWindow();
+ if ((hwndOwner = GetParent(hwndDlg)) == NULL) {
+ hwndOwner = GetDesktopWindow();
}
- GetWindowRect(hwndOwner, &rcOwner);
- GetWindowRect(hwndDlg, &rcDlg);
- CopyRect(&rc, &rcOwner);
+ GetWindowRect(hwndOwner, &rcOwner);
+ GetWindowRect(hwndDlg, &rcDlg);
+ CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that right and bottom
// values represent the width and height, and then offset the owner again
// to discard space taken up by the dialog box.
- OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect(&rc, -rc.left, -rc.top);
- OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+ OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect(&rc, -rc.left, -rc.top);
+ OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
// The new position is the sum of half the remaining space and the owner's
// original position.
- SetWindowPos(hwndDlg,
- HWND_TOP,
- rcOwner.left + (rc.right / 2),
- rcOwner.top + (rc.bottom / 2),
+ SetWindowPos(hwndDlg,
+ HWND_TOP,
+ rcOwner.left + (rc.right / 2),
+ rcOwner.top + (rc.bottom / 2),
0, 0, // Ignores size arguments.
- SWP_NOSIZE);
+ SWP_NOSIZE);
// end center dialog
ConnContext *context = (ConnContext*)lParam;
- MCONTACT hContact = (MCONTACT) context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
Fingerprint *fp = context->active_fingerprint;
if (!fp) {
EndDialog(hwndDlg, IDCANCEL);
@@ -688,7 +698,7 @@ INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam,
SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff);
SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY));
-
+
otrl_privkey_hash_to_humanT(buff, fp->fingerprint);
SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff);
SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0);
@@ -700,21 +710,20 @@ INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam,
ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA);
ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_SHOWNA);
SetFocus(GetDlgItem(hwndDlg, IDCANCEL));
-
- return FALSE;
}
+ return FALSE;
- case WM_COMMAND:
- switch ( HIWORD( wParam )) {
- case BN_CLICKED:
- switch ( LOWORD( wParam )) {
- case IDYES:
- case IDNO:
- case IDCANCEL:
- case IDOK:
- EndDialog(hwndDlg, LOWORD( wParam ));
- break;
- }
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ switch (LOWORD(wParam)) {
+ case IDYES:
+ case IDNO:
+ case IDCANCEL:
+ case IDOK:
+ EndDialog(hwndDlg, LOWORD(wParam));
+ break;
+ }
}
break;
@@ -725,33 +734,34 @@ INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam,
unsigned int CALLBACK verify_context_thread(void *param)
{
- Thread_Push( 0 );
+ Thread_Push(0);
if (param) {
ConnContext *context = (ConnContext *)param;
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
TCHAR msg[1024];
- switch ( DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgBoxProcVerifyContext, (LPARAM)param) ) {
- case IDOK:
- case IDYES:
- lib_cs_lock();
- otrl_context_set_trust(context->active_fingerprint, "verified");
- otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
- mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact));
- ShowMessage(hContact, msg);
- SetEncryptionStatus(hContact, otr_context_get_trust(context));
- break;
- case IDNO:
- lib_cs_lock();
- otrl_context_set_trust(context->active_fingerprint, NULL);
- otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
- mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
- ShowMessage(hContact, msg);
- SetEncryptionStatus(hContact, otr_context_get_trust(context));
- break;
+ switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgBoxProcVerifyContext, (LPARAM)param)) {
+ case IDOK:
+ case IDYES:
+ lib_cs_lock();
+ otrl_context_set_trust(context->active_fingerprint, "verified");
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact));
+ ShowMessage(hContact, msg);
+ SetEncryptionStatus(hContact, otr_context_get_trust(context));
+ break;
+
+ case IDNO:
+ lib_cs_lock();
+ otrl_context_set_trust(context->active_fingerprint, NULL);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
+ ShowMessage(hContact, msg);
+ SetEncryptionStatus(hContact, otr_context_get_trust(context));
+ break;
}
}
Thread_Pop();
- return 0;
+ return 0;
}
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index ef55726f0c..2c727f9fbb 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -681,7 +681,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
TCHAR *user, hash[45] = { 0 };
for (ConnContext *context = otr_user_state->context_root; context; context = context->next) {
if (context->app_data) {
- user = (TCHAR*)contact_get_nameT((MCONTACT)context->app_data);
+ user = (TCHAR*)contact_get_nameT((UINT_PTR)context->app_data);
if (user) {
PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);
@@ -746,7 +746,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
Fingerprint *fp = (Fingerprint*)lvi.lParam;
if (fp->context->active_fingerprint == fp) {
- MCONTACT hContact = (MCONTACT)fp->context->app_data;
+ MCONTACT hContact = (UINT_PTR)fp->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
@@ -777,7 +777,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
switch (it->second) {
case FPM_DELETE:
if (it->first->context->active_fingerprint == it->first) {
- MCONTACT hContact = (MCONTACT)it->first->context->app_data;
+ MCONTACT hContact = (UINT_PTR)it->first->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index 26a4a9423d..1b6ff83f83 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -81,7 +81,7 @@ extern "C" {
/* Return the OTR policy for the given context. */
OtrlPolicy otr_gui_policy(void *opdata, ConnContext *context) {
DEBUGOUT_T("OTR_GUI_POLICY\n");
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
DWORD pol;
if (hContact) {
pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
@@ -106,7 +106,7 @@ extern "C" {
DEBUGOUT_T("OTR_GUI_CREATE_PRIVKEY\n");
if (opdata) {
mir_free((char*)protocol);
- protocol = mir_strdup(GetContactProto((MCONTACT)opdata));
+ protocol = mir_strdup(GetContactProto((UINT_PTR)opdata));
}
if (!protocol) return;
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgBoxProc, (LPARAM)protocol);
@@ -121,7 +121,7 @@ extern "C" {
* logged in" errors if you're wrong. */
int otr_gui_is_logged_in(void *opdata, const char *accountname, const char *protocol, const char *recipient) {
DEBUGOUT_T("OTR_GUI_IS_LOGGED_IN\n");
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
if (hContact) {
WORD status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_OFFLINE) return 0;
@@ -135,7 +135,7 @@ extern "C" {
* accountname/protocol. */
void otr_gui_inject_message(void *opdata, const char *accountname, const char *protocol, const char *recipient, const char *message) {
DEBUGOUT_T("OTR_GUI_INJECT_MESSAGE\n");
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
if (db_get_w(hContact, protocol, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
CallContactService(hContact, PSS_MESSAGE, PREF_BYPASS_OTR, (LPARAM)message);
}
@@ -169,7 +169,7 @@ extern "C" {
/* A ConnContext has entered a secure state. */
void otr_gui_gone_secure(void *opdata, ConnContext *context) {
DEBUGOUT_T("OTR_GUI_GONE_SECURE\n");
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
TrustLevel trusted = otr_context_get_trust(context);
SetEncryptionStatus(hContact, trusted);
TCHAR buff[512];
@@ -195,7 +195,7 @@ extern "C" {
/* A ConnContext has left a secure state. */
void otr_gui_gone_insecure(void *opdata, ConnContext *context) {
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
DEBUGOUT_T("OTR_GUI_GONE_INSECURE\n");
TCHAR buff[512];
mir_sntprintf(buff, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact));
@@ -211,7 +211,7 @@ extern "C" {
/* We have completed an authentication, using the D-H keys we
* already knew. is_reply indicates whether we initiated the AKE. */
void otr_gui_still_secure(void *opdata, ConnContext *context, int is_reply) {
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
DEBUGOUT_T("OTR_GUI_STILL_SECURE\n");
TrustLevel trusted = otr_context_get_trust(context);
SetEncryptionStatus(hContact, trusted);
@@ -250,7 +250,7 @@ extern "C" {
if (context && context->protocol)
proto = context->protocol;
else
- proto = GetContactProto((MCONTACT)opdata);
+ proto = GetContactProto((UINT_PTR)opdata);
// ugly wokaround for ICQ. ICQ protocol reports more than 7k, but in SMP this is too long.
// possibly ICQ doesn't allow single words without spaces to become longer than ~2340?
if (mir_strcmp("ICQ", proto) == 0 || strncmp("ICQ_", proto, 4) == 0)
@@ -302,7 +302,7 @@ extern "C" {
void handle_msg_event(void *opdata, OtrlMessageEvent msg_event, ConnContext *context, const char *message, gcry_error_t err) {
DEBUGOUTA("HANDLE_MSG_EVENT\n");
- MCONTACT hContact = (MCONTACT)opdata;
+ MCONTACT hContact = (UINT_PTR)opdata;
const TCHAR* contact = contact_get_nameT(hContact);
typedef void(*msgfunc_t)(const MCONTACT, const TCHAR*);
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index ffdb5e33ec..94f2dc0919 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -65,7 +65,7 @@ void VerifyFingerprint(ConnContext *context, bool verify) {
}
void VerifyFingerprintMessage(ConnContext *context, bool verify) {
- MCONTACT hContact = (MCONTACT)context->app_data;
+ MCONTACT hContact = (UINT_PTR)context->app_data;
TCHAR msg[1024];
mir_sntprintf(msg, _countof(msg), (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index d0935dd0f6..2ec2cb4f48 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -1546,9 +1546,9 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam)
if (pAck->type == ACKTYPE_MESSAGE) {
list<SMessageJob*>::iterator iter = CAppletManager::GetInstance()->m_MessageJobs.begin();
while (iter != CAppletManager::GetInstance()->m_MessageJobs.end()) {
- if ((*iter)->hEvent == (MEVENT)pAck->hProcess && (*iter)->hContact == pAck->hContact) {
+ if ((*iter)->hEvent == (UINT_PTR)pAck->hProcess && (*iter)->hContact == pAck->hContact) {
Event.eType = EVENT_MESSAGE_ACK;
- Event.hValue = (MEVENT)pAck->hProcess;
+ Event.hValue = (UINT_PTR)pAck->hProcess;
Event.hContact = pAck->hContact;
Event.iValue = pAck->result;
if (pAck->lParam != 0)
@@ -1570,7 +1570,7 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam)
}
// protocol status changes
else if (pAck->type == ACKTYPE_STATUS && pAck->result == ACKRESULT_SUCCESS) {
- int iOldStatus = (int)pAck->hProcess;
+ int iOldStatus = (INT_PTR)pAck->hProcess;
int iNewStatus = pAck->lParam;
tstring strProto = toTstring(pAck->szModule);
diff --git a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp
index 98b3f5c921..f3c4048c01 100644
--- a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp
+++ b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp
Binary files differ
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp
index 355b51e037..2009d76839 100644
--- a/plugins/NewAwaySysMod/src/ContactList.cpp
+++ b/plugins/NewAwaySysMod/src/ContactList.cpp
@@ -409,7 +409,7 @@ HTREEITEM CCList::AddGroup(TCString GroupName)
if (!GroupEnumData.hGroup) // means there is no such group in the groups list
return NULL;
- HTREEITEM hGroupItem = FindContact((MCONTACT)GroupEnumData.hGroup);
+ HTREEITEM hGroupItem = FindContact((UINT_PTR)GroupEnumData.hGroup);
if (hGroupItem)
return hGroupItem; // exists already, just return its handle
@@ -427,7 +427,7 @@ HTREEITEM CCList::AddGroup(TCString GroupName)
tvIns.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
tvIns.item.state = tvIns.item.stateMask = TVIS_BOLD | TVIS_EXPANDED;
tvIns.item.iImage = tvIns.item.iSelectedImage = IMAGE_GROUPOPEN;
- tvIns.item.lParam = Items.AddElem(CCLItemData((MCONTACT)GroupEnumData.hGroup));
+ tvIns.item.lParam = Items.AddElem(CCLItemData((UINT_PTR)GroupEnumData.hGroup));
return TreeView_InsertItem(hTreeView, &tvIns);
}
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp
index 25d5fff374..4ac3d313c6 100644
--- a/plugins/NewAwaySysMod/src/MsgTree.cpp
+++ b/plugins/NewAwaySysMod/src/MsgTree.cpp
@@ -656,7 +656,7 @@ CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem *Item) // Item is
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
CBaseTreeItem *TreeItem = Item;
if (Flags & MTGN_BYID) {
- int Order = TreeCtrl->IDToOrder((int)Item);
+ int Order = TreeCtrl->IDToOrder((INT_PTR)Item);
_ASSERT(Order != -1);
TreeItem = (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->m_value[Order];
}
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index 9ca89eabab..8e1bb31bfa 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -134,7 +134,7 @@ INT_PTR NewsAggrLoadIcon(WPARAM wParam, LPARAM)
static void __cdecl AckThreadProc(void *param)
{
Sleep(100);
- ProtoBroadcastAck(MODULE, (MCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ ProtoBroadcastAck(MODULE, (UINT_PTR)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
INT_PTR NewsAggrGetInfo(WPARAM, LPARAM lParam)
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp
index 0a4ebeaf0e..ba7c23f366 100644
--- a/plugins/NotifyAnything/src/main.cpp
+++ b/plugins/NotifyAnything/src/main.cpp
@@ -365,7 +365,7 @@ void processSingleAction(const std::tstring &what, bool &closeflag)
const TCHAR *cargs = decode_se_arg(args);
- if ((int)ShellExecute(0, _T("open"), file.c_str(), cargs, 0, SW_SHOWNORMAL) <= 32)
+ if ((INT_PTR)ShellExecute(0, _T("open"), file.c_str(), cargs, 0, SW_SHOWNORMAL) <= 32)
throw _T("Failed to open: ") + file + _T(" ") + args;
}
@@ -389,7 +389,7 @@ void processSingleAction(const std::tstring &what, bool &closeflag)
args = strip(args);
dir = /*unquote(*/strip(dir)/*)*/;
- if ((int)ShellExecute(0, decode_se_arg(verb), decode_se_arg(file), decode_se_arg(args), decode_se_arg(dir), SW_SHOWNORMAL) <= 32)
+ if ((INT_PTR)ShellExecute(0, decode_se_arg(verb), decode_se_arg(file), decode_se_arg(args), decode_se_arg(dir), SW_SHOWNORMAL) <= 32)
throw _T("Failed: ") + what;
}
else if (what == _T("close"))
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp
index 00e0402f53..5cf5d38093 100644
--- a/plugins/Ping/src/pinggraph.cpp
+++ b/plugins/Ping/src/pinggraph.cpp
@@ -294,7 +294,7 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
wd->show_grid = db_get_b(0, PLUG, "ShowGridLines", 0) ? true : false;
wd->show_stat = db_get_b(0, PLUG, "ShowStats", 1) ? true : false;
- db_set_dw(0, PLUG, buff, (DWORD)hGraphWnd);
+ db_set_dw(0, PLUG, buff, (UINT_PTR)hGraphWnd);
SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd);
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index 78e63d086d..0f0000857d 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -207,7 +207,7 @@ int EventAdded(WPARAM wparam, LPARAM hDbEvent)
|| db_get_w(NULL, MODULE_NAME, "MsgTypeRec", TYPE_GLOBAL) != TYPE_GLOBAL)
return 0;
- db_set_dw(NULL, MODULE_NAME, "LastSentTo", (DWORD)(HANDLE)wparam);
+ db_set_dw(NULL, MODULE_NAME, "LastSentTo", (UINT_PTR)wparam);
return 0;
}
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp
index 14b28bddbb..6cec77af40 100644
--- a/plugins/SMS/src/recvdlg.cpp
+++ b/plugins/SMS/src/recvdlg.cpp
@@ -36,15 +36,15 @@ typedef struct
MCONTACT hContact;
} RECV_SMS_WINDOW_DATA;
-INT_PTR CALLBACK RecvSmsDlgProc (HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam);
+INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam);
#define GET_WINDOW_DATA(hWndDlg) ((RECV_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA))
-
+
DWORD RecvSMSWindowInitialize()
{
DWORD dwRetErrorCode;
- dwRetErrorCode=ListMTInitialize(&ssSMSSettings.lmtRecvSMSWindowsListMT,0);
-return(dwRetErrorCode);
+ dwRetErrorCode = ListMTInitialize(&ssSMSSettings.lmtRecvSMSWindowsListMT, 0);
+ return(dwRetErrorCode);
}
//This function destroy all SMS receive windows
@@ -53,8 +53,7 @@ void RecvSMSWindowDestroy()
RECV_SMS_WINDOW_DATA *prswdWindowData;
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT,NULL,(LPVOID*)&prswdWindowData)==NO_ERROR)
- {// öèêë
+ while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, NULL, (LPVOID*)&prswdWindowData) == NO_ERROR) {// öèêë
RecvSMSWindowRemove(prswdWindowData->hWnd);
}
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
@@ -62,89 +61,82 @@ void RecvSMSWindowDestroy()
}
-INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- RECV_SMS_WINDOW_DATA *prswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg);
- switch(message){
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg); //Translate intially - bid
- prswdWindowData=(RECV_SMS_WINDOW_DATA*)lParam;
- SetWindowLongPtr(hWndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
+ prswdWindowData = (RECV_SMS_WINDOW_DATA*)lParam;
+ SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- mir_subclassWindow(GetDlgItem(hWndDlg,IDC_MESSAGE), MessageSubclassProc);
+ mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc);
{
LOGFONT lf;
- HFONT hFont=(HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0);
- if (hFont && hFont!=(HFONT)SendDlgItemMessage(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont);
- LoadMsgDlgFont(MSGFONTID_YOURMSG,&lf,NULL);
- hFont=CreateFontIndirect(&lf);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
-
- COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
- prswdWindowData->hBkgBrush=CreateSolidBrush(colour);
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, NULL);
+ hFont = CreateFontIndirect(&lf);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
+
+ COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ prswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
- if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? prswdWindowData->hContact:NULL),PROTOCOL_NAMEA,"recv"))
- {// def pos
- SetWindowPos(hWndDlg,0,200,200,400,350,SWP_NOZORDER);
- }
- InvalidateRect(GetDlgItem(hWndDlg,IDC_MESSAGE),NULL,FALSE);
+ // def pos
+ if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv"))
+ SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER);
+
+ InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE);
break;
case WM_CTLCOLORSTATIC:
- if ((HWND)lParam==GetDlgItem(hWndDlg,IDC_MESSAGE)) {
+ if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) {
COLORREF colour;
- LoadMsgDlgFont(MSGFONTID_YOURMSG,NULL,&colour);
- SetTextColor((HDC)wParam,colour);
- SetBkColor((HDC)wParam,db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
- return((BOOL)prswdWindowData->hBkgBrush);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, NULL, &colour);
+ SetTextColor((HDC)wParam, colour);
+ SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ return (INT_PTR)prswdWindowData->hBkgBrush;
}
break;
case WM_GETMINMAXINFO:
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=300;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=230;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 300;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230;
break;
case WM_SIZE:
+ RECT rcWin;
+ GetWindowRect(hWndDlg, &rcWin);
{
- int cx,cy;
- RECT rcWin;
-
- GetWindowRect(hWndDlg,&rcWin);
- cx = rcWin.right - rcWin.left;
- cy = rcWin.bottom - rcWin.top;
- cx -= 10; /* XXX: fix window sizes for aero. */
- cy -= 10;
- SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 112,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBER),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_NUMBER),0,cx - (cx*35)/100 - 58,5,40,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_READNEXT),0,cx - 87, cy - 60,80,25,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDOK),0,cx/2 - 87,cy - 60,80,25,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDCANCEL),0,cx/2 + 7,cy - 60,80,25,SWP_NOZORDER);
-
- RedrawWindow(hWndDlg,NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
+ int cx = rcWin.right - rcWin.left - 10;
+ int cy = rcWin.bottom - rcWin.top - 10;
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), 0, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), 0, cx - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
}
+ RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
break;
+
case WM_COMMAND:
- switch(LOWORD(wParam)){
+ switch (LOWORD(wParam)) {
case IDOK:
{
WCHAR wszPhone[MAX_PHONE_LEN];
- HWND hwndSendSms;
- MCONTACT hContact;
-
- hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,_countof(wszPhone)));
- hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact);
+ MCONTACT hContact = HContactFromPhone(wszPhone, GetDlgItemText(hWndDlg, IDC_NUMBER, wszPhone, _countof(wszPhone)));
+ HWND hwndSendSms = SendSMSWindowIsOtherInstanceHContact(hContact);
if (hwndSendSms)
SetFocus(hwndSendSms);
else {
- hwndSendSms=SendSMSWindowAdd(prswdWindowData->hContact);
- SetDlgItemText(hwndSendSms,IDC_ADDRESS,wszPhone);
+ hwndSendSms = SendSMSWindowAdd(prswdWindowData->hContact);
+ SetDlgItemText(hwndSendSms, IDC_ADDRESS, wszPhone);
}
}
case IDCANCEL:
@@ -175,36 +167,34 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
LPWSTR lpwszMessage;
lpwszMessage = (LPWSTR)MEMALLOC(((dwMessageSize + MAX_PATH) * sizeof(WCHAR)));
- if ( !lpwszMessage)
+ if (!lpwszMessage)
return NULL;
RECV_SMS_WINDOW_DATA *prswdWindowData;
prswdWindowData = (RECV_SMS_WINDOW_DATA*)MEMALLOC(sizeof(RECV_SMS_WINDOW_DATA));
- if (prswdWindowData)
- {
- prswdWindowData->hContact=hContact;
- prswdWindowData->hWnd=CreateDialogParam(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_RECVSMS),NULL,RecvSmsDlgProc,(LPARAM)prswdWindowData);
- if (prswdWindowData->hWnd)
- {
+ if (prswdWindowData) {
+ prswdWindowData->hContact = hContact;
+ prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), NULL, RecvSmsDlgProc, (LPARAM)prswdWindowData);
+ if (prswdWindowData->hWnd) {
HICON hIcon;
- WCHAR wszTitle[MAX_PATH]={0},wszPhoneLocal[MAX_PHONE_LEN]={0};
+ WCHAR wszTitle[MAX_PATH] = { 0 }, wszPhoneLocal[MAX_PHONE_LEN] = { 0 };
UINT iIcon;
- LPWSTR lpwszContactDisplayName,lpwszTitlepart;
+ LPWSTR lpwszContactDisplayName, lpwszTitlepart;
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- ListMTItemAdd(&ssSMSSettings.lmtRecvSMSWindowsListMT,&prswdWindowData->lmtListMTItem,prswdWindowData);
+ ListMTItemAdd(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem, prswdWindowData);
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- switch(dwEventType){
+ switch (dwEventType) {
case ICQEVENTTYPE_SMS:
- lpwszTitlepart=TranslateT("Received SMS");
- hIcon=Skin_LoadIcon(SKINICON_OTHER_SMS);
+ lpwszTitlepart = TranslateT("Received SMS");
+ hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS);
break;
case ICQEVENTTYPE_SMSCONFIRMATION:
- lpwszTitlepart=TranslateT("Received SMS Confirmation");
- GetDataFromMessage(lpszMessage,dwMessageSize,NULL,NULL,0,NULL,&iIcon);
- hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
+ lpwszTitlepart = TranslateT("Received SMS Confirmation");
+ GetDataFromMessage(lpszMessage, dwMessageSize, NULL, NULL, 0, NULL, &iIcon);
+ hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED);
break;
default:
lpwszTitlepart = _T("Unknown event type");
@@ -213,24 +203,24 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
wszPhoneLocal[0] = '+';
if (dwPhoneSize)
- dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
+ dwPhoneSize = CopyNumberW((wszPhoneLocal + 1), lpwszPhone, dwPhoneSize);
else {
- GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(_countof(wszPhoneLocal)-1),&dwPhoneSize,NULL);
+ GetDataFromMessage(lpszMessage, dwMessageSize, NULL, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, NULL);
dwPhoneSize++;
}
lpwszContactDisplayName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(wszTitle, _countof(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
- MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH);
+ mir_sntprintf(wszTitle, _countof(wszTitle), _T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
+ MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize + MAX_PATH);
SetWindowText(prswdWindowData->hWnd, wszTitle);
- SetDlgItemText(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName);
- SetDlgItemText(prswdWindowData->hWnd,IDC_NUMBER,wszPhoneLocal);
- SetDlgItemText(prswdWindowData->hWnd,IDC_MESSAGE,lpwszMessage);
- SendMessage(prswdWindowData->hWnd,WM_SETICON,ICON_BIG,(LPARAM)hIcon);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_NAME, lpwszContactDisplayName);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_NUMBER, wszPhoneLocal);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_MESSAGE, lpwszMessage);
+ SendMessage(prswdWindowData->hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
- SetFocus(GetDlgItem(prswdWindowData->hWnd,IDC_MESSAGE));
- hRet=prswdWindowData->hWnd;
+ SetFocus(GetDlgItem(prswdWindowData->hWnd, IDC_MESSAGE));
+ hRet = prswdWindowData->hWnd;
}
else MEMFREE(prswdWindowData);
}
@@ -242,17 +232,15 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
//The function gets the HWND of the window that should be removed and return void
void RecvSMSWindowRemove(HWND hWndDlg)
{
- RECV_SMS_WINDOW_DATA *prswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg);
+
+ if (prswdWindowData) {
+ Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv");
- if (prswdWindowData)
- {
- Utils_SaveWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? prswdWindowData->hContact:NULL),PROTOCOL_NAMEA,"recv");
-
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT,&prswdWindowData->lmtListMTItem);
+ ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem);
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
MEMFREE(prswdWindowData);
}
DestroyWindow(hWndDlg);
}
-
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp
index bc3f0d58b1..8af23dd8d3 100644
--- a/plugins/SMS/src/senddlg.cpp
+++ b/plugins/SMS/src/senddlg.cpp
@@ -49,9 +49,9 @@ typedef struct
DBEVENTINFO *pdbei;
} SEND_SMS_WINDOW_DATA;
-void AddContactPhonesToCombo (HWND hWnd,MCONTACT hContact);
-void SendSMSWindowFillTreeView (HWND hWnd);
-size_t GetSMSMessageLenMax (HWND hWndDlg);
+void AddContactPhonesToCombo(HWND hWnd, MCONTACT hContact);
+void SendSMSWindowFillTreeView(HWND hWnd);
+size_t GetSMSMessageLenMax(HWND hWndDlg);
#define GET_WINDOW_DATA(hWndDlg) ((SEND_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA))
@@ -72,202 +72,198 @@ void SendSMSWindowDestroy()
ListMTDestroy(&ssSMSSettings.lmtSendSMSWindowsListMT);
}
-INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- switch(message){
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg); //Translate intially - bid
////////AddWinHandle(GetDlgItem(hWndDlg,IDC_MESSAGE));
-
- psswdWindowData=(SEND_SMS_WINDOW_DATA*)lParam;
+
+ psswdWindowData = (SEND_SMS_WINDOW_DATA*)lParam;
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
-
+
mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc);
- SendMessage(hWndDlg,WM_SETICON,ICON_BIG,(LPARAM)Skin_LoadIcon(SKINICON_OTHER_SMS));
- SendDlgItemMessage(hWndDlg,IDC_HISTORY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY));
+ SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_SMS));
+ SendDlgItemMessage(hWndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY));
{
HICON hIcon;
- HIMAGELIST hIml=ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,30);
- TreeView_SetImageList(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),hIml,TVSIL_NORMAL);
- hIcon=Skin_LoadIcon(SKINICON_OTHER_NOTICK);
- ImageList_AddIcon(hIml,hIcon);
- hIcon=Skin_LoadIcon(SKINICON_OTHER_TICK);
- ImageList_AddIcon(hIml,hIcon);
- hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDI_HALFTICK),IMAGE_ICON,0,0,LR_SHARED);
- ImageList_AddIcon(hIml,hIcon);
+ HIMAGELIST hIml = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 30);
+ TreeView_SetImageList(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), hIml, TVSIL_NORMAL);
+ hIcon = Skin_LoadIcon(SKINICON_OTHER_NOTICK);
+ ImageList_AddIcon(hIml, hIcon);
+ hIcon = Skin_LoadIcon(SKINICON_OTHER_TICK);
+ ImageList_AddIcon(hIml, hIcon);
+ hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDI_HALFTICK), IMAGE_ICON, 0, 0, LR_SHARED);
+ ImageList_AddIcon(hIml, hIcon);
}
{
LOGFONT lf;
- HFONT hFont=(HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0);
- if (hFont && hFont!=(HFONT)SendDlgItemMessage(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont);
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,&lf,NULL);
- hFont=CreateFontIndirect(&lf);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
-
- COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
- psswdWindowData->hBkgBrush=CreateSolidBrush(colour);
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL);
+ hFont = CreateFontIndirect(&lf);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
+
+ COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ psswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
{
- HWND hwndToolTips=CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,TEXT(""),WS_POPUP,0,0,0,0,NULL,NULL,GetModuleHandle(NULL),NULL);
+ HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
TOOLINFO ti;
memset(&ti, 0, sizeof(ti));
- ti.cbSize=sizeof(ti);
- ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS;
- ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_HISTORY);
- ti.lpszText=TranslateT("View User's History");
- SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_ADDNUMBER);
- ti.lpszText=TranslateT("Add Number To The Multiple List");
- SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_SAVENUMBER);
- ti.lpszText=TranslateT("Save Number To The User's Details Phonebook");
- SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_MULTIPLE);
- ti.lpszText=TranslateT("Show/Hide Multiple List");
- SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_COUNT);
- ti.lpszText=TranslateT("Shows How Much Chars You've Typed");
- SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.cbSize = sizeof(ti);
+ ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
+ ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_HISTORY);
+ ti.lpszText = TranslateT("View User's History");
+ SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_ADDNUMBER);
+ ti.lpszText = TranslateT("Add Number To The Multiple List");
+ SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_SAVENUMBER);
+ ti.lpszText = TranslateT("Save Number To The User's Details Phonebook");
+ SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_MULTIPLE);
+ ti.lpszText = TranslateT("Show/Hide Multiple List");
+ SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_COUNT);
+ ti.lpszText = TranslateT("Shows How Much Chars You've Typed");
+ SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
{
- RECT rcWin,rcList;
- GetWindowRect(hWndDlg,&rcWin);
- GetWindowRect(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&rcList);
- SetWindowPos(hWndDlg,0,rcWin.left,rcWin.top,rcWin.right-rcWin.left - (rcList.right-rcList.left) - 10,rcWin.bottom - rcWin.top,SWP_NOZORDER|SWP_NOMOVE);
+ RECT rcWin, rcList;
+ GetWindowRect(hWndDlg, &rcWin);
+ GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList);
+ SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
}
SendSMSWindowUpdateAccountList(hWndDlg);
- {
+ {
TCHAR tszSign[1024];
size_t dwSignLen = 0;
- if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE))
- if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),&dwSignLen))
- {
- SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign);
+ if (DB_SMS_GetByte(NULL, "UseSignature", SMS_DEFAULT_USESIGNATURE))
+ if (DB_SMS_GetStaticStringW(NULL, "Signature", tszSign, _countof(tszSign), &dwSignLen)) {
+ SetDlgItemText(hWndDlg, IDC_MESSAGE, tszSign);
- if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS))
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen);
- EnableWindow(GetDlgItem(hWndDlg,IDOK), dwSignLen != 0);
- }
+ if (DB_SMS_GetByte(NULL, "SignaturePos", SMS_DEFAULT_SIGNATUREPOS))
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETSEL, dwSignLen, dwSignLen);
+ EnableWindow(GetDlgItem(hWndDlg, IDOK), dwSignLen != 0);
+ }
- mir_sntprintf(tszSign,_countof(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg));
- SetDlgItemText(hWndDlg,IDC_COUNT,tszSign);
+ mir_sntprintf(tszSign, _countof(tszSign), _T("%d/%d"), dwSignLen, GetSMSMessageLenMax(hWndDlg));
+ SetDlgItemText(hWndDlg, IDC_COUNT, tszSign);
}
- if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"send"))
- {// def pos
- SetWindowPos(hWndDlg,0,200,200,400,350,SWP_NOZORDER);
+ if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send")) {// def pos
+ SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER);
}
- InvalidateRect(GetDlgItem(hWndDlg,IDC_MESSAGE),NULL,FALSE);
+ InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE);
return TRUE;
case WM_GETMINMAXINFO:
- if (psswdWindowData->bMultiple)
- {
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=461;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=230;
- }else{
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=300;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=230;
+ if (psswdWindowData->bMultiple) {
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 461;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230;
+ }
+ else {
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 300;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230;
}
break;
case WM_SIZE:
{
- int cx,cy;
+ int cx, cy;
RECT rcWin;
- GetWindowRect(hWndDlg,&rcWin);
- if (psswdWindowData->bMultiple)
- {
- cx = rcWin.right-rcWin.left-181;
- cy = rcWin.bottom-rcWin.top;
- }else{
- cx = rcWin.right-rcWin.left;
- cy = rcWin.bottom-rcWin.top;
+ GetWindowRect(hWndDlg, &rcWin);
+ if (psswdWindowData->bMultiple) {
+ cx = rcWin.right - rcWin.left - 181;
+ cy = rcWin.bottom - rcWin.top;
+ }
+ else {
+ cx = rcWin.right - rcWin.left;
+ cy = rcWin.bottom - rcWin.top;
}
cx -= 10; /* XXX: fix window sizes for aero. */
cy -= 10;
- SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 132,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ACCOUNTS),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ADDRESS),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_ADDRESS),0,cx - (cx*35)/100 - 68,5,50,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_MULTIPLE),0,cx - ((cx*35)/100 + 35)/2 - 11,30,((cx*35)/100 + 35)/2,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_SAVENUMBER),0,cx - (cx*35)/100 - 58,30,((cx*35)/100 + 35)/2,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_HISTORY),0,0,0,20,20,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_COUNT),0,cx - 61,52,50,15,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_CHARS),0,cx - 106,52,40,15,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ADDNUMBER),0,cx,5,170,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),0,cx,25,170,cy - 90,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), 0, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), 0, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), 0, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), 0, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), 0, cx - 61, 52, 50, 15, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), 0, cx - 106, 52, 40, 15, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), 0, cx, 5, 170, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), 0, cx, 25, 170, cy - 90, SWP_NOZORDER);
//SetWindowPos(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),0,cx,cy - 110 + 25,170,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDOK),0,cx/2 - 87,cy - 60,80,25,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDCANCEL),0,cx/2 + 7,cy - 60,80,25,SWP_NOZORDER);
- RedrawWindow(hWndDlg,NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
+ RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
}
break;
case WM_TIMER:
- if (wParam==TIMERID_MSGSEND)
- {
+ if (wParam == TIMERID_MSGSEND) {
HWND hwndTimeOut;
- TCHAR tszMessage[1028],tszPhone[MAX_PHONE_LEN];
+ TCHAR tszMessage[1028], tszPhone[MAX_PHONE_LEN];
- if (psswdWindowData->bMultiple)
- {
+ if (psswdWindowData->bMultiple) {
TVITEM tvi;
- tvi.mask=TVIF_TEXT;
- tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
- tvi.pszText=tszPhone;
- tvi.cchTextMax=_countof(tszPhone);
- TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
- }else{
- GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone));
+ tvi.mask = TVIF_TEXT;
+ tvi.hItem = SendSMSWindowHItemSendGet(hWndDlg);
+ tvi.pszText = tszPhone;
+ tvi.cchTextMax = _countof(tszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi);
}
- mir_sntprintf(tszMessage,_countof(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone);
- KillTimer(hWndDlg,wParam);
- ShowWindow(hWndDlg,SW_SHOWNORMAL);
- EnableWindow(hWndDlg,FALSE);
- hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc);
- SetDlgItemText(hwndTimeOut,IDC_STATUS,tszMessage);
+ else {
+ GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
+ }
+ mir_sntprintf(tszMessage, _countof(tszMessage), TranslateT("The SMS message send to %s timed out."), tszPhone);
+ KillTimer(hWndDlg, wParam);
+ ShowWindow(hWndDlg, SW_SHOWNORMAL);
+ EnableWindow(hWndDlg, FALSE);
+ hwndTimeOut = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT), hWndDlg, SMSTimedOutDlgProc);
+ SetDlgItemText(hwndTimeOut, IDC_STATUS, tszMessage);
}
break;
case WM_CTLCOLOREDIT:
- if ((HWND)lParam==GetDlgItem(hWndDlg,IDC_MESSAGE))
- {
+ if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) {
COLORREF colour;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,NULL,&colour);
- SetTextColor((HDC)wParam,colour);
- SetBkColor((HDC)wParam,db_get_dw(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &colour);
+ SetTextColor((HDC)wParam, colour);
+ SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
return((INT_PTR)psswdWindowData->hBkgBrush);
}
break;
case DM_TIMEOUTDECIDED:
- EnableWindow(hWndDlg,TRUE);
- switch(wParam){
+ EnableWindow(hWndDlg, TRUE);
+ switch (wParam) {
case TIMEDOUT_CANCEL:
- if (psswdWindowData->bMultiple)
- {
- if (SendSMSWindowNextHItemGet(hWndDlg,psswdWindowData->hItemSend))
- {
- psswdWindowData->hItemSend=SendSMSWindowNextHItemGet(hWndDlg,psswdWindowData->hItemSend);
+ if (psswdWindowData->bMultiple) {
+ if (SendSMSWindowNextHItemGet(hWndDlg, psswdWindowData->hItemSend)) {
+ psswdWindowData->hItemSend = SendSMSWindowNextHItemGet(hWndDlg, psswdWindowData->hItemSend);
SendSMSWindowNext(hWndDlg);
- }else{
+ }
+ else {
SendSMSWindowRemove(hWndDlg);
}
- }else{
- EnableWindow(GetDlgItem(hWndDlg,IDOK),TRUE);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,FALSE,0);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),TRUE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),TRUE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),TRUE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_MULTIPLE),TRUE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),TRUE);
- if (psswdWindowData->hMyContact==NULL) EnableWindow(GetDlgItem(hWndDlg,IDC_NAME),TRUE);
- SetFocus(GetDlgItem(hWndDlg,IDC_MESSAGE));
- psswdWindowData->hItemSend=NULL;
+ }
+ else {
+ EnableWindow(GetDlgItem(hWndDlg, IDOK), TRUE);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, FALSE, 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), TRUE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), TRUE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), TRUE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), TRUE);
+ if (psswdWindowData->hMyContact == NULL) EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), TRUE);
+ SetFocus(GetDlgItem(hWndDlg, IDC_MESSAGE));
+ psswdWindowData->hItemSend = NULL;
}
break;
case TIMEDOUT_RETRY:
@@ -275,277 +271,265 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
TCHAR tszPhone[MAX_PHONE_LEN];
size_t dwPhoneSize;
- size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
- LPTSTR lpwszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
- if (lpwszMessage)
- {
- if (psswdWindowData->bMultiple)
- {
+ size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
+ LPTSTR lpwszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(TCHAR)));
+ if (lpwszMessage) {
+ if (psswdWindowData->bMultiple) {
TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.hItem = psswdWindowData->hItemSend;
tvi.pszText = tszPhone;
tvi.cchTextMax = _countof(tszPhone);
- TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
+ TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi);
dwPhoneSize = mir_tstrlen(tszPhone);
}
else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
- dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(int)dwMessageSize+2);
- SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
- StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize + 2);
+ SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize);
+ StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize);
MEMFREE(lpwszMessage);
}
}
- SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
break;
}
break;
case WM_COMMAND:
- switch(LOWORD(wParam)){
+ switch (LOWORD(wParam)) {
case IDC_MULTIPLE:
- SendSMSWindowMultipleSet(hWndDlg,!psswdWindowData->bMultiple);
+ SendSMSWindowMultipleSet(hWndDlg, !psswdWindowData->bMultiple);
break;
case IDC_ADDNUMBER:
- {
+ {
TCHAR tszPhone[MAX_PHONE_LEN];
- if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone)))) {
- TVINSERTSTRUCT tvis = {0};
+ if (IsPhoneW(tszPhone, GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)))) {
+ TVINSERTSTRUCT tvis = { 0 };
tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.hInsertAfter = TVI_SORT;
tvis.item.pszText = tszPhone;
- TreeView_InsertItem( GetDlgItem(hWndDlg,IDC_NUMBERSLIST), &tvis);
+ TreeView_InsertItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvis);
}
- else MessageBox(hWndDlg,TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK);
+ else MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK);
}
break;
case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)psswdWindowData->hMyContact,0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)psswdWindowData->hMyContact, 0);
break;
case IDOK:
- if ((size_t)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg))
- {
- MessageBox(hWndDlg,TranslateT("Message is too long, press OK to continue."),TranslateT("Error - Message too long"),MB_OK);
- }else{
- if (psswdWindowData->bMultiple)
- {
- HTREEITEM hItem=SendSMSWindowNextHItemGet(hWndDlg,TreeView_GetRoot(GetDlgItem(hWndDlg,IDC_NUMBERSLIST)));
- if (hItem)
- {
- psswdWindowData->hItemSend=hItem;
- EnableWindow(GetDlgItem(hWndDlg,IDOK),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_NAME),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_MULTIPLE),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ADDNUMBER),FALSE);
+ if ((size_t)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg)) {
+ MessageBox(hWndDlg, TranslateT("Message is too long, press OK to continue."), TranslateT("Error - Message too long"), MB_OK);
+ }
+ else {
+ if (psswdWindowData->bMultiple) {
+ HTREEITEM hItem = SendSMSWindowNextHItemGet(hWndDlg, TreeView_GetRoot(GetDlgItem(hWndDlg, IDC_NUMBERSLIST)));
+ if (hItem) {
+ psswdWindowData->hItemSend = hItem;
+ EnableWindow(GetDlgItem(hWndDlg, IDOK), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ADDNUMBER), FALSE);
//EnableWindow(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),FALSE);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE);
SendSMSWindowNext(hWndDlg);
- }else{
- MessageBox(hWndDlg,TranslateT("There must be numbers in the list first."),TranslateT("No Numbers"),MB_OK);
}
- }else{
+ else {
+ MessageBox(hWndDlg, TranslateT("There must be numbers in the list first."), TranslateT("No Numbers"), MB_OK);
+ }
+ }
+ else {
TCHAR tszPhone[MAX_PHONE_LEN];
- size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone));
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
- LPTSTR lpwszMessage=(LPTSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR));
- if (lpwszMessage)
- {
- dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize+2);
- SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
- EnableWindow(GetDlgItem(hWndDlg,IDOK),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_NAME),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_MULTIPLE),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),FALSE);
- EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0);
- StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
- SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
-
+ size_t dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
+ LPTSTR lpwszMessage = (LPTSTR)MEMALLOC((dwMessageSize + 4)*sizeof(WCHAR));
+ if (lpwszMessage) {
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize + 2);
+ SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize);
+ EnableWindow(GetDlgItem(hWndDlg, IDOK), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0);
+ StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
+
MEMFREE(lpwszMessage);
}
- }else{
- MessageBox(hWndDlg,TranslateT("Valid phone numbers are of the form '+(country code)(phone number)'. The contents of the phone number portion is dependent on the national layout of phone numbers, but often omits the leading zero."),TranslateT("Invalid phone number"),MB_OK);
- SetFocus(GetDlgItem(hWndDlg,IDC_ADDRESS));
- SendDlgItemMessage(hWndDlg,IDC_ADDRESS,CB_SETEDITSEL,0,MAKELPARAM(0,-1));
+ }
+ else {
+ MessageBox(hWndDlg, TranslateT("Valid phone numbers are of the form '+(country code)(phone number)'. The contents of the phone number portion is dependent on the national layout of phone numbers, but often omits the leading zero."), TranslateT("Invalid phone number"), MB_OK);
+ SetFocus(GetDlgItem(hWndDlg, IDC_ADDRESS));
+ SendDlgItemMessage(hWndDlg, IDC_ADDRESS, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
}
}
}
break;
case IDCANCEL:
- DeleteObject((HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0));
- KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND);
+ DeleteObject((HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0));
+ KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND);
SendSMSWindowRemove(hWndDlg);
break;
case IDC_MESSAGE:
- if (HIWORD(wParam)==EN_CHANGE)
- {
+ if (HIWORD(wParam) == EN_CHANGE) {
TCHAR tszBuff[MAX_PATH];
- size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
- EnableWindow(GetDlgItem(hWndDlg,IDOK), dwMessageSize != 0);
- mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg));
- SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff);
+ EnableWindow(GetDlgItem(hWndDlg, IDOK), dwMessageSize != 0);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize, GetSMSMessageLenMax(hWndDlg));
+ SetDlgItemText(hWndDlg, IDC_COUNT, tszBuff);
}
break;
case IDC_SAVENUMBER:
{
- BOOL bCont=TRUE;
+ BOOL bCont = TRUE;
char szBuff[MAX_PATH];
TCHAR tszPhone[MAX_PHONE_LEN];
DBVARIANT dbv;
- size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(_countof(tszPhone)-4));
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE)
- {
+ size_t dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, (_countof(tszPhone) - 4));
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ if (IsContactPhone(psswdWindowData->hMyContact, tszPhone, dwPhoneSize) == FALSE) {
mir_tstrcat(tszPhone, _T(" SMS"));
- for(DWORD i=0;bCont;i++)
- {
- mir_snprintf(szBuff,_countof(szBuff),"MyPhone%d",i);
- if (db_get(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE;
+ for (DWORD i = 0; bCont; i++) {
+ mir_snprintf(szBuff, _countof(szBuff), "MyPhone%d", i);
+ if (db_get(psswdWindowData->hMyContact, "UserInfo", szBuff, &dbv)) bCont = FALSE;
db_free(&dbv);
}
- DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,tszPhone);
+ DB_SetStringW(psswdWindowData->hMyContact, "UserInfo", szBuff, tszPhone);
}
- }else{
- MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK);
+ }
+ else {
+ MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK);
}
}
break;
case IDC_NAME:
- if (HIWORD(wParam)==CBN_SELCHANGE)
- {
- SendDlgItemMessage(hWndDlg,IDC_ADDRESS,CB_RESETCONTENT,0,0);
- if (SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0))
- {
- MCONTACT hContact = SendSMSWindowSMSContactGet(hWndDlg,(SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)-1));
- if (hContact) AddContactPhonesToCombo(hWndDlg,hContact);
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ SendDlgItemMessage(hWndDlg, IDC_ADDRESS, CB_RESETCONTENT, 0, 0);
+ if (SendDlgItemMessage(hWndDlg, IDC_NAME, CB_GETCURSEL, 0, 0)) {
+ MCONTACT hContact = SendSMSWindowSMSContactGet(hWndDlg, (SendDlgItemMessage(hWndDlg, IDC_NAME, CB_GETCURSEL, 0, 0) - 1));
+ if (hContact) AddContactPhonesToCombo(hWndDlg, hContact);
}
}
break;
}
break;
case WM_NOTIFY:
- switch(((NMHDR*)lParam)->idFrom){
+ switch (((NMHDR*)lParam)->idFrom) {
case IDC_NUMBERSLIST:
- switch(((NMHDR*)lParam)->code){
+ switch (((NMHDR*)lParam)->code) {
case NM_CLICK:
- {
- int iImage,iSame=1;
- HWND hWndTree=GetDlgItem(hWndDlg,IDC_NUMBERSLIST);
- TVITEM tvi={0};
+ {
+ int iImage, iSame = 1;
+ HWND hWndTree = GetDlgItem(hWndDlg, IDC_NUMBERSLIST);
+ TVITEM tvi = { 0 };
HTREEITEM hParent;
- TVHITTESTINFO hti={0};
-
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
-
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
- if (hti.flags&TVHT_ONITEMICON)
- {
- tvi.mask=(TVIF_IMAGE|TVIF_SELECTEDIMAGE);
- tvi.hItem=hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
- iImage=tvi.iImage=tvi.iSelectedImage=!tvi.iImage;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
-
- if (TreeView_GetParent(hWndTree,hti.hItem))
- {
- hParent=TreeView_GetParent(hWndTree,hti.hItem);
- for(tvi.hItem=TreeView_GetChild(hWndTree,hParent);tvi.hItem;tvi.hItem=TreeView_GetNextSibling(hWndTree,tvi.hItem))
- {
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
- if (tvi.iImage!=iImage)
- {
- iSame=0;
- break;
- }
+ TVHITTESTINFO hti = { 0 };
+
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
+ if (hti.flags&TVHT_ONITEMICON) {
+ tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE);
+ tvi.hItem = hti.hItem;
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ iImage = tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+
+ if (TreeView_GetParent(hWndTree, hti.hItem)) {
+ hParent = TreeView_GetParent(hWndTree, hti.hItem);
+ for (tvi.hItem = TreeView_GetChild(hWndTree, hParent); tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hWndTree, tvi.hItem)) {
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ if (tvi.iImage != iImage) {
+ iSame = 0;
+ break;
+ }
+ }
+ tvi.hItem = hParent;
+ tvi.iImage = tvi.iSelectedImage = ((iSame == 1) ? iImage : 2);
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
}
- tvi.hItem=hParent;
- tvi.iImage=tvi.iSelectedImage=((iSame==1)? iImage:2);
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
- }else{
- for(tvi.hItem=TreeView_GetChild(hWndTree,hti.hItem);tvi.hItem;tvi.hItem=TreeView_GetNextSibling(hWndTree,tvi.hItem))
- {
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
- tvi.iImage=tvi.iSelectedImage=iImage;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
+ else {
+ for (tvi.hItem = TreeView_GetChild(hWndTree, hti.hItem); tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hWndTree, tvi.hItem)) {
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ tvi.iImage = tvi.iSelectedImage = iImage;
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ }
}
}
- }
}
break;
}
}
- break;
+ break;
case WM_CLOSE:
- DeleteObject((HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0));
+ DeleteObject((HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0));
DeleteObject(psswdWindowData->hBkgBrush);
////////RemWinHandle(GetDlgItem(hWndDlg,IDC_MESSAGE));
- KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND);
+ KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND);
SendSMSWindowRemove(hWndDlg);
break;
}
-return FALSE;
+ return FALSE;
}
-INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM)
+INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM)
{
- switch(msg){
+ switch (msg) {
case WM_INITDIALOG:
{
- RECT rc,rcParent;
- TranslateDialogDefault(hWndDlg);
- GetWindowRect(hWndDlg,&rc);
- GetWindowRect(GetParent(hWndDlg),&rcParent);
- SetWindowPos(hWndDlg,0,(rcParent.left+rcParent.right-(rc.right-rc.left))/2,(rcParent.top+rcParent.bottom-(rc.bottom-rc.top))/2,0,0,SWP_NOZORDER|SWP_NOSIZE);
- KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND);
+ RECT rc, rcParent;
+ TranslateDialogDefault(hWndDlg);
+ GetWindowRect(hWndDlg, &rc);
+ GetWindowRect(GetParent(hWndDlg), &rcParent);
+ SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND);
}
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)){
+ switch (LOWORD(wParam)) {
case IDOK:
- SendMessage(GetParent(hWndDlg),DM_TIMEOUTDECIDED,TIMEDOUT_RETRY,0);
+ SendMessage(GetParent(hWndDlg), DM_TIMEOUTDECIDED, TIMEDOUT_RETRY, 0);
DestroyWindow(hWndDlg);
break;
case IDCANCEL:
- SendMessage(GetParent(hWndDlg),DM_TIMEOUTDECIDED,TIMEDOUT_CANCEL,0);
+ SendMessage(GetParent(hWndDlg), DM_TIMEOUTDECIDED, TIMEDOUT_CANCEL, 0);
DestroyWindow(hWndDlg);
break;
}
break;
}
return FALSE;
-}
+}
-INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM)
+INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM)
{
- switch(msg){
+ switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault(hWndDlg);
+ TranslateDialogDefault(hWndDlg);
{
- RECT rc,rcParent;
- GetWindowRect(hWndDlg,&rc);
- GetWindowRect(GetParent(hWndDlg),&rcParent);
- SetWindowPos(hWndDlg,0,(rcParent.left+rcParent.right-(rc.right-rc.left))/2,(rcParent.top+rcParent.bottom-(rc.bottom-rc.top))/2,0,0,SWP_NOZORDER|SWP_NOSIZE);
+ RECT rc, rcParent;
+ GetWindowRect(hWndDlg, &rc);
+ GetWindowRect(GetParent(hWndDlg), &rcParent);
+ SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
return TRUE;
-
+
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
SendSMSWindowRemove(GetParent(hWndDlg));
DestroyWindow(hWndDlg);
@@ -563,25 +547,25 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM)
HWND SendSMSWindowAdd(MCONTACT hContact)
{
HWND hRet = NULL;
- SEND_SMS_WINDOW_DATA *psswdWindowData=(SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA));
- if ( !psswdWindowData)
+ SEND_SMS_WINDOW_DATA *psswdWindowData = (SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA));
+ if (!psswdWindowData)
return NULL;
psswdWindowData->hMyContact = hContact;
psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), NULL, SendSmsDlgProc, (LPARAM)psswdWindowData);
if (psswdWindowData->hWnd) {
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT,&psswdWindowData->lmtListMTItem,psswdWindowData);
+ ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem, psswdWindowData);
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
LPTSTR lptszContactDisplayName = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR tszTitle[MAX_PATH];
mir_sntprintf(tszTitle, _countof(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS"));
- SetWindowText(psswdWindowData->hWnd,tszTitle);
- SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lptszContactDisplayName);
- SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0);
- AddContactPhonesToCombo(psswdWindowData->hWnd,hContact);
- SetFocus(GetDlgItem(psswdWindowData->hWnd,IDC_MESSAGE));
- hRet=psswdWindowData->hWnd;
+ SetWindowText(psswdWindowData->hWnd, tszTitle);
+ SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_ADDSTRING, 0, (LPARAM)lptszContactDisplayName);
+ SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_SETCURSEL, 0, 0);
+ AddContactPhonesToCombo(psswdWindowData->hWnd, hContact);
+ SetFocus(GetDlgItem(psswdWindowData->hWnd, IDC_MESSAGE));
+ hRet = psswdWindowData->hWnd;
}
else MEMFREE(psswdWindowData);
return hRet;
@@ -593,14 +577,13 @@ void SendSMSWindowRemove(HWND hWndDlg)
{
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData)
- {
- DB_SMS_SetDword(NULL,"LastProto",SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0));
- SendSMSWindowMultipleSet(hWndDlg,FALSE);
- Utils_SaveWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"send");
-
+ if (psswdWindowData) {
+ DB_SMS_SetDword(NULL, "LastProto", SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0));
+ SendSMSWindowMultipleSet(hWndDlg, FALSE);
+ Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send");
+
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- ListMTItemDelete(&ssSMSSettings.lmtSendSMSWindowsListMT,&psswdWindowData->lmtListMTItem);
+ ListMTItemDelete(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem);
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
SendSMSWindowSMSContactsRemove(hWndDlg);
MEMFREE(psswdWindowData->pdbei);
@@ -613,19 +596,19 @@ void SendSMSWindowRemove(HWND hWndDlg)
//The function gets the HWND of the window and return the HANDLE of the contact.
MCONTACT SendSMSWindowHContactGet(HWND hWndDlg)
{
- MCONTACT hRet=NULL;
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ MCONTACT hRet = NULL;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) hRet=psswdWindowData->hMyContact;
+ if (psswdWindowData) hRet = psswdWindowData->hMyContact;
return(hRet);
}
//This function set the contact info of the person we send him the in the given to the SMS send window.
//The function gets the HWND of the window and the HANDLE of the contact and return void
-void SendSMSWindowHContactSet(HWND hWndDlg,MCONTACT hContact)
+void SendSMSWindowHContactSet(HWND hWndDlg, MCONTACT hContact)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) psswdWindowData->hMyContact=hContact;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
+ if (psswdWindowData) psswdWindowData->hMyContact = hContact;
}
//This function return the HWND of a SMS send window that have the same process as given.
@@ -633,116 +616,114 @@ void SendSMSWindowHContactSet(HWND hWndDlg,MCONTACT hContact)
//the same process
HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess)
{
- HWND hRet=NULL;
+ HWND hRet = NULL;
SEND_SMS_WINDOW_DATA *psswdWindowData;
LIST_MT_ITERATOR lmtiIterator;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,&lmtiIterator);
- do
- {// öèêë
- if (ListMTIteratorGet(&lmtiIterator,NULL,(LPVOID*)&psswdWindowData)==NO_ERROR)
- if (psswdWindowData->hProcess==hProcess)
- {
- hRet=psswdWindowData->hWnd;
- break;
- }
- }while (ListMTIteratorMoveNext(&lmtiIterator));
+ ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
+ do {// öèêë
+ if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR)
+ if (psswdWindowData->hProcess == hProcess) {
+ hRet = psswdWindowData->hWnd;
+ break;
+ }
+ } while (ListMTIteratorMoveNext(&lmtiIterator));
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
-return(hRet);
+ return(hRet);
}
//This function set the process info of the send procedure we sent with the given SMS send window.
//The function gets the HWND of the window and the HANDLE of the process and return void
-void SendSMSWindowHProcessSet(HWND hWndDlg,HANDLE hProcess)
+void SendSMSWindowHProcessSet(HWND hWndDlg, HANDLE hProcess)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) psswdWindowData->hProcess=hProcess;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
+ if (psswdWindowData) psswdWindowData->hProcess = hProcess;
}
//
BOOL SendSMSWindowMultipleGet(HWND hWndDlg)
{
- BOOL bRet=FALSE;
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ BOOL bRet = FALSE;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) bRet=psswdWindowData->bMultiple;
-return(bRet);
+ if (psswdWindowData) bRet = psswdWindowData->bMultiple;
+ return(bRet);
}
//
-void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple)
+void SendSMSWindowMultipleSet(HWND hWndDlg, BOOL bMultiple)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if ( !psswdWindowData)
+ if (!psswdWindowData)
return;
if (psswdWindowData->bMultiple == bMultiple)
return;
- RECT rcWin,rcList;
+ RECT rcWin, rcList;
WINDOWPLACEMENT wp;
- psswdWindowData->bMultiple=bMultiple;
- wp.length=sizeof(WINDOWPLACEMENT);
- GetWindowRect(hWndDlg,&rcWin);
- GetWindowRect(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&rcList);
- GetWindowPlacement(hWndDlg,&wp);
+ psswdWindowData->bMultiple = bMultiple;
+ wp.length = sizeof(WINDOWPLACEMENT);
+ GetWindowRect(hWndDlg, &rcWin);
+ GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList);
+ GetWindowPlacement(hWndDlg, &wp);
- if (bMultiple)
- {
+ if (bMultiple) {
SendSMSWindowFillTreeView(hWndDlg);
- EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE);
SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single"));
- if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
- SetWindowPos(hWndDlg, 0 ,rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right-rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
- }else{
- if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg,psswdWindowData->hMyContact);
+ if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ }
+ else {
+ if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg, psswdWindowData->hMyContact);
EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE);
SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>"));
- SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right-rcWin.left - (rcList.right-rcList.left) - 11, rcWin.bottom - rcWin.top,SWP_NOZORDER | SWP_NOMOVE);
- if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
+ if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE);
}
}
//
void SendSMSWindowNumberSet(HWND hWndDlg, LPWSTR lpwszPhone, size_t dwPhoneSize)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData)
- if (psswdWindowData->bMultiple)
- {
- psswdWindowData->hContact=psswdWindowData->hMyContact;
- }else{
- psswdWindowData->hContact=HContactFromPhone(lpwszPhone,dwPhoneSize);
- }
+ if (psswdWindowData->bMultiple) {
+ psswdWindowData->hContact = psswdWindowData->hMyContact;
+ }
+ else {
+ psswdWindowData->hContact = HContactFromPhone(lpwszPhone, dwPhoneSize);
+ }
}
//
void SendSMSWindowAsSentSet(HWND)
{
-// LVITEM lvi;
-// char szPhone[MAX_PHONE_LEN];
-// lvi.mask=LVIF_TEXT|LVIF_IMAGE;
-// lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1;
-// lvi.iSubItem=0;
-// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,_countof(szPhone));
-// lvi.pszText=szPhone;
-// lvi.iImage=2;
-// ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi);
-// ListView_RedrawItems(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),0,ListView_GetItemCount(GetDlgItem(hWndDlg,IDC_NUMBERSLIST)) - 1);
+ // LVITEM lvi;
+ // char szPhone[MAX_PHONE_LEN];
+ // lvi.mask=LVIF_TEXT|LVIF_IMAGE;
+ // lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1;
+ // lvi.iSubItem=0;
+ // ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,_countof(szPhone));
+ // lvi.pszText=szPhone;
+ // lvi.iImage=2;
+ // ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi);
+ // ListView_RedrawItems(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),0,ListView_GetItemCount(GetDlgItem(hWndDlg,IDC_NUMBERSLIST)) - 1);
}
//This function set the databsae info of the sent message we sent with the SMS send window.
//The function gets the HWND of the window and the DBEI of the database information of the message
//and return void
-void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei)
+void SendSMSWindowDbeiSet(HWND hWndDlg, DBEVENTINFO *pdbei)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) psswdWindowData->pdbei=pdbei;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
+ if (psswdWindowData) psswdWindowData->pdbei = pdbei;
}
//This function get a HWND of SMS send window and add its database information into Miranda-IM database
@@ -750,7 +731,7 @@ void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei)
//and return void
void SendSMSWindowDBAdd(HWND hWndDlg)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData) {
psswdWindowData->pdbei->cbSize = sizeof(DBEVENTINFO);
psswdWindowData->pdbei->szModule = GetModuleName(psswdWindowData->hContact);
@@ -760,82 +741,78 @@ void SendSMSWindowDBAdd(HWND hWndDlg)
}
//
-void SendSMSWindowHItemSendSet(HWND hWndDlg,HTREEITEM hItemSend)
+void SendSMSWindowHItemSendSet(HWND hWndDlg, HTREEITEM hItemSend)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData)
- psswdWindowData->hItemSend=hItemSend;
+ psswdWindowData->hItemSend = hItemSend;
}
//
HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg)
{
- HTREEITEM hRet=NULL;
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ HTREEITEM hRet = NULL;
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) hRet=psswdWindowData->hItemSend;
+ if (psswdWindowData) hRet = psswdWindowData->hItemSend;
return hRet;
}
//
-HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg,HTREEITEM hItem)
+HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem)
{
- int isFound=0;
- HWND hWndTree=GetDlgItem(hWndDlg,IDC_NUMBERSLIST);
+ int isFound = 0;
+ HWND hWndTree = GetDlgItem(hWndDlg, IDC_NUMBERSLIST);
TVITEM tvi;
- HTREEITEM hItemNext,hItemChild;
+ HTREEITEM hItemNext, hItemChild;
- if (hItem==TreeView_GetRoot(hWndTree)) isFound=1;
+ if (hItem == TreeView_GetRoot(hWndTree)) isFound = 1;
- for(hItemNext=TreeView_GetRoot(hWndTree);hItemNext;hItemNext=TreeView_GetNextSibling(hWndTree,hItemNext))
- {
- if ((hItem==hItemNext) && (hItem!=TreeView_GetRoot(hWndTree)))
- {
- isFound=1;
+ for (hItemNext = TreeView_GetRoot(hWndTree); hItemNext; hItemNext = TreeView_GetNextSibling(hWndTree, hItemNext)) {
+ if ((hItem == hItemNext) && (hItem != TreeView_GetRoot(hWndTree))) {
+ isFound = 1;
continue;
}
- tvi.mask=(TVIF_IMAGE|TVIF_SELECTEDIMAGE);
- tvi.hItem=hItemNext;
- tvi.iImage=0;
- tvi.iSelectedImage=0;
- TreeView_GetItem(hWndTree,&tvi);
+ tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE);
+ tvi.hItem = hItemNext;
+ tvi.iImage = 0;
+ tvi.iSelectedImage = 0;
+ TreeView_GetItem(hWndTree, &tvi);
if (tvi.iImage || tvi.iSelectedImage)
- if (TreeView_GetChild(hWndTree,hItemNext))
- {
- for (hItemChild=TreeView_GetChild(hWndTree,hItemNext);hItemChild;hItemChild=TreeView_GetNextSibling(hWndTree,hItemChild))
- {
- if (hItem==hItemChild)
- {
- isFound=1;
- continue;
- }
+ if (TreeView_GetChild(hWndTree, hItemNext)) {
+ for (hItemChild = TreeView_GetChild(hWndTree, hItemNext); hItemChild; hItemChild = TreeView_GetNextSibling(hWndTree, hItemChild)) {
+ if (hItem == hItemChild) {
+ isFound = 1;
+ continue;
+ }
- tvi.mask=(TVIF_IMAGE|TVIF_SELECTEDIMAGE);
- tvi.hItem=hItemChild;
- tvi.iImage=0;
- tvi.iSelectedImage=0;
- TreeView_GetItem(hWndTree,&tvi);
+ tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE);
+ tvi.hItem = hItemChild;
+ tvi.iImage = 0;
+ tvi.iSelectedImage = 0;
+ TreeView_GetItem(hWndTree, &tvi);
- if (tvi.iImage || tvi.iSelectedImage)
- if (isFound)
- {
- return(hItemChild);
- }else{
- continue;
+ if (tvi.iImage || tvi.iSelectedImage)
+ if (isFound) {
+ return(hItemChild);
+ }
+ else {
+ continue;
+ }
}
}
- }else{
- if (isFound)
- {
- return(hItemNext);
- }else{
- continue;
+ else {
+ if (isFound) {
+ return(hItemNext);
+ }
+ else {
+ continue;
+ }
}
- }
}
-return(NULL);
+ return(NULL);
}
//This function get the HANDLE of an user. if there is already a SMS send window for this contact
@@ -843,23 +820,21 @@ return(NULL);
//The function gets the HANDLE of a contact and return HWND
HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact)
{
- HWND hRet=NULL;
+ HWND hRet = NULL;
SEND_SMS_WINDOW_DATA *psswdWindowData;
LIST_MT_ITERATOR lmtiIterator;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,&lmtiIterator);
- do
- {// öèêë
- if (ListMTIteratorGet(&lmtiIterator,NULL,(LPVOID*)&psswdWindowData)==NO_ERROR)
- if (psswdWindowData->hMyContact==hContact)
- {
- hRet=psswdWindowData->hWnd;
- break;
- }
- }while (ListMTIteratorMoveNext(&lmtiIterator));
+ ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
+ do {// öèêë
+ if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR)
+ if (psswdWindowData->hMyContact == hContact) {
+ hRet = psswdWindowData->hWnd;
+ break;
+ }
+ } while (ListMTIteratorMoveNext(&lmtiIterator));
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
-return(hRet);
+ return(hRet);
}
@@ -867,27 +842,27 @@ return(hRet);
void SendSMSWindowNext(HWND hWndDlg)
{
TCHAR tszPhone[MAX_PHONE_LEN];
- size_t dwPhoneSize,dwMessageSize;
- TVITEM tvi={0};
+ size_t dwPhoneSize, dwMessageSize;
+ TVITEM tvi = { 0 };
- dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
- LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
- if ( !lptszMessage)
+ dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
+ LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(TCHAR)));
+ if (!lptszMessage)
return;
- dwMessageSize = GetDlgItemText(hWndDlg,IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2);
-
-// if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE);
- tvi.mask=TVIF_TEXT;
- tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
- tvi.pszText=tszPhone;
- tvi.cchTextMax=_countof(tszPhone);
- TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
- TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem);
- dwPhoneSize=mir_wstrlen(tszPhone);
- SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
- StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lptszMessage,dwMessageSize);
- SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2);
+
+ // if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE);
+ tvi.mask = TVIF_TEXT;
+ tvi.hItem = SendSMSWindowHItemSendGet(hWndDlg);
+ tvi.pszText = tszPhone;
+ tvi.cchTextMax = _countof(tszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi);
+ TreeView_SelectItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), tvi.hItem);
+ dwPhoneSize = mir_wstrlen(tszPhone);
+ SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize);
+ StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lptszMessage, dwMessageSize);
+ SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL);
MEMFREE(lptszMessage);
}
@@ -897,24 +872,24 @@ void SendSMSWindowNext(HWND hWndDlg)
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//This function gets a HANDLE of a contact and add it to a list.
-void SendSMSWindowSMSContactAdd(HWND hWndDlg,MCONTACT hContact)
+void SendSMSWindowSMSContactAdd(HWND hWndDlg, MCONTACT hContact)
{
- SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if ( !psswdWindowData)
+ if (!psswdWindowData)
return;
psswdWindowData->dwContactsListCount++;
if (psswdWindowData->phContactsList)
- psswdWindowData->phContactsList = (MCONTACT*)MEMREALLOC(psswdWindowData->phContactsList,(sizeof(HANDLE)*psswdWindowData->dwContactsListCount));
+ psswdWindowData->phContactsList = (MCONTACT*)MEMREALLOC(psswdWindowData->phContactsList, (sizeof(HANDLE)*psswdWindowData->dwContactsListCount));
else
psswdWindowData->phContactsList = (MCONTACT*)MEMALLOC((sizeof(HANDLE)*psswdWindowData->dwContactsListCount));
- *(psswdWindowData->phContactsList+psswdWindowData->dwContactsListCount-1)=hContact;
+ *(psswdWindowData->phContactsList + psswdWindowData->dwContactsListCount - 1) = hContact;
}
//This function gets the number of the given contact in the combo list and return its contact.
-MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,size_t iNum)
+MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg, size_t iNum)
{
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
@@ -928,29 +903,26 @@ void SendSMSWindowSMSContactsRemove(HWND hWndDlg)
{
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData)
- {
+ if (psswdWindowData) {
MEMFREE(psswdWindowData->phContactsList);
- psswdWindowData->dwContactsListCount=0;
+ psswdWindowData->dwContactsListCount = 0;
}
}
void SendSMSWindowUpdateAccountList(HWND hWndDlg)
{
- if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount)
- {
- size_t i,dwCurSel;
+ if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount) {
+ size_t i, dwCurSel;
- dwCurSel=SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0);
- if (dwCurSel==-1) dwCurSel=DB_SMS_GetDword(NULL,"LastProto",0);
- if (dwCurSel==-1) dwCurSel=0;
+ dwCurSel = SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0);
+ if (dwCurSel == -1) dwCurSel = DB_SMS_GetDword(NULL, "LastProto", 0);
+ if (dwCurSel == -1) dwCurSel = 0;
- SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_RESETCONTENT,0,0);
- for(i=0;i<ssSMSSettings.dwSMSAccountsCount;i++)
- {
- SendDlgItemMessageA(hWndDlg,IDC_ACCOUNTS,CB_ADDSTRING,0,(LPARAM)ssSMSSettings.ppaSMSAccounts[i]->szModuleName);
+ SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_RESETCONTENT, 0, 0);
+ for (i = 0; i < ssSMSSettings.dwSMSAccountsCount; i++) {
+ SendDlgItemMessageA(hWndDlg, IDC_ACCOUNTS, CB_ADDSTRING, 0, (LPARAM)ssSMSSettings.ppaSMSAccounts[i]->szModuleName);
}
- SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_SETCURSEL,(WPARAM)dwCurSel,0);
+ SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_SETCURSEL, (WPARAM)dwCurSel, 0);
}
}
@@ -961,14 +933,12 @@ void SendSMSWindowsUpdateAllAccountLists()
LIST_MT_ITERATOR lmtiIterator;
ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
- ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,&lmtiIterator);
- do
- {// öèêë
- if (ListMTIteratorGet(&lmtiIterator,NULL,(LPVOID*)&psswdWindowData)==NO_ERROR)
- {
+ ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator);
+ do {// öèêë
+ if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) {
SendSMSWindowUpdateAccountList(psswdWindowData->hWnd);
}
- }while (ListMTIteratorMoveNext(&lmtiIterator));
+ } while (ListMTIteratorMoveNext(&lmtiIterator));
ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -979,147 +949,136 @@ void SendSMSWindowsUpdateAllAccountLists()
-void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList)
+void AddContactPhonesToComboToListParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList)
{
char szBuff[MAX_PATH];
- TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN];
- size_t i,dwPhoneSize;
-
- if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
- {
- tszPhone[0]='+';
- dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)tszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)tszPhone);
+ TCHAR tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN];
+ size_t i, dwPhoneSize;
+
+ if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) {
+ tszPhone[0] = '+';
+ dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ if (SendMessage(hWndList, CB_FINDSTRING, -1, (LPARAM)tszPhone) == CB_ERR) SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)tszPhone);
}
}
- for (i=0;TRUE;i++)
- {
- mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
- if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
- {
- tszPhone[0]='+';
- dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)tszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)tszPhone);
+ for (i = 0; TRUE; i++) {
+ mir_snprintf(szBuff, _countof(szBuff), "%s%ld", lpszValueName, i);
+ if (DB_GetStaticStringW(hContact, lpszModule, szBuff, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) {
+ tszPhone[0] = '+';
+ dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ if (SendMessage(hWndList, CB_FINDSTRING, -1, (LPARAM)tszPhone) == CB_ERR) SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)tszPhone);
}
- }else{
- if (i>PHONES_MIN_COUNT) break;
+ }
+ else {
+ if (i > PHONES_MIN_COUNT) break;
}
}
}
-void AddContactPhonesToCombo(HWND hWnd,MCONTACT hContact)
+void AddContactPhonesToCombo(HWND hWnd, MCONTACT hContact)
{
- HWND hWndList = GetDlgItem(hWnd,IDC_ADDRESS);
- SendDlgItemMessage(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0);
+ HWND hWndList = GetDlgItem(hWnd, IDC_ADDRESS);
+ SendDlgItemMessage(hWnd, IDC_ADDRESS, CB_RESETCONTENT, 0, 0);
LPSTR lpszProto = GetContactProto(hContact);
if (lpszProto) {
- AddContactPhonesToComboToListParam(hContact,lpszProto,"Phone",hWndList);
- AddContactPhonesToComboToListParam(hContact,lpszProto,"Cellular",hWndList);
- AddContactPhonesToComboToListParam(hContact,lpszProto,"Fax",hWndList);
+ AddContactPhonesToComboToListParam(hContact, lpszProto, "Phone", hWndList);
+ AddContactPhonesToComboToListParam(hContact, lpszProto, "Cellular", hWndList);
+ AddContactPhonesToComboToListParam(hContact, lpszProto, "Fax", hWndList);
}
- AddContactPhonesToComboToListParam(hContact,"UserInfo","MyPhone",hWndList);
- AddContactPhonesToComboToListParam(hContact,"UserInfo","Phone",hWndList);
- AddContactPhonesToComboToListParam(hContact,"UserInfo","Cellular",hWndList);
- AddContactPhonesToComboToListParam(hContact,"UserInfo","Fax",hWndList);
+ AddContactPhonesToComboToListParam(hContact, "UserInfo", "MyPhone", hWndList);
+ AddContactPhonesToComboToListParam(hContact, "UserInfo", "Phone", hWndList);
+ AddContactPhonesToComboToListParam(hContact, "UserInfo", "Cellular", hWndList);
+ AddContactPhonesToComboToListParam(hContact, "UserInfo", "Fax", hWndList);
- SendDlgItemMessage(hWnd,IDC_ADDRESS,CB_SETCURSEL,0,0);
+ SendDlgItemMessage(hWnd, IDC_ADDRESS, CB_SETCURSEL, 0, 0);
}
-void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList,HTREEITEM *phParent)
+void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList, HTREEITEM *phParent)
{
char szBuff[MAX_PATH];
- TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN];
- size_t i,dwPhoneSize;
- TVINSERTSTRUCT tvis={0};
-
- if (phParent) tvis.hParent=(*phParent);
- tvis.item.mask=(TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE);
- tvis.hInsertAfter=TVI_SORT;
- tvis.item.iImage=tvis.item.iSelectedImage=0;
-
- if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
- {
- tszPhone[0]='+';
- dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- if (tvis.hParent==NULL)
- {
+ TCHAR tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN];
+ size_t i, dwPhoneSize;
+ TVINSERTSTRUCT tvis = { 0 };
+
+ if (phParent) tvis.hParent = (*phParent);
+ tvis.item.mask = (TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE);
+ tvis.hInsertAfter = TVI_SORT;
+ tvis.item.iImage = tvis.item.iSelectedImage = 0;
+
+ if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) {
+ tszPhone[0] = '+';
+ dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ if (tvis.hParent == NULL) {
tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0);
- tvis.hParent=TreeView_InsertItem(hWndList, &tvis);
+ tvis.hParent = TreeView_InsertItem(hWndList, &tvis);
}
- tvis.item.pszText=tszPhone;
- TreeView_InsertItem(hWndList,&tvis);
+ tvis.item.pszText = tszPhone;
+ TreeView_InsertItem(hWndList, &tvis);
}
}
- for (i=0;TRUE;i++)
- {
- mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
- if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
- {
- tszPhone[0]='+';
- dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
- if (IsPhoneW(tszPhone,dwPhoneSize))
- {
- if (tvis.hParent==NULL)
- {
+ for (i = 0; TRUE; i++) {
+ mir_snprintf(szBuff, _countof(szBuff), "%s%ld", lpszValueName, i);
+ if (DB_GetStaticStringW(hContact, lpszModule, szBuff, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) {
+ tszPhone[0] = '+';
+ dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize);
+ if (IsPhoneW(tszPhone, dwPhoneSize)) {
+ if (tvis.hParent == NULL) {
tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0);
- tvis.hParent=TreeView_InsertItem(hWndList,&tvis);
+ tvis.hParent = TreeView_InsertItem(hWndList, &tvis);
}
- tvis.item.pszText=tszPhone;
- TreeView_InsertItem(hWndList,&tvis);
+ tvis.item.pszText = tszPhone;
+ TreeView_InsertItem(hWndList, &tvis);
}
- }else{
- if (i>PHONES_MIN_COUNT) break;
+ }
+ else {
+ if (i > PHONES_MIN_COUNT) break;
}
}
- if (phParent) (*phParent)=tvis.hParent;
+ if (phParent) (*phParent) = tvis.hParent;
}
void SendSMSWindowFillTreeView(HWND hWnd)
{
- HWND hWndTreeView=GetDlgItem(hWnd,IDC_NUMBERSLIST);
+ HWND hWndTreeView = GetDlgItem(hWnd, IDC_NUMBERSLIST);
TreeView_DeleteAllItems(hWndTreeView);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HTREEITEM hParent = NULL;
LPSTR lpszProto = GetContactProto(hContact);
if (lpszProto) {
- AddContactPhonesToTreeViewParam(hContact,lpszProto,"Phone",hWndTreeView,&hParent);
- AddContactPhonesToTreeViewParam(hContact,lpszProto,"Cellular",hWndTreeView,&hParent);
- AddContactPhonesToTreeViewParam(hContact,lpszProto,"Fax",hWndTreeView,&hParent);
+ AddContactPhonesToTreeViewParam(hContact, lpszProto, "Phone", hWndTreeView, &hParent);
+ AddContactPhonesToTreeViewParam(hContact, lpszProto, "Cellular", hWndTreeView, &hParent);
+ AddContactPhonesToTreeViewParam(hContact, lpszProto, "Fax", hWndTreeView, &hParent);
}
- AddContactPhonesToTreeViewParam(hContact,"UserInfo","MyPhone",hWndTreeView,&hParent);
- AddContactPhonesToTreeViewParam(hContact,"UserInfo","Phone",hWndTreeView,&hParent);
- AddContactPhonesToTreeViewParam(hContact,"UserInfo","Cellular",hWndTreeView,&hParent);
- AddContactPhonesToTreeViewParam(hContact,"UserInfo","Fax",hWndTreeView,&hParent);
- }
+ AddContactPhonesToTreeViewParam(hContact, "UserInfo", "MyPhone", hWndTreeView, &hParent);
+ AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Phone", hWndTreeView, &hParent);
+ AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Cellular", hWndTreeView, &hParent);
+ AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Fax", hWndTreeView, &hParent);
+ }
}
size_t GetSMSMessageLenMax(HWND hWndDlg)
{
- size_t dwMessageSize,dwLenght=160;
-
- dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
- LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
- if (lptszMessage)
- {
- dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2);
+ size_t dwMessageSize, dwLenght = 160;
+
+ dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
+ LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(TCHAR)));
+ if (lptszMessage) {
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2);
if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, NULL, 0, NULL, NULL))
dwLenght = 70;
MEMFREE(lptszMessage);
}
-return(dwLenght);
+ return(dwLenght);
}
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 20520f937c..4de574d6f3 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -149,7 +149,7 @@ static int ackevent(WPARAM, LPARAM lParam)
dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1;
dbei.pBlob = (PBYTE)item->sendBuffer;
- MessageWindowEvent evt = { sizeof(evt), (int)item->hSendId, hContact, &dbei };
+ MessageWindowEvent evt = { sizeof(evt), (INT_PTR)item->hSendId, hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
item->sendBuffer = (char *)dbei.pBlob;
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp
index aea6b87cd8..eb48aeb5e7 100644
--- a/plugins/Scriver/src/msgwindow.cpp
+++ b/plugins/Scriver/src/msgwindow.cpp
@@ -555,7 +555,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
while (GetParent(hParent) != NULL)
hParent = GetParent(hParent);
- hParent = WindowList_Find(g_dat.hParentWindowList, (MCONTACT)hParent);
+ hParent = WindowList_Find(g_dat.hParentWindowList, (UINT_PTR)hParent);
if ((hParent != NULL && hParent != GetParent(hwnd)) || (hParent == NULL && mwtd->parent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) {
if (hParent == NULL) {
RECT rc, rcDesktop;
@@ -775,7 +775,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->prev != NULL)
dat->prev->next = dat;
- WindowList_Add(g_dat.hParentWindowList, hwndDlg, (MCONTACT)hwndDlg);
+ WindowList_Add(g_dat.hParentWindowList, hwndDlg, (UINT_PTR)hwndDlg);
SubclassTabCtrl(dat->hwndTabs);
SetContainerWindowStyle(dat);
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp
index b43c516716..097ce2b873 100644
--- a/plugins/SecureIM/src/crypt_misc.cpp
+++ b/plugins/SecureIM/src/crypt_misc.cpp
@@ -2,7 +2,7 @@
static void sttWaitForExchange(LPVOID param)
{
- MCONTACT hContact = (MCONTACT)param;
+ MCONTACT hContact = (UINT_PTR)param;
pUinKey ptr = getUinKey(hContact);
if (!ptr)
return;
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp
index 4618c1661d..cb71969c54 100644
--- a/plugins/Sessions/Src/Options.cpp
+++ b/plugins/Sessions/Src/Options.cpp
@@ -233,7 +233,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
switch (GetDlgCtrlID((HWND)lparam)) {
case IDC_OPCLIST:
SetBkMode((HDC)wparam, TRANSPARENT);
- return (BOOL)CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_3DFACE));
}
break;
@@ -271,7 +271,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
case CLN_CHECKCHANGED:
if (((LPNMHDR)lparam)->idFrom == IDC_EMCLIST) {
- int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem;
+ int iSelection = (INT_PTR)((NMCLISTCONTROL *)lparam)->hItem;
MCONTACT hContact = db_find_first();
for (; hContact; hContact = db_find_next(hContact))
if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, hContact, 0) == iSelection)
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index af010d17b8..b23255df43 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -443,7 +443,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
bct->stateId = PBS_PRESSED;
else if (LOWORD(lParam) > rc.right - 12) {
if (GetDlgCtrlID(hwndDlg) == IDOK || bct->stateId != PBS_DISABLED) {
- WORD w = (WORD)((int)bct->arrow & 0x0000ffff);
+ WORD w = (WORD)((INT_PTR)bct->arrow & 0x0000ffff);
SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(w, BN_CLICKED), (LPARAM)hwndDlg);
}
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index 235c38c5e0..d33f093eba 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -665,10 +665,10 @@ char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex)
for (USERINFO *ui = si->pUsers; ui; ui = ui->next) {
if (!mir_tstrcmp(ui->pszNick, ptszNick)) {
STATUSINFO *ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status));
- if (ti && (int)ti->hIcon < si->iStatusCount) {
+ if (ti && (INT_PTR)ti->hIcon < si->iStatusCount) {
if (iNickIndex)
- *iNickIndex = (int)ti->hIcon; // color table's index is not zero-based
- return szIndicators[(int)ti->hIcon];
+ *iNickIndex = (INT_PTR)ti->hIcon; // color table's index is not zero-based
+ return szIndicators[(INT_PTR)ti->hIcon];
}
break;
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 13168f2bf6..36b9de0126 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -979,7 +979,7 @@ void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam)
static void LoadKLThread(LPVOID _param)
{
DBVARIANT dbv;
- if (!db_get_ts((MCONTACT)_param, SRMSGMOD_T, "locale", &dbv)) {
+ if (!db_get_ts((UINT_PTR)_param, SRMSGMOD_T, "locale", &dbv)) {
HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0);
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)_param, (LPARAM)hkl);
db_free(&dbv);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 0ae4b867f5..161431984b 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -273,7 +273,7 @@ void CSendLater::processContacts()
{
if (m_fAvail && m_sendLaterContactList.getCount() != 0) {
for (int i = 0; i < m_sendLaterContactList.getCount(); i++)
- processSingleContact((MCONTACT)m_sendLaterContactList[i]);
+ processSingleContact((UINT_PTR)m_sendLaterContactList[i]);
m_sendLaterContactList.destroy();
}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index ea7977b5c6..9824a8f5a8 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -119,7 +119,7 @@ entry_found:
static void DoSplitSendA(LPVOID param)
{
- SendJob *job = sendQueue->getJobByIndex((int)param);
+ SendJob *job = sendQueue->getJobByIndex((INT_PTR)param);
size_t iLen = mir_strlen(job->szSendBuffer);
ptrA szBegin((char*)mir_alloc(iLen + 1));
@@ -575,7 +575,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
dbei.flags |= DBEF_UTF;
dbei.pBlob = (PBYTE)job.szSendBuffer;
- MessageWindowEvent evt = { sizeof(evt), (int)job.hSendId, job.hContact, &dbei };
+ MessageWindowEvent evt = { sizeof(evt), (INT_PTR)job.hSendId, job.hContact, &dbei };
NotifyEventHooks(PluginConfig.m_event_WriteEvent, 0, (LPARAM)&evt);
job.szSendBuffer = (char*)dbei.pBlob;
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 7b46ddfd96..e5f6ba8cd7 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -1328,7 +1328,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL))
::ShowWindow(hwnd, SW_SHOWNORMAL);
- WindowList_Add(hWindowList, hwnd, (MCONTACT)hwnd);
+ WindowList_Add(hWindowList, hwnd, (UINT_PTR)hwnd);
}
return TRUE;
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index 20f5e3476a..b790468edb 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -432,7 +432,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
- WErrorPopup((MCONTACT)contactname, TranslateT("Cannot read from file"));
+ WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
fread(cachecompare, sizeof(cachecompare), 1, pcachefile);
@@ -441,7 +441,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
// write to cache
if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL)
- WErrorPopup((MCONTACT)contactname, TranslateT("Cannot write to file 1"));
+ WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 1"));
else {
fwrite(tempraw, mir_strlen(tempraw), 1, pcachefile); //smaller cache
fclose(pcachefile);
@@ -644,7 +644,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
- WErrorPopup((MCONTACT)contactname, TranslateT("Cannot read from file"));
+ WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
fread(cachecompare, sizeof(cachecompare), 1, pcachefile);
@@ -653,7 +653,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
// write to cache
if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL)
- WErrorPopup((MCONTACT)contactname, TranslateT("Cannot write to file 2"));
+ WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 2"));
else {
fwrite(raw, mir_strlen(raw), 1, pcachefile); //smaller cache
db_set_ts(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath);
@@ -791,7 +791,7 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM)
/*****************************************************************************/
void ReadFromFile(void *param)
{
- MCONTACT hContact = (MCONTACT)param;
+ MCONTACT hContact = (UINT_PTR)param;
DBVARIANT dbv;
char truncated[MAXSIZE1];
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index d47a621713..80472ae058 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -60,7 +60,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
for (int i=0; i < _countof(szInvalidChars); i++ ) {
TCHAR *p = _tcschr(nick, szInvalidChars[i]);
if (p != NULL) {
- WErrorPopup((MCONTACT)"ERROR", TranslateT("Invalid symbol present in contact name."));
+ WErrorPopup((UINT_PTR)"ERROR", TranslateT("Invalid symbol present in contact name."));
*p = '_';
invalidpresent =1;
}
@@ -149,10 +149,10 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM)
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend);
+ mir_sntprintf(cachedirectorypath, _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend);
if( _taccess(cachedirectorypath, 0) != 0)
- WErrorPopup((MCONTACT)"ERROR", TranslateT("Cache folder does not exist."));
+ WErrorPopup((UINT_PTR)"ERROR", TranslateT("Cache folder does not exist."));
else
ShellExecute(NULL, _T("open"), cachedirectorypath, NULL, NULL, SW_SHOWNORMAL);
return 0;
@@ -163,7 +163,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM)
{
FILE *pfile = fopen("psite.bat", "r");
if (pfile == NULL) {
- WErrorPopup((MCONTACT)"ERROR", TranslateT("Missing \"psite.bat\" file."));
+ WErrorPopup((UINT_PTR)"ERROR", TranslateT("Missing \"psite.bat\" file."));
return 0;
}
@@ -344,7 +344,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
if (psr == NULL)
return 0;
if (psr->nick.t == NULL) {
- WErrorPopup((MCONTACT)"ERROR", TranslateT("Please select site in Find/Add contacts..."));
+ WErrorPopup((UINT_PTR)"ERROR", TranslateT("Please select site in Find/Add contacts..."));
return 0;
}
// if contact with the same ID was not found, add it
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 433d0cbc70..8de3bac10b 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -502,7 +502,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags)
lfoundi = 0;
}
- NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (MCONTACT)ActualAccount;
+ NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NewMailPopup.lchIcon = g_LoadIconEx(2);
NewMailPopup.colorBack = nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupB : GetSysColor(COLOR_BTNFACE);
NewMailPopup.colorText = nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT);
@@ -664,7 +664,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
(MN->Real.PopupRun + MN->Virtual.PopupRun)) {
POPUPDATAT NewMailPopup = { 0 };
- NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (MCONTACT)ActualAccount;
+ NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NewMailPopup.lchIcon = g_LoadIconEx(2);
NewMailPopup.colorBack = nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupB : GetSysColor(COLOR_BTNFACE);
NewMailPopup.colorText = nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT);
@@ -759,7 +759,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
if ((nnflags & YAMN_ACC_POP) && (MN->Real.PopupRun + MN->Virtual.PopupRun == 0)) {
POPUPDATAT NoNewMailPopup;
- NoNewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (MCONTACT)ActualAccount;
+ NoNewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
NoNewMailPopup.lchIcon = g_LoadIconEx(1);
NoNewMailPopup.colorBack = ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopupB : GetSysColor(COLOR_BTNFACE);
NoNewMailPopup.colorText = ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT);
@@ -1434,7 +1434,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (MailParam->mail->Flags & YAMN_MSG_UNSEEN) {
MailParam->mail->Flags &= ~YAMN_MSG_UNSEEN; //mark the message as seen
HWND hMailBrowser;
- if (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (MCONTACT)MailParam->account)) {
+ if (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)MailParam->account)) {
struct CChangeContent Params = { MailParam->account->NewMailN.Flags | YAMN_ACC_MSGP, MailParam->account->NoNewMailN.Flags | YAMN_ACC_MSGP };
SendMessageW(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)MailParam->account, (LPARAM)&Params);
}
@@ -1706,7 +1706,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
ReadDoneFcn(ActualAccount->AccountAccessSO);
WindowList_Add(YAMNVar.MessageWnds, hDlg, NULL);
- WindowList_Add(YAMNVar.NewMailAccountWnd, hDlg, (MCONTACT)ActualAccount);
+ WindowList_Add(YAMNVar.NewMailAccountWnd, hDlg, (UINT_PTR)ActualAccount);
{
TCHAR accstatus[512];
@@ -2444,7 +2444,7 @@ void __cdecl MailBrowser(void *Param)
#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
- if (NULL != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (MCONTACT)ActualAccount)))
+ if (NULL != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount)))
WndFound = TRUE;
if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) {
hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam);
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp
index 6a516beff6..98f227bf41 100644
--- a/plugins/wbOSD/src/events.cpp
+++ b/plugins/wbOSD/src/events.cpp
@@ -27,7 +27,7 @@ LRESULT ShowOSD(TCHAR *str, int timeout, COLORREF color, MCONTACT user)
{
logmsg("ShowOSD");
- if (!hwnd)
+ if (!g_hWnd)
return 0;
if (timeout==0)
@@ -40,7 +40,7 @@ LRESULT ShowOSD(TCHAR *str, int timeout, COLORREF color, MCONTACT user)
om.param=(unsigned int)user;
om.callback=showmsgwnd;
- return SendMessage(hwnd, WM_USER+4, (WPARAM)&om, 0);
+ return SendMessage(g_hWnd, WM_USER+4, (WPARAM)&om, 0);
}
int ProtoAck(WPARAM,LPARAM lparam)
diff --git a/plugins/wbOSD/src/main.cpp b/plugins/wbOSD/src/main.cpp
index 1184e615ed..570cbe6de5 100644
--- a/plugins/wbOSD/src/main.cpp
+++ b/plugins/wbOSD/src/main.cpp
@@ -11,11 +11,11 @@ Distributed under GNU's GPL 2 or later
HINSTANCE hI;
-HWND hwnd=0;
+HWND g_hWnd = 0;
HANDLE hservosda;
int hLangpack = 0;
CLIST_INTERFACE *pcli;
-HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown;
+HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged;
void logmsg2(char *str);
int MainInit(WPARAM,LPARAM);
@@ -58,11 +58,9 @@ extern "C" __declspec(dllexport) int Load()
extern "C" __declspec(dllexport) int Unload()
{
logmsg("Unload");
- UnhookEvent(hpluginShutDown);
UnhookEvent(hProtoAck);
UnhookEvent(hContactSettingChanged);
UnhookEvent(hContactStatusChanged);
- UnhookEvent(hHookedNewEvent);
UnhookEvent(hHookedInit);
DestroyServiceFunction(hservosda);
diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp
index 911f0da024..6f9dd76a48 100644
--- a/plugins/wbOSD/src/options.cpp
+++ b/plugins/wbOSD/src/options.cpp
@@ -11,38 +11,38 @@ Distributed under GNU's GPL 2 or later
COLORREF pencustcolors[16];
-const static osdmsg defstr={_T(""), 0, RGB(0, 0, 0), 0, 0};
+const static osdmsg defstr = { _T(""), 0, RGB(0, 0, 0), 0, 0 };
-void FillCheckBoxTree(HWND hwndTree,DWORD style)
+void FillCheckBoxTree(HWND hwndTree, DWORD style)
{
logmsg("FillCheckBoxTree");
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = { 0 };
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
- for ( WORD status = ID_STATUS_OFFLINE; status <=ID_STATUS_OUTTOLUNCH; status++ ) {
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ for (WORD status = ID_STATUS_OFFLINE; status <= ID_STATUS_OUTTOLUNCH; status++) {
tvis.item.lParam = status - ID_STATUS_OFFLINE;
tvis.item.pszText = pcli->pfnGetStatusModeDescription(status, 0);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(( style & ( 1 << tvis.item.lParam )) != 0 ? 2 : 1 );
- TreeView_InsertItem( hwndTree, &tvis );
+ tvis.item.state = INDEXTOSTATEIMAGEMASK((style & (1 << tvis.item.lParam)) != 0 ? 2 : 1);
+ TreeView_InsertItem(hwndTree, &tvis);
}
}
DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
{
- DWORD flags=0;
+ DWORD flags = 0;
logmsg("MakeCheckBoxTreeFlags");
- TVITEM tvi = {0};
- tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_STATE;
- tvi.hItem=TreeView_GetRoot(hwndTree);
- while(tvi.hItem) {
- TreeView_GetItem(hwndTree,&tvi);
- if(((tvi.state&TVIS_STATEIMAGEMASK)>>12==2)) flags|=1<<tvi.lParam;
- tvi.hItem=TreeView_GetNextSibling(hwndTree,tvi.hItem);
+ TVITEM tvi = { 0 };
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+ while (tvi.hItem) {
+ TreeView_GetItem(hwndTree, &tvi);
+ if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 2)) flags |= 1 << tvi.lParam;
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return flags;
}
@@ -51,23 +51,23 @@ int selectColor(HWND hwnd, COLORREF *clr)
{
logmsg("SelectColor");
- CHOOSECOLOR cc = {0};
+ CHOOSECOLOR cc = { 0 };
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hwnd;
cc.hInstance = (HWND)hI;
cc.rgbResult = *clr;
cc.lpCustColors = pencustcolors;
- cc.Flags = CC_FULLOPEN|CC_RGBINIT;
+ cc.Flags = CC_FULLOPEN | CC_RGBINIT;
if (!ChooseColor(&cc))
return 1;
-
- *clr=cc.rgbResult;
+
+ *clr = cc.rgbResult;
return 0;
}
int selectFont(HWND hDlg, LOGFONT *lf)
{
- COLORREF color=RGB(0, 0, 0);
+ COLORREF color = RGB(0, 0, 0);
logmsg("SelectFont");
@@ -82,19 +82,19 @@ int selectFont(HWND hDlg, LOGFONT *lf)
cf.rgbColors = 0;
cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_EFFECTS | CF_BOTH | CF_FORCEFONTEXIST;
cf.nFontType = 0;
- cf.rgbColors=color;
-
+ cf.rgbColors = color;
+
if (!ChooseFont(&cf)) {
if (cf.hDC)
DeleteDC(cf.hDC);
-
+
ReleaseDC(hDlg, hDC);
return 1;
}
-
+
if (cf.hDC)
DeleteDC(cf.hDC);
-
+
ReleaseDC(hDlg, hDC);
return 0;
}
@@ -103,53 +103,53 @@ void loadDBSettings(plgsettings *ps)
{
logmsg("loadDBSettings");
- ps->align=db_get_b(NULL,THIS_MODULE, "align", DEFAULT_ALIGN);
- ps->salign=db_get_b(NULL,THIS_MODULE, "salign", DEFAULT_SALIGN);
- ps->altShadow=db_get_b(NULL,THIS_MODULE, "altShadow", DEFAULT_ALTSHADOW);
- ps->transparent=db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT);
- ps->showShadow=db_get_b(NULL,THIS_MODULE, "showShadow", DEFAULT_SHOWSHADOW);
- ps->messages=db_get_b(NULL,THIS_MODULE, "messages", DEFAULT_ANNOUNCEMESSAGES);
- ps->a_user=db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS);
- ps->distance=db_get_b(NULL,THIS_MODULE, "distance", DEFAULT_DISTANCE);
- ps->winx=db_get_dw(NULL,THIS_MODULE, "winx", DEFAULT_WINX);
- ps->winy=db_get_dw(NULL,THIS_MODULE, "winy", DEFAULT_WINY);
- ps->winxpos=db_get_dw(NULL,THIS_MODULE, "winxpos", DEFAULT_WINXPOS);
- ps->winypos=db_get_dw(NULL,THIS_MODULE, "winypos", DEFAULT_WINYPOS);
- ps->alpha=db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA);
- ps->showmystatus=db_get_b(NULL,THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS);
- ps->timeout=db_get_dw(NULL,THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
- ps->clr_msg=db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
- ps->clr_status=db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS);
- ps->clr_shadow=db_get_dw(NULL,THIS_MODULE, "clr_shadow", DEFAULT_CLRSHADOW);
- ps->bkclr=db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR);
-
- ps->showMsgWindow=db_get_b(NULL,THIS_MODULE, "showMessageWindow", DEFAULT_SHOWMSGWIN);
- ps->showWhen=db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN);
-
+ ps->align = db_get_b(NULL, THIS_MODULE, "align", DEFAULT_ALIGN);
+ ps->salign = db_get_b(NULL, THIS_MODULE, "salign", DEFAULT_SALIGN);
+ ps->altShadow = db_get_b(NULL, THIS_MODULE, "altShadow", DEFAULT_ALTSHADOW);
+ ps->transparent = db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT);
+ ps->showShadow = db_get_b(NULL, THIS_MODULE, "showShadow", DEFAULT_SHOWSHADOW);
+ ps->messages = db_get_b(NULL, THIS_MODULE, "messages", DEFAULT_ANNOUNCEMESSAGES);
+ ps->a_user = db_get_b(NULL, THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS);
+ ps->distance = db_get_b(NULL, THIS_MODULE, "distance", DEFAULT_DISTANCE);
+ ps->winx = db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX);
+ ps->winy = db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY);
+ ps->winxpos = db_get_dw(NULL, THIS_MODULE, "winxpos", DEFAULT_WINXPOS);
+ ps->winypos = db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS);
+ ps->alpha = db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA);
+ ps->showmystatus = db_get_b(NULL, THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS);
+ ps->timeout = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
+ ps->clr_msg = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
+ ps->clr_status = db_get_dw(NULL, THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS);
+ ps->clr_shadow = db_get_dw(NULL, THIS_MODULE, "clr_shadow", DEFAULT_CLRSHADOW);
+ ps->bkclr = db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR);
+
+ ps->showMsgWindow = db_get_b(NULL, THIS_MODULE, "showMessageWindow", DEFAULT_SHOWMSGWIN);
+ ps->showWhen = db_get_dw(NULL, THIS_MODULE, "showWhen", DEFAULT_SHOWWHEN);
+
DBVARIANT dbv;
- if (!db_get_ts( NULL, THIS_MODULE, "message_format", &dbv )) {
+ if (!db_get_ts(NULL, THIS_MODULE, "message_format", &dbv)) {
mir_tstrcpy(ps->msgformat, dbv.ptszVal);
db_free(&dbv);
}
else mir_tstrcpy(ps->msgformat, DEFAULT_MESSAGEFORMAT);
- ps->announce=db_get_dw(NULL,THIS_MODULE,"announce", DEFAULT_ANNOUNCE);
-
- ps->lf.lfHeight=db_get_dw(NULL,THIS_MODULE, "fntHeight", DEFAULT_FNT_HEIGHT);
- ps->lf.lfWidth=db_get_dw(NULL,THIS_MODULE, "fntWidth", DEFAULT_FNT_WIDTH);
- ps->lf.lfEscapement=db_get_dw(NULL,THIS_MODULE, "fntEscapement", DEFAULT_FNT_ESCAPEMENT);
- ps->lf.lfOrientation=db_get_dw(NULL,THIS_MODULE, "fntOrientation", DEFAULT_FNT_ORIENTATION);
- ps->lf.lfWeight=db_get_dw(NULL,THIS_MODULE, "fntWeight", DEFAULT_FNT_WEIGHT);
- ps->lf.lfItalic=db_get_b(NULL,THIS_MODULE, "fntItalic", DEFAULT_FNT_ITALIC);
- ps->lf.lfUnderline=db_get_b(NULL,THIS_MODULE, "fntUnderline", DEFAULT_FNT_UNDERLINE);
- ps->lf.lfStrikeOut=db_get_b(NULL,THIS_MODULE, "fntStrikeout", DEFAULT_FNT_STRIKEOUT);
- ps->lf.lfCharSet=db_get_b(NULL,THIS_MODULE, "fntCharSet", DEFAULT_FNT_CHARSET);
- ps->lf.lfOutPrecision=db_get_b(NULL,THIS_MODULE, "fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
- ps->lf.lfClipPrecision=db_get_b(NULL,THIS_MODULE, "fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
- ps->lf.lfQuality=db_get_b(NULL,THIS_MODULE, "fntQuality", DEFAULT_FNT_QUALITY);
- ps->lf.lfPitchAndFamily=db_get_b(NULL,THIS_MODULE, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
-
- if(!db_get_ts(NULL,THIS_MODULE,"fntFaceName",&dbv)) {
+ ps->announce = db_get_dw(NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE);
+
+ ps->lf.lfHeight = db_get_dw(NULL, THIS_MODULE, "fntHeight", DEFAULT_FNT_HEIGHT);
+ ps->lf.lfWidth = db_get_dw(NULL, THIS_MODULE, "fntWidth", DEFAULT_FNT_WIDTH);
+ ps->lf.lfEscapement = db_get_dw(NULL, THIS_MODULE, "fntEscapement", DEFAULT_FNT_ESCAPEMENT);
+ ps->lf.lfOrientation = db_get_dw(NULL, THIS_MODULE, "fntOrientation", DEFAULT_FNT_ORIENTATION);
+ ps->lf.lfWeight = db_get_dw(NULL, THIS_MODULE, "fntWeight", DEFAULT_FNT_WEIGHT);
+ ps->lf.lfItalic = db_get_b(NULL, THIS_MODULE, "fntItalic", DEFAULT_FNT_ITALIC);
+ ps->lf.lfUnderline = db_get_b(NULL, THIS_MODULE, "fntUnderline", DEFAULT_FNT_UNDERLINE);
+ ps->lf.lfStrikeOut = db_get_b(NULL, THIS_MODULE, "fntStrikeout", DEFAULT_FNT_STRIKEOUT);
+ ps->lf.lfCharSet = db_get_b(NULL, THIS_MODULE, "fntCharSet", DEFAULT_FNT_CHARSET);
+ ps->lf.lfOutPrecision = db_get_b(NULL, THIS_MODULE, "fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
+ ps->lf.lfClipPrecision = db_get_b(NULL, THIS_MODULE, "fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
+ ps->lf.lfQuality = db_get_b(NULL, THIS_MODULE, "fntQuality", DEFAULT_FNT_QUALITY);
+ ps->lf.lfPitchAndFamily = db_get_b(NULL, THIS_MODULE, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
+
+ if (!db_get_ts(NULL, THIS_MODULE, "fntFaceName", &dbv)) {
mir_tstrcpy(ps->lf.lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
@@ -161,259 +161,263 @@ void saveDBSettings(plgsettings *ps)
{
logmsg("saveDBSettings");
- db_set_b(NULL,THIS_MODULE,"showShadow", ps->showShadow);
- db_set_b(NULL,THIS_MODULE,"altShadow",ps->altShadow);
- db_set_b(NULL,THIS_MODULE,"distance",ps->distance);
-
- db_set_dw(NULL,THIS_MODULE,"winx",ps->winx);
- db_set_dw(NULL,THIS_MODULE,"winy",ps->winy);
- db_set_dw(NULL,THIS_MODULE,"winxpos", ps->winxpos);
- db_set_dw(NULL,THIS_MODULE,"winypos", ps->winypos);
-
- db_set_b(NULL,THIS_MODULE,"alpha",ps->alpha);
- db_set_dw(NULL,THIS_MODULE,"timeout", ps->timeout);
-
- db_set_b(NULL,THIS_MODULE,"transparent",ps->transparent);
- db_set_b(NULL,THIS_MODULE,"messages",ps->messages);
- db_set_b(NULL,THIS_MODULE,"a_user",ps->a_user);
- db_set_ts(NULL,THIS_MODULE, "message_format", ps->msgformat);
-
- db_set_b(NULL,THIS_MODULE,"align",ps->align);
- db_set_b(NULL,THIS_MODULE,"salign",ps->salign);
-
- db_set_b(NULL,THIS_MODULE,"showMyStatus",ps->showmystatus);
-
- db_set_dw(NULL,THIS_MODULE,"clr_msg", ps->clr_msg);
- db_set_dw(NULL,THIS_MODULE,"clr_shadow", ps->clr_shadow);
- db_set_dw(NULL,THIS_MODULE,"clr_status", ps->clr_status);
- db_set_dw(NULL,THIS_MODULE,"bkclr", ps->bkclr);
-
- db_set_dw(NULL,THIS_MODULE, "fntHeight", ps->lf.lfHeight);
- db_set_dw(NULL,THIS_MODULE, "fntWidth", ps->lf.lfWidth);
- db_set_dw(NULL,THIS_MODULE, "fntEscapement", ps->lf.lfEscapement);
- db_set_dw(NULL,THIS_MODULE, "fntOrientation", ps->lf.lfOrientation);
- db_set_dw(NULL,THIS_MODULE, "fntWeight", ps->lf.lfWeight);
- db_set_b(NULL,THIS_MODULE, "fntItalic", ps->lf.lfItalic);
- db_set_b(NULL,THIS_MODULE, "fntUnderline", ps->lf.lfUnderline);
- db_set_b(NULL,THIS_MODULE, "fntStrikeout", ps->lf.lfStrikeOut);
- db_set_b(NULL,THIS_MODULE, "fntCharSet", ps->lf.lfCharSet);
- db_set_b(NULL,THIS_MODULE, "fntOutPrecision", ps->lf.lfOutPrecision);
- db_set_b(NULL,THIS_MODULE, "fntClipPrecision", ps->lf.lfClipPrecision);
- db_set_b(NULL,THIS_MODULE, "fntQuality", ps->lf.lfQuality);
- db_set_b(NULL,THIS_MODULE, "fntPitchAndFamily", ps->lf.lfPitchAndFamily);
- db_set_ts(NULL,THIS_MODULE, "fntFaceName", ps->lf.lfFaceName);
-
- db_set_dw(NULL,THIS_MODULE,"announce", ps->announce);
-
- db_set_b(NULL,THIS_MODULE, "showMessageWindow", ps->showMsgWindow);
- db_set_dw(NULL,THIS_MODULE,"showWhen", ps->showWhen);
+ db_set_b(NULL, THIS_MODULE, "showShadow", ps->showShadow);
+ db_set_b(NULL, THIS_MODULE, "altShadow", ps->altShadow);
+ db_set_b(NULL, THIS_MODULE, "distance", ps->distance);
+
+ db_set_dw(NULL, THIS_MODULE, "winx", ps->winx);
+ db_set_dw(NULL, THIS_MODULE, "winy", ps->winy);
+ db_set_dw(NULL, THIS_MODULE, "winxpos", ps->winxpos);
+ db_set_dw(NULL, THIS_MODULE, "winypos", ps->winypos);
+
+ db_set_b(NULL, THIS_MODULE, "alpha", ps->alpha);
+ db_set_dw(NULL, THIS_MODULE, "timeout", ps->timeout);
+
+ db_set_b(NULL, THIS_MODULE, "transparent", ps->transparent);
+ db_set_b(NULL, THIS_MODULE, "messages", ps->messages);
+ db_set_b(NULL, THIS_MODULE, "a_user", ps->a_user);
+ db_set_ts(NULL, THIS_MODULE, "message_format", ps->msgformat);
+
+ db_set_b(NULL, THIS_MODULE, "align", ps->align);
+ db_set_b(NULL, THIS_MODULE, "salign", ps->salign);
+
+ db_set_b(NULL, THIS_MODULE, "showMyStatus", ps->showmystatus);
+
+ db_set_dw(NULL, THIS_MODULE, "clr_msg", ps->clr_msg);
+ db_set_dw(NULL, THIS_MODULE, "clr_shadow", ps->clr_shadow);
+ db_set_dw(NULL, THIS_MODULE, "clr_status", ps->clr_status);
+ db_set_dw(NULL, THIS_MODULE, "bkclr", ps->bkclr);
+
+ db_set_dw(NULL, THIS_MODULE, "fntHeight", ps->lf.lfHeight);
+ db_set_dw(NULL, THIS_MODULE, "fntWidth", ps->lf.lfWidth);
+ db_set_dw(NULL, THIS_MODULE, "fntEscapement", ps->lf.lfEscapement);
+ db_set_dw(NULL, THIS_MODULE, "fntOrientation", ps->lf.lfOrientation);
+ db_set_dw(NULL, THIS_MODULE, "fntWeight", ps->lf.lfWeight);
+ db_set_b(NULL, THIS_MODULE, "fntItalic", ps->lf.lfItalic);
+ db_set_b(NULL, THIS_MODULE, "fntUnderline", ps->lf.lfUnderline);
+ db_set_b(NULL, THIS_MODULE, "fntStrikeout", ps->lf.lfStrikeOut);
+ db_set_b(NULL, THIS_MODULE, "fntCharSet", ps->lf.lfCharSet);
+ db_set_b(NULL, THIS_MODULE, "fntOutPrecision", ps->lf.lfOutPrecision);
+ db_set_b(NULL, THIS_MODULE, "fntClipPrecision", ps->lf.lfClipPrecision);
+ db_set_b(NULL, THIS_MODULE, "fntQuality", ps->lf.lfQuality);
+ db_set_b(NULL, THIS_MODULE, "fntPitchAndFamily", ps->lf.lfPitchAndFamily);
+ db_set_ts(NULL, THIS_MODULE, "fntFaceName", ps->lf.lfFaceName);
+
+ db_set_dw(NULL, THIS_MODULE, "announce", ps->announce);
+
+ db_set_b(NULL, THIS_MODULE, "showMessageWindow", ps->showMsgWindow);
+ db_set_dw(NULL, THIS_MODULE, "showWhen", ps->showWhen);
}
-INT_PTR CALLBACK OptDlgProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
RECT rect;
plgsettings *ps; //0: current; 1: original
logmsg("OptDlgProc");
- switch(msg){
- case WM_INITDIALOG:
- logmsg("OptDlgProc::INITDIALOG");
- TranslateDialogDefault(hDlg);
-
- ps=(plgsettings*)malloc(sizeof(plgsettings)*2);
- loadDBSettings(&ps[0]);
- ps[1]=ps[0];
- SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps);
- SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED);
-
- SetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE2),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
-
- CheckDlgButton(hDlg, IDC_RADIO1+ps->align-1, BST_CHECKED);
- CheckDlgButton(hDlg, IDC_RADIO10+9-ps->salign, BST_CHECKED);
- CheckDlgButton(hDlg, IDC_CHECK1, ps->altShadow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK2, ps->showMsgWindow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK3, ps->transparent ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK4, ps->showShadow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK5, ps->messages ? BST_CHECKED : BST_UNCHECKED);
-
- SetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat);
-
- CheckDlgButton(hDlg, IDC_CHECK6, ps->a_user ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK7, ps->showmystatus ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hDlg, IDC_EDIT1, ps->distance, 0);
-
- SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(0, 255));
- SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETPOS, TRUE, (LPARAM)ps->alpha);
-
- {
- TCHAR buf[20];
- mir_sntprintf(buf, _T("%d %%"), ps->alpha*100/255);
- SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
- }
-
- SetDlgItemInt(hDlg, IDC_EDIT5, ps->timeout, 0);
- FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE1), ps->announce);
- FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE2), ps->showWhen);
+ switch (msg) {
+ case WM_INITDIALOG:
+ logmsg("OptDlgProc::INITDIALOG");
+ TranslateDialogDefault(hDlg);
+
+ ps = (plgsettings*)malloc(sizeof(plgsettings) * 2);
+ loadDBSettings(&ps[0]);
+ ps[1] = ps[0];
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps);
+ SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX);
+ SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE2), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+
+ CheckDlgButton(hDlg, IDC_RADIO1 + ps->align - 1, BST_CHECKED);
+ CheckDlgButton(hDlg, IDC_RADIO10 + 9 - ps->salign, BST_CHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK1, ps->altShadow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK2, ps->showMsgWindow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK3, ps->transparent ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK4, ps->showShadow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK5, ps->messages ? BST_CHECKED : BST_UNCHECKED);
+
+ SetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat);
+
+ CheckDlgButton(hDlg, IDC_CHECK6, ps->a_user ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK7, ps->showmystatus ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hDlg, IDC_EDIT1, ps->distance, 0);
+
+ SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(0, 255));
+ SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETPOS, TRUE, (LPARAM)ps->alpha);
+
+ {
+ TCHAR buf[20];
+ mir_sntprintf(buf, _T("%d %%"), ps->alpha * 100 / 255);
+ SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
+ }
+
+ SetDlgItemInt(hDlg, IDC_EDIT5, ps->timeout, 0);
+ FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE1), ps->announce);
+ FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE2), ps->showWhen);
+ return 0;
+
+ case WM_HSCROLL:
+ if (LOWORD(wparam) == SB_ENDSCROLL || LOWORD(wparam) == SB_THUMBPOSITION || LOWORD(wparam) == SB_ENDSCROLL)
return 0;
-
- case WM_HSCROLL:
- if (LOWORD(wparam)==SB_ENDSCROLL||LOWORD(wparam)==SB_THUMBPOSITION||LOWORD(wparam)==SB_ENDSCROLL)
- return 0;
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ps->alpha=SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_GETPOS, 0, 0);
- {
- TCHAR buf[20];
- mir_sntprintf(buf, _T("%d %%"), ps->alpha*100/255);
- SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
- }
- goto xxx;
- case WM_DESTROY:
- logmsg("OptDlgProc::DESTROY");
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ps[0]=ps[1];
- saveDBSettings(&ps[0]);
-
- SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED);
-
- SetWindowPos(hwnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER|SWP_NOACTIVATE);
- SetLayeredWindowAttributes(hwnd, ps->bkclr, ps->alpha, (ps->transparent?LWA_COLORKEY:0)|LWA_ALPHA);
-
- free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ps->alpha = SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_GETPOS, 0, 0);
+ {
+ TCHAR buf[20];
+ mir_sntprintf(buf, _T("%d %%"), ps->alpha * 100 / 255);
+ SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
+ }
+ goto xxx;
+ case WM_DESTROY:
+ logmsg("OptDlgProc::DESTROY");
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ps[0] = ps[1];
+ saveDBSettings(&ps[0]);
+
+ SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP);
+ SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ SetWindowPos(g_hWnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetLayeredWindowAttributes(g_hWnd, ps->bkclr, ps->alpha, (ps->transparent ? LWA_COLORKEY : 0) | LWA_ALPHA);
+
+ free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ return 0;
+ case WM_COMMAND:
+ logmsg("OptDlgProc::COMMAND");
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ switch (LOWORD(wparam)) {
+ case IDC_BUTTON7:
+ MessageBox(hDlg, TranslateT("Variables:\n %n : Nick\n %m : Message\n %l : New line"), TranslateT("Help"), MB_ICONINFORMATION | MB_OK);
return 0;
- case WM_COMMAND:
- logmsg("OptDlgProc::COMMAND");
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- switch (LOWORD(wparam)) {
- case IDC_BUTTON7:
- MessageBox(hDlg, TranslateT("Variables:\n %n : Nick\n %m : Message\n %l : New line"), TranslateT("Help"), MB_ICONINFORMATION|MB_OK);
- return 0;
- case IDC_BUTTON5:
- SendMessage(hwnd, WM_USER+1, (WPARAM)TranslateT("Miranda NG is great and this is a long message."), 0);
- break;
- case IDC_BUTTON1:
- selectFont(hDlg, &(ps->lf));
- break;
- case IDC_BUTTON2:
- selectColor(hDlg, &ps->clr_status);
- break;
- case IDC_BUTTON6:
- selectColor(hDlg, &ps->clr_msg);
- break;
- case IDC_BUTTON3:
- selectColor(hDlg, &ps->clr_shadow);
- break;
- case IDC_BUTTON4:
- selectColor(hDlg, &ps->bkclr);
- break;
- case IDC_CHECK4:
- ps->showShadow=IsDlgButtonChecked(hDlg, IDC_CHECK4);
- break;
- case IDC_CHECK1:
- ps->altShadow=IsDlgButtonChecked(hDlg, IDC_CHECK1);
- break;
- case IDC_CHECK2:
- ps->showMsgWindow=IsDlgButtonChecked(hDlg, IDC_CHECK2);
- case IDC_EDIT1:
- ps->distance=GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0);
- break;
- case IDC_EDIT5:
- ps->timeout=GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0);
- break;
- case IDC_CHECK3:
- ps->transparent=IsDlgButtonChecked(hDlg, IDC_CHECK3);
- break;
- case IDC_CHECK5:
- ps->messages=IsDlgButtonChecked(hDlg, IDC_CHECK5);
- break;
- case IDC_CHECK6:
- ps->a_user=IsDlgButtonChecked(hDlg, IDC_CHECK6);
- break;
- case IDC_CHECK7:
- ps->showmystatus=IsDlgButtonChecked(hDlg, IDC_CHECK7);
- break;
- case IDC_RADIO1:
- case IDC_RADIO2:
- case IDC_RADIO3:
- case IDC_RADIO4:
- case IDC_RADIO5:
- case IDC_RADIO6:
- case IDC_RADIO7:
- case IDC_RADIO8:
- case IDC_RADIO9:
- if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
- ps->align=LOWORD(wparam)-IDC_RADIO1+1;
- break;
- case IDC_RADIO10:
- case IDC_RADIO11:
- case IDC_RADIO12:
- case IDC_RADIO13:
- case IDC_RADIO14:
- case IDC_RADIO15:
- case IDC_RADIO16:
- case IDC_RADIO17:
- case IDC_RADIO18:
- if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
- ps->salign=10-(LOWORD(wparam)-IDC_RADIO10+1);
- break;
- }
+ case IDC_BUTTON5:
+ SendMessage(g_hWnd, WM_USER + 1, (WPARAM)TranslateT("Miranda NG is great and this is a long message."), 0);
+ break;
+ case IDC_BUTTON1:
+ selectFont(hDlg, &(ps->lf));
+ break;
+ case IDC_BUTTON2:
+ selectColor(hDlg, &ps->clr_status);
+ break;
+ case IDC_BUTTON6:
+ selectColor(hDlg, &ps->clr_msg);
+ break;
+ case IDC_BUTTON3:
+ selectColor(hDlg, &ps->clr_shadow);
+ break;
+ case IDC_BUTTON4:
+ selectColor(hDlg, &ps->bkclr);
+ break;
+ case IDC_CHECK4:
+ ps->showShadow = IsDlgButtonChecked(hDlg, IDC_CHECK4);
+ break;
+ case IDC_CHECK1:
+ ps->altShadow = IsDlgButtonChecked(hDlg, IDC_CHECK1);
+ break;
+ case IDC_CHECK2:
+ ps->showMsgWindow = IsDlgButtonChecked(hDlg, IDC_CHECK2);
+ case IDC_EDIT1:
+ ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0);
+ break;
+ case IDC_EDIT5:
+ ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0);
+ break;
+ case IDC_CHECK3:
+ ps->transparent = IsDlgButtonChecked(hDlg, IDC_CHECK3);
+ break;
+ case IDC_CHECK5:
+ ps->messages = IsDlgButtonChecked(hDlg, IDC_CHECK5);
+ break;
+ case IDC_CHECK6:
+ ps->a_user = IsDlgButtonChecked(hDlg, IDC_CHECK6);
+ break;
+ case IDC_CHECK7:
+ ps->showmystatus = IsDlgButtonChecked(hDlg, IDC_CHECK7);
+ break;
+ case IDC_RADIO1:
+ case IDC_RADIO2:
+ case IDC_RADIO3:
+ case IDC_RADIO4:
+ case IDC_RADIO5:
+ case IDC_RADIO6:
+ case IDC_RADIO7:
+ case IDC_RADIO8:
+ case IDC_RADIO9:
+ if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
+ ps->align = LOWORD(wparam) - IDC_RADIO1 + 1;
+ break;
+ case IDC_RADIO10:
+ case IDC_RADIO11:
+ case IDC_RADIO12:
+ case IDC_RADIO13:
+ case IDC_RADIO14:
+ case IDC_RADIO15:
+ case IDC_RADIO16:
+ case IDC_RADIO17:
+ case IDC_RADIO18:
+ if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
+ ps->salign = 10 - (LOWORD(wparam) - IDC_RADIO10 + 1);
+ break;
+ }
xxx:
- saveDBSettings(ps);
- SetWindowPos(hwnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
- InvalidateRect(hwnd, 0, TRUE);
- SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
-
- return 0;
+ saveDBSettings(ps);
+ SetWindowPos(g_hWnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetLayeredWindowAttributes(g_hWnd,
+ db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR),
+ db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA),
+ (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ InvalidateRect(g_hWnd, 0, TRUE);
+ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+
+ return 0;
+
+ case WM_NOTIFY:
+ logmsg("OptDlgProc::NOTIFY");
+ switch (((LPNMHDR)lparam)->code) {
+ case TVN_SETDISPINFO:
+ case NM_CLICK:
+ case NM_RETURN:
+ case TVN_SELCHANGED:
+ if (((LPNMHDR)lparam)->idFrom == IDC_TREE1)
+ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case PSN_APPLY:
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+
+ GetWindowRect(g_hWnd, &rect);
+ ps->winx = rect.right - rect.left;
+ ps->winy = rect.bottom - rect.top;
+ ps->winxpos = rect.left;
+ ps->winypos = rect.top;
+ ps->announce = MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE1));
+ ps->showWhen = MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE2));
+ GetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat, 255);
+ ps[1] = ps[0]; //apply current settings at closing
- case WM_NOTIFY:
- logmsg("OptDlgProc::NOTIFY");
- switch(((LPNMHDR)lparam)->code){
- case TVN_SETDISPINFO:
- case NM_CLICK:
- case NM_RETURN:
- case TVN_SELCHANGED:
- if (((LPNMHDR)lparam)->idFrom==IDC_TREE1)
- SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
- break;
- case PSN_APPLY:
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
-
- GetWindowRect(hwnd, &rect);
- ps->winx=rect.right-rect.left;
- ps->winy=rect.bottom-rect.top;
- ps->winxpos=rect.left;
- ps->winypos=rect.top;
- ps->announce=MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE1));
- ps->showWhen=MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE2));
- GetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat, 255);
- ps[1]=ps[0]; //apply current settings at closing
-
- saveDBSettings(ps);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
- InvalidateRect(hwnd, 0, TRUE);
- break;
- }
+ saveDBSettings(ps);
+ SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ InvalidateRect(g_hWnd, 0, TRUE);
break;
+ }
+ break;
}
return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM)
+int OptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.position=150000000;
- odp.groupPosition=950000000;
- odp.hInstance=hI;
- odp.pszTemplate=MAKEINTRESOURCEA(IDD_DIALOG1);
- odp.ptszGroup=LPGENT("Plugins");
- odp.ptszTitle=LPGENT("OSD");
- odp.pfnDlgProc=OptDlgProc;
- odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR;
- Options_AddPage(wparam,&odp);
+ odp.position = 150000000;
+ odp.groupPosition = 950000000;
+ odp.hInstance = hI;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG1);
+ odp.ptszGroup = LPGENT("Plugins");
+ odp.ptszTitle = LPGENT("OSD");
+ odp.pfnDlgProc = OptDlgProc;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ Options_AddPage(wparam, &odp);
return 0;
}
diff --git a/plugins/wbOSD/src/stdafx.h b/plugins/wbOSD/src/stdafx.h
index 7d82633948..aca31800a0 100644
--- a/plugins/wbOSD/src/stdafx.h
+++ b/plugins/wbOSD/src/stdafx.h
@@ -112,6 +112,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam);
void loadDBSettings(plgsettings *ps);
extern HINSTANCE hI;
-extern HWND hwnd;
+extern HWND g_hWnd;
extern HANDLE hservosda;
-extern HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown; \ No newline at end of file
+extern HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged; \ No newline at end of file
diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp
index c7a7983a4d..0a9e341244 100644
--- a/plugins/wbOSD/src/wbOSD.cpp
+++ b/plugins/wbOSD/src/wbOSD.cpp
@@ -9,106 +9,106 @@ Distributed under GNU's GPL 2 or later
#include "stdafx.h"
-TCHAR szClassName[] = _T("wbOSD");
-const static osdmsg defstr={_T(""), 0, RGB(0, 0, 0), 0, 0};
+TCHAR szClassName[] = _T("wbOSD");
+const static osdmsg defstr = { _T(""), 0, RGB(0, 0, 0), 0, 0 };
int DrawMe(HWND hwnd, TCHAR *string, COLORREF color)
{
logmsg("DrawMe");
- if (!string) string=_T("bullshit");
-
+ if (!string) string = _T("bullshit");
+
plgsettings plgs;
loadDBSettings(&plgs);
- HFONT fh=CreateFontIndirect(&(plgs.lf));
-
+ HFONT fh = CreateFontIndirect(&(plgs.lf));
+
PAINTSTRUCT ps;
- HDC hdc=BeginPaint(hwnd, &ps);
+ HDC hdc = BeginPaint(hwnd, &ps);
SetBkMode(hdc, TRANSPARENT);
RECT rect;
GetClientRect(hwnd, &rect);
- HBRUSH bkb=CreateSolidBrush(plgs.bkclr);
+ HBRUSH bkb = CreateSolidBrush(plgs.bkclr);
FillRect(hdc, &rect, bkb);
DeleteObject(bkb);
- HGDIOBJ oo=SelectObject(hdc, fh);
+ HGDIOBJ oo = SelectObject(hdc, fh);
- UINT talign=0;
+ UINT talign = 0;
RECT rect2 = rect;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|DT_CALCRECT);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | DT_CALCRECT);
- if (plgs.align<=3)
- rect.top=0;
- else if (plgs.align<=6)
- rect.top=(rect.bottom-rect2.bottom)/2;
- else if (plgs.align<=9)
- rect.top=rect.bottom-rect2.bottom;
+ if (plgs.align <= 3)
+ rect.top = 0;
+ else if (plgs.align <= 6)
+ rect.top = (rect.bottom - rect2.bottom) / 2;
+ else if (plgs.align <= 9)
+ rect.top = rect.bottom - rect2.bottom;
- if (((plgs.align-1)%3)==0)
- rect.left=0;
- else if (((plgs.align-2)%3)==0)
- rect.left=(rect.right-rect2.right)/2;
- else if (((plgs.align-3)%3)==0)
- rect.left=rect.right-rect2.right;
+ if (((plgs.align - 1) % 3) == 0)
+ rect.left = 0;
+ else if (((plgs.align - 2) % 3) == 0)
+ rect.left = (rect.right - rect2.right) / 2;
+ else if (((plgs.align - 3) % 3) == 0)
+ rect.left = rect.right - rect2.right;
- rect.bottom=rect.top+rect2.bottom;
- rect.right=rect.left+rect2.right;
+ rect.bottom = rect.top + rect2.bottom;
+ rect.right = rect.left + rect2.right;
//draw shadow
if (plgs.showShadow) {
int sxo, syo;
logmsg("DrawMe::showShadow");
- if (plgs.salign<=3)
- syo=-plgs.distance;
- else if (plgs.salign<=6)
- syo=0;
- else if (plgs.salign<=9)
- syo=plgs.distance;
+ if (plgs.salign <= 3)
+ syo = -plgs.distance;
+ else if (plgs.salign <= 6)
+ syo = 0;
+ else if (plgs.salign <= 9)
+ syo = plgs.distance;
else
- syo=0;
-
- if (((plgs.salign-1)%3)==0)
- sxo=-plgs.distance;
- else if (((plgs.salign-2)%3)==0)
- sxo=0;
- else if (((plgs.salign-3)%3)==0)
- sxo=plgs.distance;
+ syo = 0;
+
+ if (((plgs.salign - 1) % 3) == 0)
+ sxo = -plgs.distance;
+ else if (((plgs.salign - 2) % 3) == 0)
+ sxo = 0;
+ else if (((plgs.salign - 3) % 3) == 0)
+ sxo = plgs.distance;
else
- sxo=0;
+ sxo = 0;
SetTextColor(hdc, plgs.clr_shadow);
- if (plgs.altShadow==0) {
- rect2=rect;
+ if (plgs.altShadow == 0) {
+ rect2 = rect;
OffsetRect(&rect, sxo, syo);
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
}
else {
rect2 = rect;
rect2.left += plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.left -= plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.top -= plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.top += plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
- OffsetRect(&rect, sxo/2, syo/2);
+ OffsetRect(&rect, sxo / 2, syo / 2);
}
}
//draw text
SetTextColor(hdc, color);
DrawText(hdc, string, -1, &rect, DT_WORDBREAK);
-
+
SelectObject(hdc, oo);
DeleteObject(fh);
EndPaint(hwnd, &ps);
@@ -116,9 +116,9 @@ int DrawMe(HWND hwnd, TCHAR *string, COLORREF color)
return 0;
}
-LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- osdmsg* ms;
+ osdmsg *ms;
switch (message) {
case WM_CREATE:
@@ -133,10 +133,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_PAINT:
logmsg("WindowProcedure::PAINT");
- ms=(osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (ms)
return DrawMe(hwnd, ms->text, ms->color);
-
+
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
@@ -146,109 +146,109 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
logmsg("WindowProcedure::NCRBUTTONDOWN");
ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( ms ) {
- if ( ms->callback) ms->callback(ms->param);
- SendMessage(hwnd, WM_USER+3, 0, 0);
+ if (ms) {
+ if (ms->callback) ms->callback(ms->param);
+ SendMessage(hwnd, WM_USER + 3, 0, 0);
}
return 0;
case WM_TIMER:
logmsg("WindowProcedure::TIMER");
- SendMessage(hwnd, WM_USER+3, wParam, 0);
+ SendMessage(hwnd, WM_USER + 3, wParam, 0);
return 0;
- case WM_USER+1: //draw text ((char *)string, (int) timeout
+ case WM_USER + 1: //draw text ((char *)string, (int) timeout
logmsg("WindowProcedure::USER+1");
- ms=(osdmsg*)mir_alloc(sizeof(osdmsg));
- ms->text = mir_tstrdup((TCHAR *)wParam );
- if ( lParam == 0 )
- lParam = db_get_dw( NULL,THIS_MODULE, "timeout", DEFAULT_TIMEOUT );
+ ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
+ ms->text = mir_tstrdup((TCHAR *)wParam);
+ if (lParam == 0)
+ lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
ms->timeout = lParam;
ms->callback = 0;
- ms->color = db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
+ ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
ms->param = 0;
- SendMessage(hwnd, WM_USER+4, (WPARAM)ms, 0);
+ SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0);
mir_free(ms->text);
mir_free(ms);
return 0;
- case WM_USER+2: //show
+ case WM_USER + 2: //show
logmsg("WindowProcedure::USER+2");
- SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE);
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
return 0;
- case WM_USER+3: //hide
- ms = ( osdmsg* )GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ case WM_USER + 3: //hide
+ ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
logmsg("WindowProcedure::USER+3");
- if ( !ms )
+ if (!ms)
return 0;
logmsg("WindowProcedure::USER+3/om");
- KillTimer(hwnd, (UINT)ms);
+ KillTimer(hwnd, (UINT_PTR)ms);
mir_free(ms->text);
mir_free(ms);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
ShowWindow(hwnd, SW_HIDE);
return 0;
- case WM_USER+4:
+ case WM_USER + 4:
logmsg("WindowProcedure::USER+4");
ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( ms != 0 ) {
+ if (ms != 0) {
logmsg("WindowProcedure::USER+4/old");
- KillTimer(hwnd, (UINT)ms);
+ KillTimer(hwnd, (UINT_PTR)ms);
mir_free(ms->text);
mir_free(ms);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
}
- ms =(osdmsg*)mir_alloc(sizeof(osdmsg));
+ ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg));
- ms->text = mir_tstrdup( ms->text );
+ ms->text = mir_tstrdup(ms->text);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms);
- SetTimer(hwnd, (UINT)ms, (int)ms->timeout, 0);
+ SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0);
InvalidateRect(hwnd, 0, TRUE);
- SendMessage(hwnd, WM_USER+2, 0, 0);
+ SendMessage(hwnd, WM_USER + 2, 0, 0);
return 0;
case WM_NCHITTEST:
{
RECT rect;
GetWindowRect(hwnd, &rect);
-
+
logmsg("WindowProcedure::NCHITTEST");
- if (LOWORD(lParam)>=(rect.left+5) && LOWORD(lParam)<=(rect.right-5) &&
- HIWORD(lParam)>=(rect.top+5) && HIWORD(lParam)<=(rect.bottom-5))
+ if (LOWORD(lParam) >= (rect.left + 5) && LOWORD(lParam) <= (rect.right - 5) &&
+ HIWORD(lParam) >= (rect.top + 5) && HIWORD(lParam) <= (rect.bottom - 5))
return HTCAPTION;
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
- //here will be the doubleclick => open-message-window solution ;-)
- //case WM_NCLBUTTONDBLCLK:
- // CallService(MS_MSG_SENDMESSAGE, wparam,(LPARAM)&odp);
- // return 0;
+ //here will be the doubleclick => open-message-window solution ;-)
+ //case WM_NCLBUTTONDBLCLK:
+ // CallService(MS_MSG_SENDMESSAGE, wparam,(LPARAM)&odp);
+ // return 0;
default:
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
}
INT_PTR OSDAnnounce(WPARAM wParam, LPARAM lParam)
{
logmsg("OSDAnnounce");
- return SendMessage(hwnd, WM_USER+1, wParam, lParam);
+ return SendMessage(g_hWnd, WM_USER + 1, wParam, lParam);
}
int pluginShutDown(WPARAM, LPARAM)
{
logmsg("pluginShutDown");
- if (hwnd) {
+ if (g_hWnd) {
logmsg("pluginShutDown/hwnd");
- SendMessage(hwnd, WM_USER+3, 0, 0);
- DestroyWindow(hwnd);
- hwnd=0;
+ SendMessage(g_hWnd, WM_USER + 3, 0, 0);
+ DestroyWindow(g_hWnd);
+ g_hWnd = NULL;
}
return 0;
}
@@ -256,54 +256,53 @@ int pluginShutDown(WPARAM, LPARAM)
int MainInit(WPARAM, LPARAM)
{
logmsg("MainInit");
- HookEvent(ME_OPT_INITIALISE,OptionsInit);
-
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
+
WNDCLASSEX wincl;
- wincl.hInstance = hI;
- wincl.lpszClassName = szClassName;
- wincl.lpfnWndProc = WindowProcedure;
- wincl.style = CS_DBLCLKS;
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wincl.hInstance = hI;
+ wincl.lpszClassName = szClassName;
+ wincl.lpfnWndProc = WindowProcedure;
+ wincl.style = CS_DBLCLKS;
+ wincl.cbSize = sizeof(WNDCLASSEX);
+
+ wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+ wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
- wincl.hbrBackground = 0;
+ wincl.hbrBackground = 0;
- if ( !RegisterClassEx( &wincl ))
+ if (!RegisterClassEx(&wincl))
return 0;
- hwnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"),
+ g_hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"),
WS_POPUP,
- db_get_dw(NULL,THIS_MODULE, "winxpos", DEFAULT_WINXPOS),
- db_get_dw(NULL,THIS_MODULE, "winypos", DEFAULT_WINYPOS),
- db_get_dw(NULL,THIS_MODULE, "winx", DEFAULT_WINX),
- db_get_dw(NULL,THIS_MODULE, "winy", DEFAULT_WINY),
+ db_get_dw(NULL, THIS_MODULE, "winxpos", DEFAULT_WINXPOS),
+ db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS),
+ db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX),
+ db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY),
HWND_DESKTOP, NULL, hI, NULL);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ SetWindowLongPtr(g_hWnd, GWLP_USERDATA, 0);
+
+ SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
+ hservosda = CreateServiceFunction("OSD/Announce", OSDAnnounce);
+
+ HookEvent(ME_DB_EVENT_ADDED, HookedNewEvent);
- hservosda=CreateServiceFunction("OSD/Announce", OSDAnnounce);
-
- hHookedNewEvent = HookEvent(ME_DB_EVENT_ADDED, HookedNewEvent);
-
// try to create ME_STATUSCHANGE_CONTACTSTATUSCHANGED event... I hope it fails when newstatusnotify or equal creates it before ;-)
-
- hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED,ContactStatusChanged);
+
+ hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged);
if (!hContactStatusChanged) {
hHookContactStatusChanged = CreateHookableEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED);
- hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged);
+ hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
- hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED,ContactStatusChanged);
+ hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged);
}
- hProtoAck=HookEvent(ME_PROTO_ACK,ProtoAck);
-
- hpluginShutDown=HookEvent(ME_SYSTEM_SHUTDOWN,pluginShutDown);
+ hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck);
+ HookEvent(ME_SYSTEM_SHUTDOWN, pluginShutDown);
return 0;
}