From d6eee2018898f2442883a0aa77ad095b75572cfb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Aug 2015 15:15:33 +0000 Subject: fix for 64-bit issues & warnings git-svn-id: http://svn.miranda-ng.org/main/trunk@15043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_clistint.h | 6 +- plugins/AssocMgr/src/dde.cpp | 240 ++--- plugins/BossKeyPlus/src/BossKey.cpp | 2 +- plugins/Clist_nicer/src/clc.cpp | 4 +- plugins/Clist_nicer/src/clcidents.cpp | 4 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 2 +- plugins/DbEditorPP/src/findwindow.cpp | 4 +- plugins/Dropbox/src/dropbox_events.cpp | 3 +- plugins/Exchange/src/dlg_handlers.cpp | 50 +- plugins/Exchange/src/utils.cpp | 18 +- plugins/FavContacts/src/menu.cpp | 2 +- plugins/FavContacts/src/options.cpp | 4 +- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/HistoryStats/src/bandctrlimpl.cpp | 6 +- plugins/HistoryStats/src/bandctrlimpl.h | 31 +- plugins/HistoryStats/src/dlgfilterwords.cpp | 2 +- plugins/HistoryStats/src/dlgoption_subglobal.cpp | 2 +- plugins/HistoryStats/src/optionsctrlimpl.cpp | 6 +- plugins/HistoryStats/src/optionsctrlimpl.h | 12 +- plugins/HistorySweeperLight/src/options.cpp | 2 +- plugins/MenuItemEx/src/main.cpp | 6 +- plugins/MirFox/src/MirandaUtils.cpp | 12 +- plugins/MirLua/src/m_windows.cpp | 4 +- plugins/MirOTR/Libgpg-error/estream.c | 2 +- plugins/MirOTR/src/dbfilter.cpp | 2 +- plugins/MirOTR/src/dialogs.cpp | 656 ++++++------ plugins/MirOTR/src/options.cpp | 6 +- plugins/MirOTR/src/otr.cpp | 18 +- plugins/MirOTR/src/utils.cpp | 2 +- plugins/MirandaG15/src/CAppletManager.cpp | 6 +- plugins/MirandaG15/src/LCDFramework/ConStream.cpp | Bin 3624 -> 3625 bytes plugins/NewAwaySysMod/src/ContactList.cpp | 4 +- plugins/NewAwaySysMod/src/MsgTree.cpp | 2 +- plugins/NewsAggregator/Src/Services.cpp | 2 +- plugins/NotifyAnything/src/main.cpp | 4 +- plugins/Ping/src/pinggraph.cpp | 2 +- plugins/QuickContacts/src/quickcontacts.cpp | 2 +- plugins/SMS/src/recvdlg.cpp | 168 ++-- plugins/SMS/src/senddlg.cpp | 1101 ++++++++++----------- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/msgwindow.cpp | 4 +- plugins/SecureIM/src/crypt_misc.cpp | 2 +- plugins/Sessions/Src/Options.cpp | 4 +- plugins/TabSRMM/src/TSButton.cpp | 2 +- plugins/TabSRMM/src/chat/tools.cpp | 6 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/sendlater.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 2 +- plugins/WebView/src/webview_alerts.cpp | 10 +- plugins/WebView/src/webview_services.cpp | 10 +- plugins/YAMN/src/browser/mailbrowser.cpp | 12 +- plugins/wbOSD/src/events.cpp | 4 +- plugins/wbOSD/src/main.cpp | 6 +- plugins/wbOSD/src/options.cpp | 604 +++++------ plugins/wbOSD/src/stdafx.h | 4 +- plugins/wbOSD/src/wbOSD.cpp | 243 +++-- protocols/AimOscar/src/avatars.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 2 +- protocols/AimOscar/src/ui.cpp | 2 +- protocols/Dummy/src/dummy_proto.cpp | 2 +- protocols/GTalkExt/src/inbox.cpp | 2 +- protocols/GTalkExt/src/notifications.cpp | 15 +- protocols/Gadu-Gadu/src/core.cpp | 6 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 36 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 241 ++--- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/libgadu/http.cpp | 2 +- protocols/ICQCorp/src/protocol.cpp | 2 +- protocols/ICQCorp/src/services.cpp | 93 +- protocols/IRCG/src/ircproto.cpp | 4 +- protocols/IcqOscarJ/src/icq_direct.cpp | 2 +- protocols/IcqOscarJ/src/icq_uploadui.cpp | 2 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 2 +- protocols/IcqOscarJ/src/userinfotab.cpp | 6 +- protocols/IcqOscarJ/src/utilities.cpp | 5 +- protocols/MSN/src/msn_chat.cpp | 4 +- protocols/MSN/src/msn_lists.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 4 +- protocols/Sametime/src/sametime_session.cpp | 14 +- protocols/Sametime/src/userlist.cpp | 2 +- protocols/Steam/src/steam_contacts.cpp | 4 +- protocols/Steam/src/steam_proto.cpp | 2 +- protocols/Tlen/src/tlen_thread.cpp | 2 +- protocols/Tlen/src/tlen_voice.cpp | 2 +- protocols/Tox/src/tox_chatrooms.cpp | 2 +- protocols/Tox/src/tox_messages.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 6 +- protocols/VKontakte/src/vk_avatars.cpp | 8 +- protocols/VKontakte/src/vk_captcha.cpp | 2 +- protocols/VKontakte/src/vk_files.cpp | 2 +- protocols/VKontakte/src/vk_thread.cpp | 4 +- src/core/stdmsg/src/globals.cpp | 2 +- src/core/stduserinfo/src/userinfo.cpp | 7 +- src/mir_app/src/DefaultExtraIcons.cpp | 4 +- src/mir_app/src/chat_manager.cpp | 6 +- src/mir_app/src/chat_svc.cpp | 2 +- src/mir_app/src/clcutils.cpp | 33 +- src/mir_app/src/clistmod.cpp | 37 +- src/mir_app/src/clisttray.cpp | 2 +- src/mir_app/src/clui.cpp | 6 +- src/mir_app/src/extraicons.cpp | 8 +- src/mir_app/src/menu_clist.cpp | 2 +- src/mir_app/src/meta_services.cpp | 4 +- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/skinicons.cpp | 2 +- 106 files changed, 1920 insertions(+), 2011 deletions(-) diff --git a/include/m_clistint.h b/include/m_clistint.h index 636d7b6bc3..506ebaae00 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -36,9 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HCONTACT_ISGROUP 0x80000000 #define HCONTACT_ISINFO 0xFFFF0000 -#define IsHContactGroup(h) (((DWORD)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO)) -#define IsHContactInfo(h) (((DWORD)(h)&HCONTACT_ISINFO) == HCONTACT_ISINFO) -#define IsHContactContact(h) (((DWORD)(h)&HCONTACT_ISGROUP) == 0) +#define IsHContactGroup(h) (((UINT_PTR)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO)) +#define IsHContactInfo(h) (((UINT_PTR)(h)&HCONTACT_ISINFO) == HCONTACT_ISINFO) +#define IsHContactContact(h) (((UINT_PTR)(h)&HCONTACT_ISGROUP) == 0) #ifndef EXTRA_ICON_COUNT #define EXTRA_ICON_COUNT 10 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(dwTickselection >= 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(reinterpret_cast(lParam)->hMenu)); + pCtrl = new BandCtrlImpl(hWnd, reinterpret_cast(reinterpret_cast(lParam)->hMenu)); SetWindowLongPtr(hWnd, 0, reinterpret_cast(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(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 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 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(pFilter)); + HANDLE hAdded = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast(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(GetSysColorBrush(COLOR_WINDOW)); + return reinterpret_cast(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(pCS->hMenu)); - SetWindowLongPtr(hWnd, 0, reinterpret_cast(pCtrl)); + pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast(pCS->hMenu)); + SetWindowLongPtr(hWnd, 0, reinterpret_cast(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::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 Binary files a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp and b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp 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;iszModuleName); + 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<> 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; } diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 0b21052483..4b53eaa8a4 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . void __cdecl CAimProto::avatar_request_thread(void* param) { - MCONTACT hContact = (MCONTACT)param; + MCONTACT hContact = (UINT_PTR)param; char *sn = getStringA(hContact, AIM_KEY_SN); debugLogA("Starting avatar request thread for %s)", sn); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 869c081787..276706acc7 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -553,7 +553,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) { Sleep(150); - MCONTACT hContact = (MCONTACT)arg; + MCONTACT hContact = (UINT_PTR)arg; DBVARIANT dbv; if (!db_get_ts(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 4802fe3bd2..16c4328468 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -1330,7 +1330,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (nmc->hdr.code) { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - clist_validate_contact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + clist_validate_contact((UINT_PTR)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); break; case CLN_LISTREBUILT: diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index f7c6c6396d..2503e15ea0 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . void CDummyProto::SendMsgAck(void *param) { - MCONTACT hContact = (MCONTACT)param; + MCONTACT hContact = (UINT_PTR)param; Sleep(100); ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)Translate("Dummy protocol is too dumb to send messages.")); } diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index c2cf1f7235..c58533f122 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -199,7 +199,7 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) { extern DWORD itlsSettings; - if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (DWORD)TlsGetValue(itlsSettings)) || !OpenUrlWithAuth(acc, mailbox, url)) + if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (UINT_PTR)TlsGetValue(itlsSettings)) || !OpenUrlWithAuth(acc, mailbox, url)) Utils_OpenUrlT(url); } diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index c4e21d177d..eca670801e 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -65,7 +65,7 @@ LPCSTR GetJidAcc(LPCTSTR jid) void MarkEventRead(MCONTACT hCnt, MEVENT hEvt) { - DWORD settings = (DWORD)TlsGetValue(itlsSettings); + DWORD settings = (UINT_PTR)TlsGetValue(itlsSettings); if (ReadCheckbox(0, IDC_POPUPSENABLED, settings) && ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && ReadCheckbox(0, IDC_MARKEVENTREAD, settings) && @@ -144,7 +144,7 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) static bool DoAddPopup(POPUPDATAT *data) { - if (ReadCheckbox(0, IDC_POPUPSINFULLSCREEN, (DWORD)TlsGetValue(itlsSettings)) && IsFullScreen()) { + if (ReadCheckbox(0, IDC_POPUPSINFULLSCREEN, (UINT_PTR)TlsGetValue(itlsSettings)) && IsFullScreen()) { HWND handle = CreateWindowEx(WS_EX_TOOLWINDOW, TEMP_WINDOW_CLASS_NAME, NULL, WS_OVERLAPPED | WS_VISIBLE, -100, -100, 10, 10, 0, 0, 0, 0); if (handle) { ShowWindow(handle, SW_MINIMIZE); @@ -208,13 +208,13 @@ BOOL UsePopups() { return ServiceExists(MS_POPUP_QUERY) && CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) && - ReadCheckbox(0, IDC_POPUPSENABLED, (DWORD)TlsGetValue(itlsSettings)); + ReadCheckbox(0, IDC_POPUPSENABLED, (UINT_PTR)TlsGetValue(itlsSettings)); } void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) { MCONTACT hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]); - MEVENT hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings)) + MEVENT hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (UINT_PTR)TlsGetValue(itlsSettings)) ? AddCListNotification(hCnt, acc, data, url) : NULL; if (!UsePopups()) @@ -276,7 +276,7 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre tszSenders.AppendFormat(_T(" %s\n"), p.addr); } - if (ReadCheckbox(0, IDC_ADDSNIP, (DWORD)TlsGetValue(itlsSettings))) + if (ReadCheckbox(0, IDC_ADDSNIP, (UINT_PTR)TlsGetValue(itlsSettings))) mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip); else mir_sntprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str()); @@ -304,7 +304,8 @@ DWORD ReadNotificationSettings(LPCSTR acc) return result; } -struct POPUP_IDENT_STRINGS { +struct POPUP_IDENT_STRINGS +{ LPCTSTR url; LPCTSTR jid; }; @@ -329,7 +330,7 @@ BOOL CALLBACK ClosePopupFunc(__in HWND hwnd, __in LPARAM lParam) void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly) { - DWORD settings = (DWORD)TlsGetValue(itlsSettings); + DWORD settings = (UINT_PTR)TlsGetValue(itlsSettings); if (acc && !PopupsOnly && ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && ReadCheckbox(0, IDC_CLEARPSEUDOCONTACTLOG, settings)) diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f5558e99ad..014beec412 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1063,7 +1063,7 @@ retry: pre.descr.t = filenameT; pre.files.t = &filenameT; pre.lParam = (LPARAM)dcc7; - ProtoChainRecvFile((MCONTACT)dcc7->contact, &pre); + ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre); mir_free(filenameT); e->event.dcc7_new = NULL; @@ -1077,7 +1077,7 @@ retry: if (dcc7->type == GG_SESSION_DCC7_SEND) { debugLogA("mainthread() (%x): File transfer denied by client %d (reason = %d).", this, dcc7->peer_uin, e->event.dcc7_reject.reason); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Remove from watches and free gg_EnterCriticalSection(&ft_mutex, "mainthread", 21, "ft_mutex", 1); @@ -1138,7 +1138,7 @@ retry: } if (dcc7->contact) - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free dcc gg_dcc7_free(dcc7); diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 7034f31036..dfa99bcffe 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -272,7 +272,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc->contact; + pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -285,7 +285,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 3, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -302,7 +302,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc->contact; + pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -315,11 +315,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->file_info.size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 4, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 5, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -359,7 +359,7 @@ void __cdecl GGPROTO::dccmainthread(void*) { _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 6, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -391,7 +391,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pre.lParam = (LPARAM)local_dcc; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1); - ProtoChainRecvFile((MCONTACT)local_dcc->contact, &pre); + ProtoChainRecvFile((UINT_PTR)local_dcc->contact, &pre); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); mir_free(filenameT); @@ -500,7 +500,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc7->contact; + pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -513,7 +513,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 9, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -530,7 +530,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc7->contact; + pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -543,11 +543,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 10, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc7->file_fd); local_dcc7->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 11, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -591,7 +591,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->contact) { gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 12, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } @@ -679,7 +679,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) TCHAR error[512]; mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); - ProtoBroadcastAck((MCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Free transfer gg_free_dcc(dcc); return 0; @@ -715,7 +715,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) if (iFtRemoveRes == -1) { debugLogA("dcc7fileallow(): File transfer denied."); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -729,7 +729,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -800,7 +800,7 @@ int GGPROTO::dccfilecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dccfilecancel", 44, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck((MCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Close file if (dcc->file_fd != -1) { @@ -830,7 +830,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dcc7filecancel", 45, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Close file if (dcc7->file_fd != -1) { diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index d77fb87d72..855542a409 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -21,7 +21,7 @@ #include "gg.h" -GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : +GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : PROTO(pszProtoName, tszUserName), avatar_requests(1, NumericKeySortT), avatar_transfers(1, NumericKeySortT) @@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED); TCHAR szPath[MAX_PATH]; - mir_sntprintf(szPath, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName); + mir_sntprintf(szPath, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST(_T("%miranda_userdata%")), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName); DWORD dwVersion; @@ -142,22 +142,22 @@ MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr) DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT hContact) { switch (type) { - case PFLAGNUM_1: - return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_EXTSEARCHUI | PF1_SEARCHBYNAME | - PF1_MODEMSG | PF1_NUMERICUSERID | PF1_VISLIST | PF1_FILE; - case PFLAGNUM_2: - return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE | - PF2_LONGAWAY; - case PFLAGNUM_3: - return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE; - case PFLAGNUM_4: - return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE; - case PFLAGNUM_5: - return PF2_LONGAWAY; - case PFLAG_UNIQUEIDTEXT: - return (DWORD_PTR) Translate("Gadu-Gadu Number"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR) GG_KEY_UIN; + case PFLAGNUM_1: + return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_EXTSEARCHUI | PF1_SEARCHBYNAME | + PF1_MODEMSG | PF1_NUMERICUSERID | PF1_VISLIST | PF1_FILE; + case PFLAGNUM_2: + return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE | + PF2_LONGAWAY; + case PFLAGNUM_3: + return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE; + case PFLAGNUM_4: + return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE; + case PFLAGNUM_5: + return PF2_LONGAWAY; + case PFLAG_UNIQUEIDTEXT: + return (DWORD_PTR)Translate("Gadu-Gadu Number"); + case PFLAG_UNIQUEIDSETTING: + return (DWORD_PTR)GG_KEY_UIN; } return 0; } @@ -169,7 +169,7 @@ void __cdecl GGPROTO::cmdgetinfothread(void *hContact) { debugLogA("cmdgetinfothread(): started. Failed info retreival."); gg_sleep(100, FALSE, "cmdgetinfothread", 103, 1); - ProtoBroadcastAck((MCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); + ProtoBroadcastAck((UINT_PTR)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); debugLogA("cmdgetinfothread(): end."); } @@ -178,13 +178,11 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_t req; // Custom contact info - if (hContact) - { - if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) - { -#ifdef DEBUGMODE + if (hContact) { + if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) { + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -194,15 +192,13 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_seq_set(req, GG_SEQ_INFO); debugLogA("GetInfo(): Requesting user info.", req->seq); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 48, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -210,13 +206,11 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) } } // Own contact info - else - { - if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ))) - { -#ifdef DEBUGMODE + else { + if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ))) { + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -225,15 +219,13 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_seq_set(req, GG_SEQ_CHINFO); debugLogA("GetInfo(): Requesting owner info.", req->seq); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 49, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -266,9 +258,9 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); if (!req) { -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -278,12 +270,11 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchBasic", 50, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -308,33 +299,30 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); if (req == NULL) { -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } // Add nick,firstName,lastName and search it CMStringA szQuery; - if (nick) - { + if (nick) { T2Utf nick_utf8(nick); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nick_utf8); szQuery.Append(nick_utf8); } szQuery.AppendChar('.'); - if (firstName) - { + if (firstName) { T2Utf firstName_utf8(firstName); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); szQuery.Append(firstName_utf8); } szQuery.AppendChar('.'); - if (lastName) - { + if (lastName) { T2Utf lastName_utf8(lastName); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); szQuery.Append(lastName_utf8); @@ -350,12 +338,11 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchByName", 51, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -376,11 +363,10 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) return 0; gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); - if (!req) - { -#ifdef DEBUGMODE + if (!req) { + #ifdef DEBUGMODE debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HWND)1; } @@ -390,8 +376,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data TCHAR text[64]; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf firstName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); szQuery.Append(firstName_utf8); @@ -399,8 +384,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf lastName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); szQuery.Append(lastName_utf8); @@ -408,8 +392,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf nickName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8); szQuery.Append(nickName_utf8); @@ -417,8 +400,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf city_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8); szQuery.Append(city_utf8); @@ -426,8 +408,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { int yearTo = _tstoi(text); int yearFrom; time_t t = time(NULL); @@ -455,21 +436,19 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) } /* 5 */ szQuery.AppendChar('.'); - switch(SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)) - { - case 1: - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_FEMALE); - szQuery.Append(GG_PUBDIR50_GENDER_MALE); - break; - case 2: - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_MALE); - szQuery.Append(GG_PUBDIR50_GENDER_FEMALE); - break; + switch (SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)) { + case 1: + gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_FEMALE); + szQuery.Append(GG_PUBDIR50_GENDER_MALE); + break; + case 2: + gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_MALE); + szQuery.Append(GG_PUBDIR50_GENDER_FEMALE); + break; } /* 6 */ szQuery.AppendChar('.'); - if (IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)) { gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, GG_PUBDIR50_ACTIVE_TRUE); szQuery.Append(GG_PUBDIR50_ACTIVE_TRUE); } @@ -489,15 +468,13 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "SearchAdvanced", 52, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HWND)1; } @@ -512,9 +489,9 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) ////////////////////////////////////////////////////////// // create adv search dialog -static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - switch(message) { + switch (message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)_T("")); // 0 @@ -544,7 +521,7 @@ void __cdecl GGPROTO::sendackthread(void *ack) { GG_SEQ_ACK *pAck = (GG_SEQ_ACK *)ack; gg_sleep(100, FALSE, "sendackthread", 105, 1); - ProtoBroadcastAck(pAck->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) pAck->seq, 0); + ProtoBroadcastAck(pAck->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pAck->seq, 0); mir_free(ack); } @@ -560,17 +537,15 @@ int GGPROTO::SendMsg(MCONTACT hContact, int, const char *msg) gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1); int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg); gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1); - if (!getByte(GG_KEY_MSGACK, GG_KEYDEF_MSGACK)) - { + if (!getByte(GG_KEY_MSGACK, GG_KEYDEF_MSGACK)) { // Auto-ack message without waiting for server ack GG_SEQ_ACK *ack = (GG_SEQ_ACK*)mir_alloc(sizeof(GG_SEQ_ACK)); - if (ack) - { + if (ack) { ack->seq = seq; ack->hContact = hContact; -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SendMsg(): ForkThread 16 GGPROTO::sendackthread"); -#endif + #endif ForkThread(&GGPROTO::sendackthread, ack); } } @@ -615,15 +590,15 @@ void __cdecl GGPROTO::getawaymsgthread(void *arg) { DBVARIANT dbv; - MCONTACT hContact = (MCONTACT) arg; + MCONTACT hContact = (UINT_PTR)arg; debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); - if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) - { + if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); debugLog(_T("getawaymsgthread(): Reading away msg <%s>."), dbv.ptszVal); db_free(&dbv); - } else { + } + else { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); } debugLogA("getawaymsgthread(): end"); @@ -651,47 +626,43 @@ int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg) gg_EnterCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, "modemsg_mutex", 1); // Select proper our msg ptr - switch(status) - { - case ID_STATUS_ONLINE: - msgPtr = &modemsg.online; - break; - case ID_STATUS_AWAY: - msgPtr = &modemsg.away; - break; - case ID_STATUS_DND: - msgPtr = &modemsg.dnd; - break; - case ID_STATUS_FREECHAT: - msgPtr = &modemsg.freechat; - break; - case ID_STATUS_INVISIBLE: - msgPtr = &modemsg.invisible; - break; - default: - gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 1, "modemsg_mutex", 1); - return 1; + switch (status) { + case ID_STATUS_ONLINE: + msgPtr = &modemsg.online; + break; + case ID_STATUS_AWAY: + msgPtr = &modemsg.away; + break; + case ID_STATUS_DND: + msgPtr = &modemsg.dnd; + break; + case ID_STATUS_FREECHAT: + msgPtr = &modemsg.freechat; + break; + case ID_STATUS_INVISIBLE: + msgPtr = &modemsg.invisible; + break; + default: + gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 1, "modemsg_mutex", 1); + return 1; } // Check if we change status here somehow if (*msgPtr && newMsg && !mir_tstrcmp(*msgPtr, newMsg) - || !*msgPtr && (!newMsg || !*newMsg)) - { - if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) - { + || !*msgPtr && (!newMsg || !*newMsg)) { + if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) { debugLogA("SetAwayMsg(): Message hasn't been changed, return."); gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 2, "modemsg_mutex", 1); return 0; } } - else - { + else { if (*msgPtr) mir_free(*msgPtr); *msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL; -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SetAwayMsg(): Message changed."); -#endif + #endif } gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 3, "modemsg_mutex", 1); @@ -725,7 +696,7 @@ int GGPROTO::UserIsTyping(MCONTACT hContact, int type) int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) { - switch( eventType ) { + switch (eventType) { case EV_PROTO_ONLOAD: HookProtoEvent(ME_OPT_INITIALISE, &GGPROTO::options_init); HookProtoEvent(ME_USERINFO_INITIALISE, &GGPROTO::details_init); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index b76e4816cd..4e2bfc3038 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -306,7 +306,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcwindow.pszModule = m_szModuleName; gcwindow.ptszName = sender ? senderName : TranslateT("Conference"); gcwindow.ptszID = chat->id; - gcwindow.dwItemData = (DWORD)chat; + gcwindow.dwItemData = (UINT_PTR)chat; gcwindow.ptszStatusbarText = status; // Here we put nice new hash sign diff --git a/protocols/Gadu-Gadu/src/libgadu/http.cpp b/protocols/Gadu-Gadu/src/libgadu/http.cpp index d07dca27d3..e1cc1b457f 100644 --- a/protocols/Gadu-Gadu/src/libgadu/http.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/http.cpp @@ -330,7 +330,7 @@ int gg_http_watch_fd(struct gg_http *h) unsigned int left; char *line; - left = h->header_size - ((long)(tmp) - (long)(h->header) + sep_len); + left = h->header_size - ((INT_PTR)tmp - (INT_PTR)(h->header) + sep_len); gg_debug(GG_DEBUG_MISC, "=> http, got all header (%d bytes, %d left)\n", h->header_size - left, left); diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 76350c4f18..d99b39d166 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -2301,7 +2301,7 @@ void ICQ::addFileReq(ICQUser *u, char *m, char *filename, unsigned long size, un // Send chain event szBlob = new char[sizeof(DWORD) + mir_strlen(filename) + mir_strlen(m) + 2]; - *(PDWORD)szBlob = (DWORD)transfer; + *(PDWORD)szBlob = (UINT_PTR)transfer; mir_strcpy(szBlob + sizeof(DWORD), filename); mir_strcpy(szBlob + sizeof(DWORD) + mir_strlen(filename) + 1, m); diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 5eb8bed4d3..9cbea15a26 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -1,20 +1,20 @@ /* - ICQ Corporate protocol plugin for Miranda IM. - Copyright (C) 2003-2005 Eugene Tarasenko - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ICQ Corporate protocol plugin for Miranda IM. + Copyright (C) 2003-2005 Eugene Tarasenko + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "corp.h" @@ -25,19 +25,19 @@ static INT_PTR icqGetCaps(WPARAM wParam, LPARAM lParam) { switch (wParam) { case PFLAGNUM_1: - return PF1_IM|PF1_URL|PF1_FILE|PF1_MODEMSG|PF1_AUTHREQ|PF1_ADDED|PF1_PEER2PEER|PF1_BASICSEARCH|PF1_EXTSEARCH|PF1_CANRENAMEFILE|PF1_FILERESUME|PF1_ADDSEARCHRES|PF1_SEARCHBYEMAIL|PF1_SEARCHBYNAME|PF1_NUMERICUSERID; + return PF1_IM | PF1_URL | PF1_FILE | PF1_MODEMSG | PF1_AUTHREQ | PF1_ADDED | PF1_PEER2PEER | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_CANRENAMEFILE | PF1_FILERESUME | PF1_ADDSEARCHRES | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_NUMERICUSERID; case PFLAGNUM_2: - return PF2_ONLINE|PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT; + return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT; case PFLAGNUM_3: - return PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT; + return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT; case PFLAG_UNIQUEIDTEXT: - return (int)Translate("ICQ number:"); + return (INT_PTR)Translate("ICQ number:"); case PFLAG_UNIQUEIDSETTING: - return (int)"UIN"; + return (INT_PTR)"UIN"; } return 0; } @@ -54,14 +54,13 @@ static INT_PTR icqGetName(WPARAM wParam, LPARAM lParam) static INT_PTR icqLoadIcon(WPARAM wParam, LPARAM lParam) { - unsigned int id; + int id; - switch (wParam & 0xFFFF) - { + switch (wParam & 0xFFFF) { case PLI_PROTOCOL: id = IDI_ICQCORP; break; - default: return (int)(HICON)NULL; + default: return NULL; } - return (int)LoadImage(hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0); + return (INT_PTR)LoadImage(hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0); } /////////////////////////////////////////////////////////////////////////////// @@ -76,13 +75,11 @@ static INT_PTR icqSetStatus(WPARAM wParam, LPARAM lParam) if (desiredStatus == ID_STATUS_ONLINE) icq.awayMessage[0] = 0; if (icq.desiredStatus == desiredStatus) return 0; - if (desiredStatus == ID_STATUS_OFFLINE) - { + if (desiredStatus == ID_STATUS_OFFLINE) { icq.desiredStatus = desiredStatus; icq.logoff(false); } - else - { + else { if (icq.statusVal == ID_STATUS_OFFLINE) icq.logon(desiredStatus); else icq.setStatus(desiredStatus); } @@ -259,7 +256,7 @@ static INT_PTR icqSetAwayMsg(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return 0; - if (icq.awayMessage) delete [] icq.awayMessage; + if (icq.awayMessage) delete[] icq.awayMessage; icq.awayMessage = new char[mir_strlen((char*)lParam) + 1]; mir_strcpy(icq.awayMessage, (char*)lParam); @@ -314,30 +311,26 @@ static INT_PTR icqSendFile(WPARAM wParam, LPARAM lParam) char filename[MAX_PATH], format[32]; WIN32_FIND_DATA findData; - for (filesCount=0,directoriesCount=0; files[filesCount]; filesCount++) - { + for (filesCount = 0, directoriesCount = 0; files[filesCount]; filesCount++) { FindClose(FindFirstFile(files[filesCount], &findData)); if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) directoriesCount++; else filesSize += findData.nFileSizeLow; } filesCount -= directoriesCount; - if (directoriesCount) - { + if (directoriesCount) { sprintf(format, "%s, %s", filesCount == 1 ? Translate("%d file") : Translate("%d files"), directoriesCount == 1 ? Translate("%d directory") : Translate("%d directories")); sprintf(filename, format, filesCount, directoriesCount); } - else - { - if (filesCount == 1) - { + else { + if (filesCount == 1) { char *p = strrchr(files[0], '\\'); - mir_strcpy(filename, p ? p+1 : files[0]); + mir_strcpy(filename, p ? p + 1 : files[0]); } else sprintf(filename, filesCount == 1 ? Translate("%d file") : Translate("%d files"), filesCount); } - return (int)icq.sendFile(u, (char*)ccs->wParam, filename, filesSize, files); + return (INT_PTR)icq.sendFile(u, (char*)ccs->wParam, filename, filesSize, files); } /////////////////////////////////////////////////////////////////////////////// @@ -356,7 +349,7 @@ static INT_PTR icqFileAllow(WPARAM wParam, LPARAM lParam) t->path = _strdup((char*)ccs->lParam); icq.acceptFile(u, t->sequence, (char*)ccs->lParam); - return (int)t; + return (INT_PTR)t; } /////////////////////////////////////////////////////////////////////////////// @@ -375,10 +368,8 @@ static INT_PTR icqFileDeny(WPARAM wParam, LPARAM lParam) icq.refuseFile(u, t->sequence, (char*)ccs->lParam); unsigned int i; - for (i=0; isequence, (char*)ccs->lParam); unsigned int i; - for (i=0; itimestamp; dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0); dbei.eventType = EVENTTYPE_FILE; - dbei.cbBlob = sizeof(DWORD)+(DWORD)mir_strlen(szFile) + (DWORD)mir_strlen(szDesc) + 2; + dbei.cbBlob = sizeof(DWORD) + (DWORD)mir_strlen(szFile) + (DWORD)mir_strlen(szDesc) + 2; dbei.pBlob = (PBYTE)pre->szMessage; db_event_add(ccs->hContact, &dbei); @@ -483,7 +472,7 @@ static INT_PTR icqSetApparentMode(WPARAM wParam, LPARAM lParam) if (oldMode != 0) icq.updateUserList(u, oldMode == ID_STATUS_OFFLINE ? 1 : 2, 0); if (newMode != 0) icq.updateUserList(u, newMode == ID_STATUS_OFFLINE ? 1 : 2, 1); - */ + */ return 0; } diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index da16702dbe..9625abd87a 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -658,12 +658,12 @@ struct TFakeAckParam void __cdecl CIrcProto::AckMessageFail(void *info) { - ProtoBroadcastAck((MCONTACT)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online")); + ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online")); } void __cdecl CIrcProto::AckMessageFailDcc(void *info) { - ProtoBroadcastAck((MCONTACT)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active")); + ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active")); } void __cdecl CIrcProto::AckMessageSuccess(void *info) diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 5c837b352a..7131dc5b70 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -243,7 +243,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) dwReqMsgID1 = pCookie->dwMsgID1; dwReqMsgID2 = pCookie->dwMsgID2; - dc.dwReqId = (DWORD)pCookie->ft; + dc.dwReqId = (UINT_PTR)pCookie->ft; SAFE_FREE((void**)&pCookie); } } diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index edb1b0075d..51b58641c9 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -309,7 +309,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa if (ack->type != ICQACKTYPE_SERVERCLIST) break; - if ((int)ack->hProcess != currentSequence) + if ((INT_PTR)ack->hProcess != currentSequence) break; lastAckResult = ack->result == ACKRESULT_SUCCESS ? 0 : 1; diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 455c83ada1..e663d4ee38 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -610,7 +610,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara ACKDATA *ack = (ACKDATA*)lParam; if (ack->type != ICQACKTYPE_XSTATUS_RESPONSE) break; if (ack->hContact != dat->hContact) break; - if ((DWORD)ack->hProcess != dat->iEvent) break; + if ((UINT_PTR)ack->hProcess != dat->iEvent) break; ShowDlgItem(hwndDlg, IDC_RETRXSTATUS, SW_HIDE); ShowDlgItem(hwndDlg, IDC_XMSG, SW_SHOW); diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 1b475a068b..75d2c8c054 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -51,10 +51,10 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac dbv.type = DBVT_DELETED; - if ((hContact == NULL) && ((int)szModule < 0x100)) { + if ((hContact == NULL) && ((INT_PTR)szModule < 0x100)) { dbv.type = (BYTE)szModule; - switch ((int)szModule) { + switch ((INT_PTR)szModule) { case DBVT_BYTE: dbv.cVal = (BYTE)szSetting; break; @@ -62,7 +62,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac dbv.wVal = (WORD)szSetting; break; case DBVT_DWORD: - dbv.dVal = (DWORD)szSetting; + dbv.dVal = (UINT_PTR)szSetting; break; case DBVT_ASCIIZ: dbv.pszVal = pstr = szSetting; diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3fa2e718c1..6ad5193126 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -978,8 +978,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact) res = 3; // threshold exceeded } } - else - res = 4; // no timestamp found + else res = 4; // no timestamp found } return res; @@ -989,7 +988,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact) void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) { if (pDelay) - SleepEx((DWORD)pDelay, TRUE); + SleepEx((UINT_PTR)pDelay, TRUE); mir_cslockfull l(cookieMutex); diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 8d7d959364..40bbb74948 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -336,7 +336,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto if (buf[0]) str.insert(mir_t2a(buf)); } else { - MsnContact *msc = ppro->Lists_Get((MCONTACT)hItem); + MsnContact *msc = ppro->Lists_Get((UINT_PTR)hItem); if (msc) { char szContact[MSN_MAX_EMAIL_LEN]; @@ -404,7 +404,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (nmc->hdr.code) { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - ChatValidateContact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + ChatValidateContact((UINT_PTR)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); break; case CLN_LISTREBUILT: diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index d6881c3dbd..2afcc94d86 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -553,7 +553,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (nmc->hdr.code) { case CLN_NEWCONTACT: if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - SetContactIcons((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, proto); + SetContactIcons((UINT_PTR)nmc->hItem, nmc->hdr.hwndFrom, proto); break; case CLN_LISTREBUILT: diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 27fbb51cf4..1e568c1a31 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -226,8 +226,6 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) debugLog(_T("CSametimeProto::SendMsg() hContact=[%x]"), hContact); char *proto = GetContactProto(hContact); - int ret; - if (!proto || mir_strcmp(proto, m_szModuleName) != 0 || db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { TFakeAckParams* tfap = (TFakeAckParams*)mir_alloc(sizeof(TFakeAckParams)); tfap->proto = this; @@ -240,7 +238,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) if (!msg) return 0; - ret = (int)SendMessageToUser(hContact, msg); + int ret = (INT_PTR)SendMessageToUser(hContact, msg); TFakeAckParams *tfap = (TFakeAckParams*)mir_alloc(sizeof(TFakeAckParams)); tfap->proto = this; diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 74fede1541..abd9a0b508 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -106,9 +106,9 @@ void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpoint break; case mwSession_STOPPING: - if ((int)info) {// & ERR_FAILURE) { - proto->showPopup((int)info); - } + if ((INT_PTR)info) + proto->showPopup((INT_PTR)info); + proto->SessionStopping(); break; @@ -475,8 +475,8 @@ WORD CSametimeProto::GetClientVersion() if (!session) return 0; WORD retval = 0; - retval = (int)mwSession_getProperty(session, mwSession_CLIENT_VER_MAJOR) << 8; - retval |= (int)mwSession_getProperty(session, mwSession_CLIENT_VER_MINOR); + retval = (UINT_PTR)mwSession_getProperty(session, mwSession_CLIENT_VER_MAJOR) << 8; + retval |= (UINT_PTR)mwSession_getProperty(session, mwSession_CLIENT_VER_MINOR); return retval; } @@ -485,8 +485,8 @@ WORD CSametimeProto::GetServerVersion() if (!session) return 0; WORD retval = 0; - retval = (int)mwSession_getProperty(session, mwSession_SERVER_VER_MAJOR) << 8; - retval |= (int)mwSession_getProperty(session, mwSession_SERVER_VER_MINOR); + retval = (UINT_PTR)mwSession_getProperty(session, mwSession_SERVER_VER_MAJOR) << 8; + retval |= (UINT_PTR)mwSession_getProperty(session, mwSession_SERVER_VER_MINOR); return retval; } diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 6db619e1d5..eb4a67fecc 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -653,7 +653,7 @@ void CSametimeProto::UserRecvAwayMessage(MCONTACT hContact) void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code, GList* results, gpointer data) { CSametimeProto* proto = getProtoFromMwServiceResolve(srvc); - BOOL advanced = (BOOL)data; + BOOL advanced = (INT_PTR)data; MYCUSTOMSEARCHRESULTS mcsr; memset(&mcsr, 0, sizeof(mcsr)); diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index c8e17b7aec..4fee4049ac 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -522,7 +522,7 @@ void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response) void CSteamProto::OnGotAvatar(const NETLIBHTTPREQUEST *response, void *arg) { PROTO_AVATAR_INFORMATION ai = { 0 }; - ai.hContact = (MCONTACT)arg; + ai.hContact = (UINT_PTR)arg; GetDbAvatarInfo(ai); if (response == NULL || response->resultCode != HTTP_CODE_OK) @@ -582,7 +582,7 @@ void CSteamProto::OnFriendRemoved(const NETLIBHTTPREQUEST *response, void *arg) { if (response == NULL || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true")) { - MCONTACT hContact = (MCONTACT)arg; + MCONTACT hContact = (UINT_PTR)arg; ptrA who(getStringA(hContact, "SteamID")); debugLogA("CSteamProto::OnFriendRemoved: failed to remove friend %s", who); diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index efe610c209..113c5f47b5 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -343,7 +343,7 @@ void __cdecl CSteamProto::GetAwayMsgThread(void *arg) // Maybe not needed, but better to be sure that this won't happen faster than core handling return value of GetAwayMsg() Sleep(50); - MCONTACT hContact = (MCONTACT)arg; + MCONTACT hContact = (UINT_PTR)arg; CMString message(db_get_tsa(hContact, "CList", "StatusMsg")); // if contact has no status message, get xstatus message diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 6803b74876..3a736cc836 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -163,7 +163,7 @@ void __cdecl TlenServerThread(ThreadData *info) // Should be better with modeless. onlinePassword[0] = (char) -1; hEventPasswdDlg = CreateEvent(NULL, FALSE, FALSE, NULL); - QueueUserAPC(TlenPasswordCreateDialogApcProc, hMainThread, (DWORD) jidStr); + QueueUserAPC(TlenPasswordCreateDialogApcProc, hMainThread, (UINT_PTR)jidStr); WaitForSingleObject(hEventPasswdDlg, INFINITE); CloseHandle(hEventPasswdDlg); diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index e0a5f48a7f..899495fad8 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -136,7 +136,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->proto->debugLogA("Playback device ID #%u: %s\r\n", iSelDev, wic.szPname); } - MMRESULT mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD_PTR)&TlenVoicePlaybackCallback, (DWORD)control, CALLBACK_FUNCTION); + MMRESULT mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (UINT_PTR)&TlenVoicePlaybackCallback, (UINT_PTR)control, CALLBACK_FUNCTION); if (mmres != MMSYSERR_NOERROR) { control->proto->debugLogA("TlenVoiceStart FAILED!"); return 1; diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index 00145f635f..a0363afd5f 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -308,7 +308,7 @@ INT_PTR CALLBACK CToxProto::ChatRoomInviteProc(HWND hwndDlg, UINT msg, WPARAM wP case CLN_NEWCONTACT: if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) { - param->proto->ChatValidateContact(nmc->hdr.hwndFrom, param->invitedContacts, (MCONTACT)nmc->hItem); + param->proto->ChatValidateContact(nmc->hdr.hwndFrom, param->invitedContacts, (UINT_PTR)nmc->hItem); } break; diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index b52bcbbe8a..79aaf06710 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -114,7 +114,7 @@ int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam) /* STATUS MESSAGE */ void CToxProto::GetStatusMessageAsync(void* arg) { - MCONTACT hContact = (MCONTACT)arg; + MCONTACT hContact = (UINT_PTR)arg; int32_t friendNumber = GetToxFriendNumber(hContact); if (friendNumber == UINT32_MAX) diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index bb57d1b3ee..67dec9e9cd 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -283,7 +283,7 @@ MCONTACT CVkProto::FindChat(LONG dwUserid) bool CVkProto::CheckMid(LIST &lList, int guid) { for (int i = lList.getCount() - 1; i >= 0; i--) - if ((int)lList[i] == guid) { + if ((INT_PTR)lList[i] == guid) { lList.remove(i); return true; } @@ -549,7 +549,7 @@ void CVkProto::ApplyCookies(AsyncHttpRequest *pReq) void __cdecl CVkProto::DBAddAuthRequestThread(void *p) { - MCONTACT hContact = (MCONTACT)p; + MCONTACT hContact = (UINT_PTR)p; if (hContact == NULL || hContact == INVALID_CONTACT_ID || !IsOnline()) return; @@ -696,7 +696,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) void CVkProto::ContactTypingThread(void *p) { debugLogA("CVkProto::ContactTypingThread"); - MCONTACT hContact = (MCONTACT)p; + MCONTACT hContact = (UINT_PTR)p; CallService(MS_PROTO_CONTACTISTYPING, hContact, 5); Sleep(5500); CallService(MS_PROTO_CONTACTISTYPING, hContact); diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index d11bfa8258..9ce6447f36 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -23,19 +23,19 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq) return; PROTO_AVATAR_INFORMATION ai = { 0 }; - GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, _countof(ai.filename)); + GetAvatarFileName((UINT_PTR)pReq->pUserInfo, ai.filename, _countof(ai.filename)); ai.format = ProtoGetBufferFormat(reply->pData); FILE *out = _tfopen(ai.filename, _T("wb")); if (out == NULL) { - ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai); + ProtoBroadcastAck((UINT_PTR)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai); return; } fwrite(reply->pData, 1, reply->dataLength, out); fclose(out); - setByte((MCONTACT)pReq->pUserInfo, "NeedNewAvatar", 0); - ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai); + setByte((UINT_PTR)pReq->pUserInfo, "NeedNewAvatar", 0); + ProtoBroadcastAck((UINT_PTR)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai); } INT_PTR CVkProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam) diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 8b98806e67..4067a4e392 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -48,7 +48,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_WHITERECT: case IDC_INSTRUCTION: case IDC_TITLE: - return (BOOL)GetStockObject(WHITE_BRUSH); + return (INT_PTR)GetStockObject(WHITE_BRUSH); } return NULL; diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 0f1cf72577..a64c8680df 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -372,7 +372,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR << TCHAR_PARAM("attachment", Attachment) << VER_API; pMsgReq->AddHeader("Content-Type", "application/x-www-form-urlencoded"); - pMsgReq->pUserInfo = new CVkSendMsgParam(fup->hContact, -1, (int)pReq->pUserInfo); + pMsgReq->pUserInfo = new CVkSendMsgParam(fup->hContact, -1, (INT_PTR)pReq->pUserInfo); Push(pMsgReq); } \ No newline at end of file diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index e490908188..672ec3c9e3 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -453,7 +453,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (jnResponse["freeoffline"].as_bool()) for (int i = 0; i < arContacts.getCount(); i++) { - hContact = (MCONTACT)arContacts[i]; + hContact = (UINT_PTR)arContacts[i]; LONG userID = getDword(hContact, "ID", -1); if (userID == m_myUserId || userID == VK_FEED_USER) continue; @@ -544,7 +544,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq if (bCleanContacts) for (int i = 0; i < arContacts.getCount(); i++) { - MCONTACT hContact = (MCONTACT)arContacts[i]; + MCONTACT hContact = (UINT_PTR)arContacts[i]; LONG userID = getDword(hContact, "ID", -1); if (userID == m_myUserId || userID == VK_FEED_USER) continue; diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 96c0739145..ceeac8cc98 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -77,7 +77,7 @@ static int ackevent(WPARAM, LPARAM lParam) { ACKDATA *pAck = (ACKDATA *)lParam; if (pAck && pAck->type == ACKTYPE_MESSAGE) { - msgQueue_processack(pAck->hContact, (int)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam); + msgQueue_processack(pAck->hContact, (INT_PTR)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam); if (pAck->result == ACKRESULT_SUCCESS) SkinPlaySound("SendMsg"); diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index da47d1f538..4ca8f3332d 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -243,7 +243,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam; dat = (DetailsData*)mir_calloc(sizeof(DetailsData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (MCONTACT)psh->pszCaption; + dat->hContact = (UINT_PTR)psh->pszCaption; dat->hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK); WindowList_Add(hWindowList, hwndDlg, dat->hContact); @@ -439,10 +439,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) dat->infosUpdated[ack->lParam] = 1; - for (i = 0; i < (int)ack->hProcess; i++) + for (i = 0; i < (INT_PTR)ack->hProcess; i++) if (dat->infosUpdated[i] == 0) break; - if (i == (int)ack->hProcess) { + + if (i == (INT_PTR)ack->hProcess) { ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE); KillTimer(hwndDlg, 1); SendMessage(hwndDlg, M_CHECKONLINE, 0, 0); diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp index eac9fbbe7b..2f7080f8cb 100644 --- a/src/mir_app/src/DefaultExtraIcons.cpp +++ b/src/mir_app/src/DefaultExtraIcons.cpp @@ -65,7 +65,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) if (hIcolib != NULL || clear) { ExtraIcon *extra = GetExtraIcon(hExtraIcon); if (extra) - extra->setIcon((int)hExtraIcon, hContact, hIcolib); + extra->setIcon((INT_PTR)hExtraIcon, hContact, hIcolib); } } @@ -94,7 +94,7 @@ static void SetGender(MCONTACT hContact, int gender, bool clear) if (ico != NULL || clear) { ExtraIcon *extra = GetExtraIcon(hExtraGender); if (extra) - extra->setIconByName((int)hExtraGender, hContact, ico); + extra->setIconByName((INT_PTR)hExtraGender, hContact, ico); } } diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 361069cf08..0c74f5a249 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -217,7 +217,7 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui) if ((UINT_PTR)ti->hIcon >= STATUSICONCOUNT) return ti->hIcon; - return chatApi.hIcons[ICON_STATUS0 + (int)ti->hIcon]; + return chatApi.hIcons[ICON_STATUS0 + (INT_PTR)ti->hIcon]; } return chatApi.hIcons[ICON_STATUS0]; } @@ -794,7 +794,7 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const TCHAR *pszStatu memset(node, 0, sizeof(STATUSINFO)); replaceStrT(node->pszGroup, pszStatus); node->hIcon = (HICON)(*iCount); - while ((int)node->hIcon > STATUSICONCOUNT - 1) + while ((INT_PTR)node->hIcon > STATUSICONCOUNT - 1) node->hIcon--; if (*ppStatusList == NULL) { // list is empty @@ -863,7 +863,7 @@ static BOOL TM_RemoveAll(STATUSINFO **ppStatusList) while (*ppStatusList != NULL) { STATUSINFO *pLast = ppStatusList[0]->next; mir_free(ppStatusList[0]->pszGroup); - if ((int)ppStatusList[0]->hIcon > 10) + if ((INT_PTR)ppStatusList[0]->hIcon > 10) DestroyIcon(ppStatusList[0]->hIcon); mir_free(*ppStatusList); *ppStatusList = pLast; diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 6eceedb9ed..a494e905de 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -274,7 +274,7 @@ static void SetInitDone(SESSION_INFO *si) si->bInitDone = true; for (STATUSINFO *p = si->pStatuses; p; p = p->next) if ((UINT_PTR)p->hIcon < STATUSICONCOUNT) - p->hIcon = HICON(si->iStatusCount - (int)p->hIcon - 1); + p->hIcon = HICON(si->iStatusCount - (INT_PTR)p->hIcon - 1); } static int DoControl(GCEVENT *gce, WPARAM wp) diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 1dff6ca3d3..203720f278 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -89,8 +89,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * if (h != hwndTemp) if (!hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; - } - while (hwndParent); + } while (hwndParent); RECT clRect; GetClientRect(hwnd, &clRect); @@ -294,7 +293,7 @@ void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat) nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.pt.y = si.nMax; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState) @@ -331,9 +330,9 @@ void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newSt nm.hdr.code = CLN_EXPANDED; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.hItem = (HANDLE) group->groupId; + nm.hItem = (HANDLE)group->groupId; nm.action = group->expanded; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat) @@ -348,7 +347,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat) if (contact->type == CLCIT_GROUP) cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1); if (contact->type == CLCIT_CONTACT) - CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM) contact->hContact, 0); + CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)contact->hContact, 0); } int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk) @@ -501,9 +500,9 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) int h = cli.pfnGetRowHeight(dat, dat->selection); dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL); mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc); - SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0); + SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM)(contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0); SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0); - SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1)); + SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM)(-1)); ShowWindow(dat->hwndRenameEdit, SW_SHOW); SetFocus(dat->hwndRenameEdit); } @@ -626,11 +625,11 @@ void fnHideInfoTip(HWND, struct ClcData *dat) return; CLCINFOTIP it = { 0 }; - it.isGroup = IsHContactGroup(dat->hInfoTipItem); - it.hItem = (HANDLE) ((UINT_PTR) dat->hInfoTipItem & ~HCONTACT_ISGROUP); + it.isGroup = IsHContactGroup((UINT_PTR)dat->hInfoTipItem); + it.hItem = (HANDLE)((UINT_PTR)dat->hInfoTipItem & ~HCONTACT_ISGROUP); it.cbSize = sizeof(it); dat->hInfoTipItem = NULL; - NotifyEventHooks(hHideInfoTipEvent, 0, (LPARAM) & it); + NotifyEventHooks(hHideInfoTipEvent, 0, (LPARAM)&it); } void fnNotifyNewContact(HWND hwnd, MCONTACT hContact) @@ -641,7 +640,7 @@ void fnNotifyNewContact(HWND hwnd, MCONTACT hContact) nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; nm.hItem = (HANDLE)hContact; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } DWORD fnGetDefaultExStyle(void) @@ -695,10 +694,10 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) mir_snprintf(idstr, "Font%dCol", i); *colour = db_get_dw(NULL, "CLC", idstr, *colour); - + mir_snprintf(idstr, "Font%dSize", i); lf->lfHeight = (char)db_get_b(NULL, "CLC", idstr, lf->lfHeight); - + mir_snprintf(idstr, "Font%dSty", i); BYTE style = (BYTE)db_get_b(NULL, "CLC", idstr, (lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0)); lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0; @@ -706,7 +705,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) lf->lfItalic = (style & DBFONTF_ITALIC) != 0; lf->lfUnderline = (style & DBFONTF_UNDERLINE) != 0; lf->lfStrikeOut = 0; - + mir_snprintf(idstr, "Font%dSet", i); lf->lfCharSet = db_get_b(NULL, "CLC", idstr, lf->lfCharSet); lf->lfOutPrecision = OUT_DEFAULT_PRECIS; @@ -750,7 +749,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) dat->groupIndent = 10; LPARAM dwColor = GetSysColor(COLOR_WINDOWTEXT); - for (int i=0; i <= FONTID_MAX; i++) + for (int i = 0; i <= FONTID_MAX; i++) SendMessage(hwnd, CLM_SETTEXTCOLOR, i, dwColor); } @@ -823,7 +822,7 @@ void fnSetContactCheckboxes(ClcContact *cc, int checked) void fnSetGroupChildCheckboxes(ClcGroup *group, int checked) { - for (int i=0; i < group->cl.count; i++) { + for (int i = 0; i < group->cl.count; i++) { ClcContact *cc = group->cl.items[i]; if (cc->type == CLCIT_GROUP) { cli.pfnSetGroupChildCheckboxes(cc->group, checked); diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 0054d57c26..e6a6897fed 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -111,14 +111,14 @@ TCHAR* fnGetStatusModeDescription(int mode, int flags) static int ProtocolAck(WPARAM, LPARAM lParam) { - ACKDATA *ack = (ACKDATA *) lParam; + ACKDATA *ack = (ACKDATA*)lParam; if (ack->type != ACKTYPE_STATUS) return 0; cli.pfnCluiProtocolStatusChanged(lParam, ack->szModule); - if ((int)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) { - DWORD caps = (DWORD)CallProtoServiceInt(NULL,ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); + if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) { + DWORD caps = (DWORD)CallProtoServiceInt(NULL, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_SERVERCLIST) { for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) { MCONTACT hNext = db_find_next(hContact, ack->szModule); @@ -150,7 +150,7 @@ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT) index = 0; if (szProto == NULL) return index + 1; - for (i=0; i < protoIconIndex.getCount(); i++) { + for (i = 0; i < protoIconIndex.getCount(); i++) { if (mir_strcmp(szProto, protoIconIndex[i].szProto) == 0) return protoIconIndex[i].iIconBase + index; } @@ -173,7 +173,7 @@ static void AddProtoIconIndex(PROTOACCOUNT *pa) { ProtoIconIndex *pii = new ProtoIconIndex; pii->szProto = pa->szModuleName; - for (int i=0; i < _countof(statusModeList); i++) { + for (int i = 0; i < _countof(statusModeList); i++) { int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i]); if (i == 0) pii->iIconBase = iImg; @@ -183,7 +183,7 @@ static void AddProtoIconIndex(PROTOACCOUNT *pa) static void RemoveProtoIconIndex(PROTOACCOUNT *pa) { - for (int i=0; i < protoIconIndex.getCount(); i++) + for (int i = 0; i < protoIconIndex.getCount(); i++) if (mir_strcmp(protoIconIndex[i].szProto, pa->szModuleName) == 0) { protoIconIndex.remove(i); break; @@ -193,7 +193,7 @@ static void RemoveProtoIconIndex(PROTOACCOUNT *pa) static int ContactListModulesLoaded(WPARAM, LPARAM) { RebuildMenuOrder(); - for (int i=0; i < accounts.getCount(); i++) + for (int i = 0; i < accounts.getCount(); i++) AddProtoIconIndex(accounts[i]); cli.pfnLoadContactTree(); @@ -253,11 +253,11 @@ static int CListIconsChanged(WPARAM, LPARAM) { int i, j; - for (i=0; i < _countof(statusModeList); i++) + for (i = 0; i < _countof(statusModeList); i++) ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, Skin_LoadIcon(skinIconStatusList[i])); ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN)); ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT)); - for (i=0; i < protoIconIndex.getCount(); i++) + for (i = 0; i < protoIconIndex.getCount(); i++) for (j = 0; j < _countof(statusModeList); j++) ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, Skin_LoadProtoIcon(protoIconIndex[i].szProto, statusModeList[j])); cli.pfnTrayIconIconsChanged(); @@ -408,14 +408,12 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) { MCONTACT a = wParam, b = lParam; TCHAR namea[128], *nameb; - int statusa, statusb; - char *szProto1, *szProto2; int rc; - szProto1 = GetContactProto(a); - szProto2 = GetContactProto(b); - statusa = db_get_w(a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); - statusb = db_get_w(b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); + char *szProto1 = GetContactProto(a); + char *szProto2 = GetContactProto(b); + int statusa = db_get_w(a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); + int statusb = db_get_w(b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); if (sortByProto) { /* deal with statuses, online contacts have to go above offline */ @@ -445,7 +443,6 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) nameb = cli.pfnGetContactDisplayName(a, 0); _tcsncpy_s(namea, nameb, _TRUNCATE); - namea[ _countof(namea)-1 ] = 0; nameb = cli.pfnGetContactDisplayName(b, 0); //otherwise just compare names @@ -495,11 +492,11 @@ int LoadContactListModule2(void) ImageList_AddIcon_NotShared(hCListImages, MAKEINTRESOURCE(IDI_BLANK)); - //now all core skin icons are loaded via icon lib. so lets release them - for (int i=0; i < _countof(statusModeList); i++) + // now all core skin icons are loaded via icon lib. so lets release them + for (int i = 0; i < _countof(statusModeList); i++) ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i]); - //see IMAGE_GROUP... in clist.h if you add more images above here + // see IMAGE_GROUP... in clist.h if you add more images above here ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN); ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT); return 0; @@ -510,7 +507,7 @@ void UnloadContactListModule() if (!hCListImages) return; - //remove transitory contacts + // remove transitory contacts for (MCONTACT hContact = db_find_first(); hContact != NULL; ) { MCONTACT hNext = db_find_next(hContact); if (db_get_b(hContact, "CList", "NotOnList", 0)) diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index b671474456..eaf391935a 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -46,7 +46,7 @@ static bool hasTips() #define initcheck if (!fTrayInited) return -#define SIZEOFNID ((cli.shellVersion >= 5) ? NOTIFYICONDATA_V2_SIZE : NOTIFYICONDATA_V1_SIZE) +#define SIZEOFNID (DWORD)((cli.shellVersion >= 5) ? NOTIFYICONDATA_V2_SIZE : NOTIFYICONDATA_V1_SIZE) static BOOL fTrayInited = FALSE; diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 2d984fc5dd..90c3d2fe8c 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -791,7 +791,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CLN_NEWCONTACT: if (nmc != NULL) - cli.pfnSetAllExtraIcons((MCONTACT)nmc->hItem); + cli.pfnSetAllExtraIcons((UINT_PTR)nmc->hItem); return TRUE; case CLN_LISTREBUILT: @@ -844,8 +844,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y)); if (hItem) { if (hitFlags & CLCHT_ONITEMEXTRA) { - if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) - if (cli.pfnGetCacheEntry((MCONTACT)nmc->hItem)) + if (!IsHContactGroup((UINT_PTR)hItem) && !IsHContactInfo((UINT_PTR)hItem)) + if (cli.pfnGetCacheEntry((UINT_PTR)nmc->hItem)) NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn+1); } break; diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index 3c1fe00047..321b9c8d21 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -101,7 +101,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage) ExtraIcon* GetExtraIcon(HANDLE id) { - int i = (int)id; + int i = (INT_PTR)id; if (i < 1 || i > extraIconsByHandle.getCount()) return NULL; @@ -473,7 +473,7 @@ MIR_APP_DLL(int) ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE if (extra == NULL) return -1; - return extra->setIcon((int)hExtraIcon, hContact, hImage); + return extra->setIcon((INT_PTR)hExtraIcon, hContact, hImage); } MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName) @@ -485,7 +485,7 @@ MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, c if (extra == NULL) return -1; - return extra->setIconByName((int)hExtraIcon, hContact, icoName); + return extra->setIconByName((INT_PTR)hExtraIcon, hContact, icoName); } MIR_APP_DLL(int) ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact) @@ -497,7 +497,7 @@ MIR_APP_DLL(int) ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact) if (extra == NULL) return -1; - return extra->setIcon((int)hExtraIcon, hContact, NULL); + return extra->setIcon((INT_PTR)hExtraIcon, hContact, NULL); } static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM) diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index cfbdd96d0c..55f8863d75 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -1017,7 +1017,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) for (int i = 0; i < accounts.getCount(); i++) { if (!mir_strcmp(accounts[i]->szModuleName, ack->szModule)) { - int iOldStatus = (int)ack->hProcess; + int iOldStatus = (INT_PTR)ack->hProcess; if ((iOldStatus >= ID_STATUS_OFFLINE || iOldStatus == 0) && iOldStatus < ID_STATUS_OFFLINE + _countof(statusModeList)) { int pos = statustopos(iOldStatus); if (pos == -1) diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 38d926147b..82c2fa90d7 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -570,7 +570,7 @@ static int Meta_MessageWindowEvent(WPARAM, LPARAM lParam) static INT_PTR Meta_SrmmCurrentSub(WPARAM hMeta, LPARAM) { - MetaSrmmData tmp = { hMeta }; + MetaSrmmData tmp = { (UINT_PTR)hMeta }; if (MetaSrmmData *p = arMetaWindows.find(&tmp)) return p->m_hSub; @@ -659,7 +659,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM) static VOID CALLBACK sttMenuThread(PVOID param) { - HMENU hMenu = Menu_BuildContactMenu(MCONTACT(param)); + HMENU hMenu = Menu_BuildContactMenu((UINT_PTR)param); TPMPARAMS tpmp = { 0 }; tpmp.cbSize = sizeof(tpmp); diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 9790fdd325..ceac065583 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -83,7 +83,7 @@ struct OptionsPageData : public MZeroedObject OptionsPageData(OPTIONSDIALOGPAGE *src) { if (src->hInstance != NULL && src->pszTemplate != NULL) - pDialog = new COptionPageDialog(src->hInstance, (int)src->pszTemplate, src->pfnDlgProc, src->dwInitParam); + pDialog = new COptionPageDialog(src->hInstance, (INT_PTR)src->pszTemplate, src->pfnDlgProc, src->dwInitParam); else pDialog = src->pDialog; assert(pDialog != NULL); diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 8db8f9563b..698f7d4b72 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -134,7 +134,7 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) return NULL; HICON hIcon = NULL; // icon handle - int index = -(int)lpIconName; + int index = -(INT_PTR)lpIconName; ExtractIconEx(filename, index, NULL, &hIcon, 1); return hIcon; } -- cgit v1.2.3