diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-02 19:30:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-02 19:30:22 +0000 |
commit | d0bf6d4bd16ec8c5c677557db0c5d90d9af8e06a (patch) | |
tree | 6c29063c796ce34e88481495ed14dd1d8e8f69af /plugins | |
parent | 1fb814c69fe24e3b365dbf485d1fbef4a9993c4f (diff) |
64-bit compilation fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@268 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ClientChangeNotify/ClientChangeNotify.cpp | 350 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/OptDlg.cpp | 171 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_LogService.h | 16 | ||||
-rw-r--r-- | plugins/FloatingContacts/main.cpp | 2 | ||||
-rw-r--r-- | plugins/ListeningTo/players/winamp_mlt/mlt_winamp.cpp | 8 |
5 files changed, 223 insertions, 324 deletions
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/ClientChangeNotify.cpp index 2f0b51349e..4d14b66e11 100644 --- a/plugins/ClientChangeNotify/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/ClientChangeNotify.cpp @@ -143,12 +143,12 @@ static int CALLBACK MenuWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar }
-static VOID CALLBACK ShowContactMenu(DWORD wParam)
+static VOID CALLBACK ShowContactMenu(UINT_PTR wParam)
// wParam = hContact
{
POINT pt;
HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T(MOD_NAME)_T("_MenuWindow"), 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL);
- SetWindowLong(hMenuWnd, GWL_WNDPROC, (LONG)(WNDPROC)MenuWndProc);
+ SetWindowLong(hMenuWnd, GWLP_WNDPROC, (LONG)(WNDPROC)MenuWndProc);
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)wParam, 0);
GetCursorPos(&pt);
SetForegroundWindow(hMenuWnd);
@@ -162,60 +162,49 @@ static VOID CALLBACK ShowContactMenu(DWORD wParam) void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA *pdata)
{
HANDLE hContact = (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0);
- switch (Action)
+ switch (Action) {
+ case PCA_OPENMESSAGEWND: // open message window
+ if (hContact && hContact != INVALID_HANDLE_VALUE)
+ CallServiceSync(ServiceExists("SRMsg/LaunchMessageWindow") ? "SRMsg/LaunchMessageWindow" : MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+ break;
+
+ case PCA_OPENMENU: // open contact menu
+ if (hContact && hContact != INVALID_HANDLE_VALUE)
+ QueueUserAPC(ShowContactMenu, g_hMainThread, (ULONG_PTR)hContact);
+ break;
+
+ case PCA_OPENDETAILS: // open contact details window
+ if (hContact != INVALID_HANDLE_VALUE)
+ CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
+ break;
+
+ case PCA_OPENHISTORY: // open contact history
+ if (hContact != INVALID_HANDLE_VALUE)
+ CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0);
+ break;
+
+ case PCA_OPENLOG: // open log file
{
- case PCA_OPENMESSAGEWND: // open message window
- {
- if (hContact && hContact != INVALID_HANDLE_VALUE)
- {
- CallServiceSync(ServiceExists("SRMsg/LaunchMessageWindow") ? "SRMsg/LaunchMessageWindow" : MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
- }
- } break;
- case PCA_OPENMENU: // open contact menu
- {
- if (hContact && hContact != INVALID_HANDLE_VALUE)
- {
- QueueUserAPC(ShowContactMenu, g_hMainThread, (ULONG_PTR)hContact);
- }
- } break;
- case PCA_OPENDETAILS: // open contact details window
- {
- if (hContact != INVALID_HANDLE_VALUE)
- {
- CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
- }
- } break;
- case PCA_OPENHISTORY: // open contact history
- {
- if (hContact != INVALID_HANDLE_VALUE)
- {
- CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0);
- }
- } break;
- case PCA_OPENLOG: // open log file
- {
- TCString LogFilePath;
- LS_LOGINFO li = {0};
- li.cbSize = sizeof(li);
- li.szID = LOG_ID;
- li.hContact = hContact;
- li.Flags = LSLI_TCHAR;
- li.tszLogPath = LogFilePath.GetBuffer(MAX_PATH);
- if (!CallService(MS_LOGSERVICE_GETLOGINFO, (WPARAM)&li, 0))
- {
- LogFilePath.ReleaseBuffer();
- ShowLog(LogFilePath);
- } else
- {
- LogFilePath.ReleaseBuffer();
- }
- } break;
- case PCA_CLOSEPOPUP: // close popup
- {
- PUDeletePopUp(hWnd);
- } break;
- case PCA_DONOTHING: // do nothing
- break;
+ TCString LogFilePath;
+ LS_LOGINFO li = {0};
+ li.cbSize = sizeof(li);
+ li.szID = LOG_ID;
+ li.hContact = hContact;
+ li.Flags = LSLI_TCHAR;
+ li.tszLogPath = LogFilePath.GetBuffer(MAX_PATH);
+ if (!CallService(MS_LOGSERVICE_GETLOGINFO, (WPARAM)&li, 0)) {
+ LogFilePath.ReleaseBuffer();
+ ShowLog(LogFilePath);
+ }
+ else LogFilePath.ReleaseBuffer();
+ break;
+ }
+ case PCA_CLOSEPOPUP: // close popup
+ PUDeletePopUp(hWnd);
+ break;
+
+ case PCA_DONOTHING: // do nothing
+ break;
}
}
@@ -223,32 +212,26 @@ void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA *pdata) static int CALLBACK PopupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PLUGIN_DATA *pdata = (PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
- if (pdata)
- {
- switch (message)
- {
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == STN_CLICKED) // left mouse button
- {
- Popup_DoAction(hWnd, pdata->PopupLClickAction, pdata);
- return true;
- }
- } break;
- case WM_CONTEXTMENU: // right mouse button
- {
- Popup_DoAction(hWnd, pdata->PopupRClickAction, pdata);
+ if (pdata) {
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) { // left mouse button
+ Popup_DoAction(hWnd, pdata->PopupLClickAction, pdata);
return true;
- } break;
- case UM_FREEPLUGINDATA:
- {
- if (pdata->hIcon)
- {
- DestroyIcon(pdata->hIcon);
- }
- free(pdata);
- return false;
- } break;
+ }
+ break;
+
+ case WM_CONTEXTMENU: // right mouse button
+ Popup_DoAction(hWnd, pdata->PopupRClickAction, pdata);
+ return true;
+
+ case UM_FREEPLUGINDATA:
+ if (pdata->hIcon)
+ DestroyIcon(pdata->hIcon);
+
+ free(pdata);
+ return false;
+ break;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -258,23 +241,23 @@ static int CALLBACK PopupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM void ShowPopup(SHOWPOPUP_DATA *sd)
{
TCString PopupText;
- if (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT))
- {
+ if (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT)) {
mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s (was %s)"), (const TCHAR*)sd->MirVer, (const TCHAR*)sd->OldMirVer);
PopupText.ReleaseBuffer();
- } else
- {
+ }
+ else {
mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s"), (const TCHAR*)sd->MirVer);
PopupText.ReleaseBuffer();
}
+
PLUGIN_DATA *pdata = (PLUGIN_DATA*)calloc(1, sizeof(PLUGIN_DATA));
POPUPDATAT ppd = {0};
ppd.lchContact = sd->hContact;
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)sd->hContact, 0);
pdata->hIcon = ppd.lchIcon = (HICON)CallService(MS_FP_GETCLIENTICON, (WPARAM)(const char*)TCHAR2ANSI(sd->MirVer), false);
_ASSERT(ppd.lchIcon);
- if (!ppd.lchIcon || (DWORD)ppd.lchIcon == CALLSERVICE_NOTFOUND)
- { // if we didn't succeed retrieving client icon, show the usual status icon instead
+ if (!ppd.lchIcon || (DWORD)ppd.lchIcon == CALLSERVICE_NOTFOUND) {
+ // if we didn't succeed retrieving client icon, show the usual status icon instead
ppd.lchIcon = LoadSkinnedProtoIcon(szProto, DBGetContactSettingWord(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE));
pdata->hIcon = NULL;
}
@@ -290,125 +273,98 @@ void ShowPopup(SHOWPOPUP_DATA *sd) CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
}
-
int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (!lstrcmpA(cws->szSetting, DB_MIRVER))
- {
+ if (!lstrcmpA(cws->szSetting, DB_MIRVER)) {
HANDLE hContact = (HANDLE)wParam;
SHOWPOPUP_DATA sd = {0};
char *szProto = NULL;
if (g_PreviewOptPage)
- {
sd.MirVer = _T("Miranda IM 0.6.0.1 (ICQ v0.3.7 alpha)");
- } else
- {
+ else {
if (!hContact) // exit if hContact == NULL and it's not a popup preview
- {
return 0;
- }
+
szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
_ASSERT(szProto);
if (ServiceExists(MS_MC_GETPROTOCOLNAME) && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
- {
return 0;
- }
+
sd.MirVer = DBGetContactSettingString(hContact, szProto, DB_MIRVER, _T(""));
if (sd.MirVer.IsEmpty())
- {
return 0;
- }
}
sd.OldMirVer = DBGetContactSettingString(hContact, MOD_NAME, DB_OLDMIRVER, _T(""));
DBWriteContactSettingTString(hContact, MOD_NAME, DB_OLDMIRVER, sd.MirVer); // we have to write it here, because we modify sd.OldMirVer and sd.MirVer to conform our settings later
- if (sd.OldMirVer.IsEmpty())
- { // looks like it's the right way to do
+ if (sd.OldMirVer.IsEmpty()) // looks like it's the right way to do
return 0;
- }
+
COptPage PopupOptPage;
if (g_PreviewOptPage)
- {
PopupOptPage = *g_PreviewOptPage;
- } else
- {
+ else {
PopupOptPage = g_PopupOptPage;
PopupOptPage.DBToMem();
}
+
HANDLE hContactOrMeta = (hContact && ServiceExists(MS_MC_GETMETACONTACT)) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact;
if (!hContactOrMeta)
- {
hContactOrMeta = hContact;
- }
+
if (hContact && DBGetContactSettingByte(hContactOrMeta, "CList", "Hidden", 0))
- {
return 0;
- }
+
int PerContactSetting = hContact ? DBGetContactSettingByte(hContact, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL) : NOTIFY_ALWAYS; // NOTIFY_ALWAYS for preview
if (PerContactSetting == NOTIFY_USEGLOBAL && hContactOrMeta != hContact) // subcontact setting has a priority over a metacontact setting
- {
PerContactSetting = DBGetContactSettingByte(hContactOrMeta, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL);
- }
- if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(DBGetContactSettingDword(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) // check if we need to notify at all
- {
+
+ if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(DBGetContactSettingDword(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) { // check if we need to notify at all
sd.hContact = hContact;
sd.PopupOptPage = &PopupOptPage;
- if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER))
- {
+ if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
CString OldMirVerA = TCHAR2ANSI(sd.OldMirVer);
CString MirVerA = TCHAR2ANSI(sd.MirVer);
- if (ServiceExists(MS_FP_SAMECLIENTS))
- {
+ if (ServiceExists(MS_FP_SAMECLIENTS)) {
char *szOldClient = (char*)CallService(MS_FP_SAMECLIENTS, (WPARAM)(const char*)OldMirVerA, (LPARAM)(const char*)OldMirVerA); // remove version from MirVer strings. I know, the way in which MS_FP_SAMECLIENTS is used here is pretty ugly, but at least it gives necessary results
char *szClient = (char*)CallService(MS_FP_SAMECLIENTS, (WPARAM)(const char*)MirVerA, (LPARAM)(const char*)MirVerA);
- if (szOldClient && szClient)
- {
+ if (szOldClient && szClient) {
if (PerContactSetting != NOTIFY_ALMOST_ALWAYS && PerContactSetting != NOTIFY_ALWAYS && !PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) && !strcmp(szClient, szOldClient))
- {
return 0;
- }
- if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER))
- {
+
+ if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
sd.MirVer = ANSI2TCHAR(szClient);
sd.OldMirVer = ANSI2TCHAR(szOldClient);
}
}
}
}
- if (sd.MirVer == (const TCHAR*)sd.OldMirVer)
- {
+ if (sd.MirVer == (const TCHAR*)sd.OldMirVer) {
_ASSERT(hContact);
return 0;
}
- if (PerContactSetting == NOTIFY_ALWAYS || (PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || !PcreCheck(sd.MirVer))))
- {
+ if (PerContactSetting == NOTIFY_ALWAYS || (PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || !PcreCheck(sd.MirVer)))) {
ShowPopup(&sd);
SkinPlaySound(CLIENTCHANGED_SOUND);
}
}
- if (hContact)
- {
+ if (hContact) {
TCString ClientName;
- if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen())
- {
+ if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen()) {
mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const TCHAR*)sd.MirVer, (const TCHAR*)sd.OldMirVer);
ClientName.ReleaseBuffer();
- } else
- {
- ClientName = sd.MirVer;
}
- if (ServiceExists(MS_VARS_FORMATSTRING))
- {
+ else ClientName = sd.MirVer;
+
+ if (ServiceExists(MS_VARS_FORMATSTRING))
logservice_log(LOG_ID, hContact, ClientName);
- } else
- {
+ else {
_ASSERT(szProto);
TCString szUID(_T(""));
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (uid && (int)uid != CALLSERVICE_NOTFOUND)
- {
szUID = DBGetContactSettingAsString(hContact, szProto, uid, _T(""));
- }
+
logservice_log(LOG_ID, hContact, TCString((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)) + _T(" (") + szUID + TranslateT(") changed client to ") + ClientName);
}
}
@@ -417,16 +373,13 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-
static int ContactSettingsInit(WPARAM wParam, LPARAM lParam)
{
CONTACTSETTINGSINIT *csi = (CONTACTSETTINGSINIT*)wParam;
char *szProto = (csi->Type == CSIT_CONTACT) ? (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)csi->hContact, 0) : NULL;
- if ((csi->Type == CSIT_GROUP) || (szProto && csi->Type == CSIT_CONTACT))
- {
+ if ((csi->Type == CSIT_GROUP) || (szProto && csi->Type == CSIT_CONTACT)) {
int Flag1 = (csi->Type == CSIT_CONTACT) ? CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) : PF1_IM; // if it's a group settings dialog, we assume that there are possibly some contacts in the group with PF1_IM capability
- if (Flag1 & (PF1_IMRECV | PF1_URLRECV | PF1_FILERECV)) // I hope, these flags are sufficient to describe which protocols can theoretically have a client
- {
+ if (Flag1 & (PF1_IMRECV | PF1_URLRECV | PF1_FILERECV)) { // I hope, these flags are sufficient to describe which protocols can theoretically have a client
CONTACTSETTINGSCONTROL csc = {0};
csc.cbSize = sizeof(csc);
csc.cbStateSize = sizeof(CSCONTROLSTATE);
@@ -448,7 +401,7 @@ static int ContactSettingsInit(WPARAM wParam, LPARAM lParam) }
-static int srvTogglePopups(WPARAM wParam, LPARAM lParam)
+static INT_PTR srvTogglePopups(WPARAM wParam, LPARAM lParam)
{
g_PopupOptPage.SetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY, !g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY));
return 0;
@@ -456,18 +409,17 @@ static int srvTogglePopups(WPARAM wParam, LPARAM lParam) static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam)
-{ // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
- if (ServiceExists(MS_POPUP_ADDPOPUPT))
- {
+{
+ // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | CMIM_NAME | CMIM_ICON;
- if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY))
- {
+ if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) {
mi.ptszName = TranslateT("Disable c&lient change notification");
mi.hIcon = ServiceExists(MS_SKIN2_GETICON) ? (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"popup_enabled") : NULL;
- } else
- {
+ }
+ else {
mi.ptszName = TranslateT("Enable c&lient change notification");
mi.hIcon = ServiceExists(MS_SKIN2_GETICON) ? (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"popup_disabled") : NULL;
}
@@ -477,35 +429,26 @@ static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam) return 0;
}
-
-int CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- return true;
- } break;
- case WM_COMMAND:
- {
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
- {
- DestroyWindow(hwndDlg);
- }
- } break;
- case WM_DESTROY:
- {
- if (IsDlgButtonChecked(hwndDlg, IDC_DONTREMIND))
- {
- DBWriteContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 1);
- }
- } break;
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ return true;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ DestroyWindow(hwndDlg);
+ break;
+
+ case WM_DESTROY:
+ if (IsDlgButtonChecked(hwndDlg, IDC_DONTREMIND))
+ DBWriteContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 1);
+ break;
}
return 0;
}
-
int MirandaLoaded(WPARAM wParam, LPARAM lParam)
{
InitPcre();
@@ -522,7 +465,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) update.cbSize = sizeof(Update);
update.szComponentName = pluginInfo.shortName;
update.pbVersion = (BYTE*)CreateVersionString(my_make_version(PRODUCTVER), szVersion);
- update.cpbVersion = strlen((char*)update.pbVersion);
+ update.cpbVersion = (int)strlen((char*)update.pbVersion);
update.szUpdateURL = "http://deathdemon.int.ru/projects/ClientChangeNotify"
#ifdef _UNICODE
"W"
@@ -534,49 +477,29 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) " Unicode"
#endif
" version ";
- update.cpbVersionPrefix = strlen((char*)update.pbVersionPrefix);
+ update.cpbVersionPrefix = (int)strlen((char*)update.pbVersionPrefix);
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
- if (ServiceExists(MS_POPUP_ADDPOPUPT))
- {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
hServices.AddElem(CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups));
hHooks.AddElem(HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu));
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY))
- {
mi.ptszName = TranslateT("Disable c&lient change notification");
- } else
- {
+ else
mi.ptszName = TranslateT("Enable c&lient change notification");
- }
+
mi.pszService = MS_CCN_TOGGLEPOPUPS;
mi.ptszPopupName = TranslateT("PopUps");
g_hTogglePopupsMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
}
-/* if (DBGetContactSettingByte(NULL, MOD_NAME, DB_FIRSTRUN, 1)) // DB_SETTINGSVER
- {
- DBWriteContactSettingByte(NULL, MOD_NAME, DB_FIRSTRUN, 0);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); // copy MirVer to OldMirVer for every contact; well, it won't work for every possible case (we can't detect when user had disabled the plugin for some time and then enabled it again), but at least it'll work once, for the first run ;)
- do
- {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto)
- {
- TCString MirVer(DBGetContactSettingString(hContact, szProto, DB_MIRVER, _T("")));
- if (MirVer.GetLen())
- {
- DBWriteContactSettingTString(hContact, MOD_NAME, DB_OLDMIRVER, MirVer);
- }
- }
- } while (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
- }*/
+ // seems that Fingerprint is not installed
if ((!ServiceExists(MS_FP_SAMECLIENTS) || !ServiceExists(MS_FP_GETCLIENTICON)) && !DBGetContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
- { // seems that Fingerprint is not installed
CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc);
- }
+
logservice_register(LOG_ID, LPGENT("ClientChangeNotify"), _T("ClientChangeNotify?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateT("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) changed client to %extratext%"));
return 0;
}
@@ -592,17 +515,14 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, THREAD_SET_CONTEXT, false, 0);
InitOptions();
if (DBGetContactSettingString(NULL, "KnownModules", MOD_NAME, (char*)NULL) == NULL)
- {
DBWriteContactSettingString(NULL, "KnownModules", MOD_NAME, MOD_NAME);
- }
- if (DBGetContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1)
- {
+
+ if (DBGetContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1) {
TCString Str;
Str = DBGetContactSettingString(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, _T(""));
- if (Str.GetLen())
- { // fix incorrect regexp from v0.1.1.0
+ if (Str.GetLen()) // fix incorrect regexp from v0.1.1.0
DBWriteContactSettingTString(NULL, MOD_NAME, DB_IGNORESUBSTRINGS, Str.Replace(_T("/Miranda[0-9A-F]{8}/"), _T("/[0-9A-F]{8}(\\W|$)/")));
- }
+
DBWriteContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 1);
}
return 0;
@@ -613,19 +533,13 @@ extern "C" int __declspec(dllexport) Unload() CloseHandle(g_hMainThread);
int I;
for (I = 0; I < hHooks.GetSize(); I++)
- {
if (hHooks[I])
- {
UnhookEvent(hHooks[I]);
- }
- }
+
for (I = 0; I < hServices.GetSize(); I++)
- {
if (hServices[I])
- {
DestroyServiceFunction(hServices[I]);
- }
- }
+
UninitPcre();
return 0;
}
diff --git a/plugins/ClientChangeNotify/OptDlg.cpp b/plugins/ClientChangeNotify/OptDlg.cpp index 0c02f2b5e4..95224fb672 100644 --- a/plugins/ClientChangeNotify/OptDlg.cpp +++ b/plugins/ClientChangeNotify/OptDlg.cpp @@ -69,13 +69,26 @@ void EnablePopupOptDlgControls() InvalidateRect(GetDlgItem(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_POPUPDELAY_SPIN), NULL, false); // update spin control
}
-
-int CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static struct {
+ TCHAR *Text;
+ int Action;
+}
+PopupActions[] =
+{
+ LPGENT("Open message window"), PCA_OPENMESSAGEWND,
+ LPGENT("Close popup"), PCA_CLOSEPOPUP,
+ LPGENT("Open contact details window"), PCA_OPENDETAILS,
+ LPGENT("Open contact menu"), PCA_OPENMENU,
+ LPGENT("Open contact history"), PCA_OPENHISTORY,
+ LPGENT("Open log file"), PCA_OPENLOG,
+ LPGENT("Do nothing"), PCA_DONOTHING
+};
+
+INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int ChangeLock = 0;
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
ChangeLock++;
@@ -86,106 +99,79 @@ int CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) HWND hLCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_LCLICK_ACTION);
HWND hRCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_RCLICK_ACTION);
- static struct {
- TCHAR *Text;
- int Action;
- } PopupActions[] = {
- LPGENT("Open message window"), PCA_OPENMESSAGEWND,
- LPGENT("Close popup"), PCA_CLOSEPOPUP,
- LPGENT("Open contact details window"), PCA_OPENDETAILS,
- LPGENT("Open contact menu"), PCA_OPENMENU,
- LPGENT("Open contact history"), PCA_OPENHISTORY,
- LPGENT("Open log file"), PCA_OPENLOG,
- LPGENT("Do nothing"), PCA_DONOTHING
- };
int I;
- for (I = 0; I < lengthof(PopupActions); I++)
- {
+ for (I = 0; I < lengthof(PopupActions); I++) {
SendMessage(hLCombo, CB_SETITEMDATA, SendMessage(hLCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[I].Text)), PopupActions[I].Action);
SendMessage(hRCombo, CB_SETITEMDATA, SendMessage(hRCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[I].Text)), PopupActions[I].Action);
}
g_PopupOptPage.DBToMemToPage();
EnablePopupOptDlgControls();
ChangeLock--;
+ }
+ return true;
+
+ case WM_NOTIFY:
+ switch (((NMHDR*)lParam)->code) {
+ case PSN_APPLY:
+ g_PopupOptPage.PageToMemToDB();
+ RecompileRegexps(*(TCString*)g_PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS));
return true;
- } break;
- case WM_NOTIFY:
- {
- switch (((NMHDR*)lParam)->code)
- {
- case PSN_APPLY:
- {
- g_PopupOptPage.PageToMemToDB();
- RecompileRegexps(*(TCString*)g_PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS));
- return true;
- } break;
- }
- } break;
- case WM_COMMAND:
- {
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- {
- switch (LOWORD(wParam))
- {
- case IDC_POPUPOPTDLG_POPUPNOTIFY:
- case IDC_POPUPOPTDLG_DEFBGCOLOUR:
- case IDC_POPUPOPTDLG_DEFTEXTCOLOUR:
- case IDC_POPUPOPTDLG_VERCHGNOTIFY:
- {
- EnablePopupOptDlgControls();
- } // go through
- case IDC_POPUPOPTDLG_SHOWPREVCLIENT:
- case IDC_POPUPOPTDLG_SHOWVER:
- case IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- return 0;
- } break;
- case IDC_POPUPOPTDLG_POPUPPREVIEW:
- {
- g_PreviewOptPage = new COptPage(g_PopupOptPage);
- g_PreviewOptPage->PageToMem();
- DBCONTACTWRITESETTING cws = {0};
- cws.szModule = "ICQ";
- cws.szSetting = DB_MIRVER;
- DBWriteContactSettingString(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5");
- ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change
- delete g_PreviewOptPage;
- g_PreviewOptPage = NULL;
- } break;
- }
- } break;
- case EN_CHANGE:
- {
- if (LOWORD(wParam) == IDC_POPUPOPTDLG_POPUPDELAY || LOWORD(wParam) == IDC_POPUPOPTDLG_IGNORESTRINGS)
- {
- if (!ChangeLock && g_PopupOptPage.GetWnd())
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
- }
- } break;
- case CBN_SELCHANGE:
- {
- if ((LOWORD(wParam) == IDC_POPUPOPTDLG_LCLICK_ACTION) || (LOWORD(wParam) == IDC_POPUPOPTDLG_RCLICK_ACTION) || (LOWORD(wParam) == IDC_POPUPOPTDLG_BGCOLOUR) || (LOWORD(wParam) == IDC_POPUPOPTDLG_TEXTCOLOUR))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
- } break;
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ switch (LOWORD(wParam)) {
+ case IDC_POPUPOPTDLG_POPUPNOTIFY:
+ case IDC_POPUPOPTDLG_DEFBGCOLOUR:
+ case IDC_POPUPOPTDLG_DEFTEXTCOLOUR:
+ case IDC_POPUPOPTDLG_VERCHGNOTIFY:
+ EnablePopupOptDlgControls();
+ // go through
+
+ case IDC_POPUPOPTDLG_SHOWPREVCLIENT:
+ case IDC_POPUPOPTDLG_SHOWVER:
+ case IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+ return 0;
+
+ case IDC_POPUPOPTDLG_POPUPPREVIEW:
+ g_PreviewOptPage = new COptPage(g_PopupOptPage);
+ g_PreviewOptPage->PageToMem();
+ DBCONTACTWRITESETTING cws = {0};
+ cws.szModule = "ICQ";
+ cws.szSetting = DB_MIRVER;
+ DBWriteContactSettingString(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5");
+ ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change
+ delete g_PreviewOptPage;
+ g_PreviewOptPage = NULL;
+ break;
}
- } break;
- case WM_DESTROY:
- {
- g_PopupOptPage.SetWnd(NULL);
- return 0;
- } break;
+ break;
+
+ case EN_CHANGE:
+ if (LOWORD(wParam) == IDC_POPUPOPTDLG_POPUPDELAY || LOWORD(wParam) == IDC_POPUPOPTDLG_IGNORESTRINGS)
+ if (!ChangeLock && g_PopupOptPage.GetWnd())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+
+ break;
+
+ case CBN_SELCHANGE:
+ if ((LOWORD(wParam) == IDC_POPUPOPTDLG_LCLICK_ACTION) || (LOWORD(wParam) == IDC_POPUPOPTDLG_RCLICK_ACTION) || (LOWORD(wParam) == IDC_POPUPOPTDLG_BGCOLOUR) || (LOWORD(wParam) == IDC_POPUPOPTDLG_TEXTCOLOUR))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ g_PopupOptPage.SetWnd(NULL);
+ return 0;
}
return 0;
}
-
int OptionsDlgInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE optDi = {0};
@@ -201,7 +187,6 @@ int OptionsDlgInit(WPARAM wParam, LPARAM lParam) return 0;
}
-
void InitOptions()
{
g_PopupOptPage.Items.AddElem(new COptItem_Checkbox(IDC_POPUPOPTDLG_POPUPNOTIFY, "PopupNotify", DBVT_BYTE, 1));
diff --git a/plugins/ExternalAPI/m_LogService.h b/plugins/ExternalAPI/m_LogService.h index dc6c9f0012..92c6898bc7 100644 --- a/plugins/ExternalAPI/m_LogService.h +++ b/plugins/ExternalAPI/m_LogService.h @@ -63,17 +63,17 @@ typedef struct { // returns 0 on success
#define MS_LOGSERVICE_REGISTER "LogService/Register"
-__inline static int logservice_register(char *szID, TCHAR *tszTitle, TCHAR *tszDefLogPath, TCHAR *tszDefFormat)
+__inline static INT_PTR logservice_register(char *szID, TCHAR *tszTitle, TCHAR *tszDefLogPath, TCHAR *tszDefFormat)
{
LS_REGINFO ri;
- ZeroMemory(&ri, sizeof(LS_REGINFO));
- ri.cbSize = sizeof(LS_REGINFO);
+ ZeroMemory(&ri, sizeof(LS_REGINFO));
+ ri.cbSize = sizeof(LS_REGINFO);
ri.szID = szID;
ri.tszTitle = tszTitle;
ri.tszDefLogPath = tszDefLogPath;
ri.tszDefFormat = tszDefFormat;
ri.Flags = LSRF_TCHAR;
- return CallService(MS_LOGSERVICE_REGISTER, (WPARAM)&ri, 0);
+ return CallService(MS_LOGSERVICE_REGISTER, (WPARAM)&ri, 0);
}
@@ -106,16 +106,16 @@ typedef struct { // returns 0 on success
#define MS_LOGSERVICE_LOG "LogService/Log"
-__inline static int logservice_log(char *szID, HANDLE hContact, TCHAR *tszMsg)
+__inline static INT_PTR logservice_log(char *szID, HANDLE hContact, TCHAR *tszMsg)
{
LS_MSGINFO mi;
- ZeroMemory(&mi, sizeof(LS_MSGINFO));
- mi.cbSize = sizeof(LS_MSGINFO);
+ ZeroMemory(&mi, sizeof(LS_MSGINFO));
+ mi.cbSize = sizeof(LS_MSGINFO);
mi.szID = szID;
mi.hContact = hContact;
mi.tszMsg = tszMsg;
mi.Flags = LSMF_TCHAR;
- return CallService(MS_LOGSERVICE_LOG, (WPARAM)&mi, 0);
+ return CallService(MS_LOGSERVICE_LOG, (WPARAM)&mi, 0);
}
diff --git a/plugins/FloatingContacts/main.cpp b/plugins/FloatingContacts/main.cpp index 62adc003d0..3abca83658 100644 --- a/plugins/FloatingContacts/main.cpp +++ b/plugins/FloatingContacts/main.cpp @@ -341,7 +341,7 @@ static int OnModulesLoded( WPARAM wParam, LPARAM lParam ) hevPrebuildMenu = HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu );
hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 );
- oldMirandaWndProc = (WNDPROC)SetWindowLong( hwndMiranda, GWL_WNDPROC, (LONG)newMirandaWndProc);
+ oldMirandaWndProc = (WNDPROC)SetWindowLong( hwndMiranda, GWLP_WNDPROC, (LONG)newMirandaWndProc);
diff --git a/plugins/ListeningTo/players/winamp_mlt/mlt_winamp.cpp b/plugins/ListeningTo/players/winamp_mlt/mlt_winamp.cpp index 5a38d39a19..e551fbcdea 100644 --- a/plugins/ListeningTo/players/winamp_mlt/mlt_winamp.cpp +++ b/plugins/ListeningTo/players/winamp_mlt/mlt_winamp.cpp @@ -442,10 +442,10 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar void quit()
{
if (oldMainWndProc != NULL)
- SetWindowLong(plugin.hwndParent, GWL_WNDPROC, (LONG) oldMainWndProc);
+ SetWindowLong(plugin.hwndParent, GWLP_WNDPROC, (LONG) oldMainWndProc);
if (oldWndProc != NULL)
- SetWindowLong(hPlWnd, GWL_WNDPROC, (LONG) oldWndProc);
+ SetWindowLong(hPlWnd, GWLP_WNDPROC, (LONG) oldWndProc);
if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
@@ -457,10 +457,10 @@ int init() {
KillTimer(hMsgWnd, 0);
- oldMainWndProc = (WNDPROC)SetWindowLong(plugin.hwndParent, GWL_WNDPROC, (LONG) MainWndProc);
+ oldMainWndProc = (WNDPROC)SetWindowLong(plugin.hwndParent, GWLP_WNDPROC, (LONG) MainWndProc);
hPlWnd = (HWND) SendMessage(plugin.hwndParent, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND);
- oldWndProc = (WNDPROC) SetWindowLong(hPlWnd, GWL_WNDPROC, (LONG)WndProc);
+ oldWndProc = (WNDPROC) SetWindowLong(hPlWnd, GWLP_WNDPROC, (LONG)WndProc);
return 0;
}
|