summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-01-02 19:40:35 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-01-02 19:40:35 +0000
commite185ce0df50fa161f5ea5c89fe0edfdbabb59185 (patch)
treea9dde200742c3edbee7d1be5e88335060372cbd6 /plugins
parent006238c7b97bd68b99667146f1b5df1f3661f470 (diff)
fixed version compare
warning level changed to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11726 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/PackUpdater/PackUpdater_12.vcxproj8
-rw-r--r--plugins/PackUpdater/Src/Common.h12
-rw-r--r--plugins/PackUpdater/Src/Events.cpp20
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp396
-rw-r--r--plugins/PackUpdater/Src/Notifications.h6
-rw-r--r--plugins/PackUpdater/Src/Options.cpp172
-rw-r--r--plugins/PackUpdater/Src/PackUpdater.cpp28
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp86
-rw-r--r--plugins/PackUpdater/Src/Version.h2
9 files changed, 362 insertions, 368 deletions
diff --git a/plugins/PackUpdater/PackUpdater_12.vcxproj b/plugins/PackUpdater/PackUpdater_12.vcxproj
index faaa451815..afe2fcfd7c 100644
--- a/plugins/PackUpdater/PackUpdater_12.vcxproj
+++ b/plugins/PackUpdater/PackUpdater_12.vcxproj
@@ -79,7 +79,7 @@
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -104,7 +104,7 @@
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Common.h</PrecompiledHeaderFile>
@@ -127,7 +127,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Common.h</PrecompiledHeaderFile>
@@ -155,7 +155,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Common.h</PrecompiledHeaderFile>
diff --git a/plugins/PackUpdater/Src/Common.h b/plugins/PackUpdater/Src/Common.h
index 71f9c1ab93..0c6eeafa2f 100644
--- a/plugins/PackUpdater/Src/Common.h
+++ b/plugins/PackUpdater/Src/Common.h
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
// Windows Header Files:
@@ -94,7 +94,7 @@ extern BYTE Reminder, UpdateOnStartup, UpdateOnPeriod, OnlyOnceADay, PeriodMeasu
extern TCHAR tszRoot[MAX_PATH], tszDialogMsg[2048];
extern FILEINFO* pFileInfo;
extern FILEURL* pFileUrl;
-extern HANDLE hCheckThread, hOnPreShutdown, hOptHook, hLoadHook;
+extern HANDLE hCheckThread;
extern MYOPTIONS MyOptions;
extern aPopups PopupsList[POPUPS];
extern LPCTSTR Title, Text;
@@ -106,8 +106,8 @@ BOOL NetlibInit();
VOID IcoLibInit();
VOID NetlibUnInit();
INT ModulesLoaded(WPARAM wParam, LPARAM lParam);
-INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam);
-INT_PTR EmptyFolder(WPARAM wParam,LPARAM lParam);
+INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam);
+INT_PTR EmptyFolder(WPARAM wParam, LPARAM lParam);
INT OnPreShutdown(WPARAM wParam, LPARAM lParam);
INT OptInit(WPARAM wParam, LPARAM lParam);
VOID DoCheck(INT iFlag);
diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp
index 8ee03c1e30..855c3d51cb 100644
--- a/plugins/PackUpdater/Src/Events.cpp
+++ b/plugins/PackUpdater/Src/Events.cpp
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
@@ -22,11 +22,10 @@ Boston, MA 02111-1307, USA.
HANDLE Timer;
BOOL Silent;
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+int ModulesLoaded(WPARAM, LPARAM)
{
- UnhookEvent(hLoadHook);
Silent = true;
- HOTKEYDESC hkd = {0};
+ HOTKEYDESC hkd = { 0 };
hkd.cbSize = sizeof(hkd);
hkd.dwFlags = HKD_TCHAR;
hkd.pszName = "Check for pack updates";
@@ -46,14 +45,14 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam)
+INT_PTR MenuCommand(WPARAM, LPARAM)
{
Silent = false;
DoCheck(TRUE);
return 0;
}
-INT_PTR EmptyFolder(WPARAM wParam,LPARAM lParam)
+INT_PTR EmptyFolder(WPARAM, LPARAM lParam)
{
SHFILEOPSTRUCT file_op = {
NULL,
@@ -71,12 +70,9 @@ INT_PTR EmptyFolder(WPARAM wParam,LPARAM lParam)
return 0;
}
-INT OnPreShutdown(WPARAM wParam, LPARAM lParam)
+INT OnPreShutdown(WPARAM, LPARAM)
{
CancelWaitableTimer(Timer);
CloseHandle(Timer);
-
- UnhookEvent(hOptHook);
- UnhookEvent(hOnPreShutdown);
return 0;
}
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index 7ce57a78ce..aff49ef640 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -148,10 +148,10 @@ VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType)
MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
}
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, APF_NEWDATA);
}
-INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
@@ -163,7 +163,7 @@ INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
return FALSE;
}
-INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM)
{
switch (uMsg) {
case WM_INITDIALOG:
@@ -176,9 +176,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
static void __stdcall CreateDownloadDialog(void*)
{
- if ( ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
- else if (db_get_b(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
+ else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_tstrncpy(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
@@ -195,7 +195,7 @@ void DlgDownloadProc()
if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
- if ( ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
@@ -211,11 +211,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
switch (message) {
case WM_INITDIALOG:
- TranslateDialogDefault( hDlg );
+ TranslateDialogDefault(hDlg);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
{
- LVCOLUMN lvc = {0};
+ LVCOLUMN lvc = { 0 };
// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text, and
// subitem members of the structure are valid.
@@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
//bool one_enabled = false;
ListView_DeleteAllItems(hwndList);
- LVITEM lvI = {0};
+ LVITEM lvI = { 0 };
// Some code to create the list-view control.
// Initialize LVITEM members that are common to all
@@ -274,18 +274,18 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
EnableWindow(hwOk, true/*one_enabled ? TRUE : FALSE*/);
// do this after filling list - enables 'ITEMCHANGED' below
SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
- Utils_RestoreWindowPositionNoSize(hDlg,0,MODNAME,"ConfirmWindow");
+ Utils_RestoreWindowPositionNoSize(hDlg, 0, MODNAME, "ConfirmWindow");
}
return TRUE;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->hwndFrom == hwndList) {
- switch (((LPNMHDR) lParam)->code) {
+ if (((LPNMHDR)lParam)->hwndFrom == hwndList) {
+ switch (((LPNMHDR)lParam)->code) {
case LVN_ITEMCHANGED:
if (GetWindowLongPtr(hDlg, GWLP_USERDATA)) {
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- LVITEM lvI = {0};
+ LVITEM lvI = { 0 };
lvI.iItem = nmlv->iItem;
lvI.iSubItem = 0;
@@ -297,8 +297,8 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
todo[lvI.iItem].enabled = ListView_GetCheckState(hwndList, nmlv->iItem);
bool enableOk = false;
- for(int i=0; i<(int)todo.size(); ++i) {
- if(todo[i].enabled) {
+ for (int i = 0; i < (int)todo.size(); ++i) {
+ if (todo[i].enabled) {
enableOk = true;
break;
}
@@ -320,205 +320,205 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
break;
case WM_COMMAND:
- if (HIWORD( wParam ) == BN_CLICKED) {
- switch(LOWORD(wParam)) {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
case IDOK:
- {
- vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ShowWindow(hDlg, SW_HIDE);
- TCHAR tszBuff[2048] = {0}, tszFileDest[MAX_PATH] = {0}, tszFilePathDest[MAX_PATH] = {0}, tszFilePathBack[MAX_PATH] = {0}, tszFileName[MAX_PATH] = {0};
- TCHAR* tszExt = NULL;
- char szKey[64] = {0};
- vector<int> arFileType;
- vector<tString> arFilePath;
- vector<tString> arFileName;
- vector<tString> arAdvFolder;
- vector<tString> arExt;
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
-
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
-
- arFileType.clear();
- arFilePath.clear();
- arFileName.clear();
- arAdvFolder.clear();
- arExt.clear();
- for(int i=0; i<(int)todo.size(); ++i) {
- if(todo[i].enabled) {
- switch (todo[i].FileType) {
+ {
+ vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ShowWindow(hDlg, SW_HIDE);
+ TCHAR tszBuff[2048] = { 0 }, tszFileDest[MAX_PATH] = { 0 }, tszFilePathDest[MAX_PATH] = { 0 }, tszFilePathBack[MAX_PATH] = { 0 }, tszFileName[MAX_PATH] = { 0 };
+ TCHAR* tszExt = NULL;
+ char szKey[64] = { 0 };
+ vector<int> arFileType;
+ vector<tString> arFilePath;
+ vector<tString> arFileName;
+ vector<tString> arAdvFolder;
+ vector<tString> arExt;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+
+ arFileType.clear();
+ arFilePath.clear();
+ arFileName.clear();
+ arAdvFolder.clear();
+ arExt.clear();
+ for (int i = 0; i < (int)todo.size(); ++i) {
+ if (todo[i].enabled) {
+ switch (todo[i].FileType) {
+ case 1:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 2:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 3:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 4:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 5:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ default:
+ mir_tstrncpy(tszFileDest, tszRoot, SIZEOF(tszFileDest));
+ break;
+ }
+ mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
+ CreateDirectory(tszBuff, NULL);
+ mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
+ mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
+ UpdatesCount++;
+
+ tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5];
+ if (mir_tstrcmp(tszExt, _T(".html")) == 0) {
+ char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl);
+ mir_free(szUrl);
+ }
+ else {
+ // download update
+ pFileUrl = &todo[i].File;
+ Title = TranslateT("Pack Updater");
+ if (todo[i].FileType == 1)
+ Text = TranslateT("Downloading pack updates...");
+ else
+ Text = TranslateT("Downloading update...");
+ DlgDownloadProc();
+ if (!DlgDld) {
+ if (UpdatesCount)
+ UpdatesCount--;
+ continue;
+ }
+ }
+ mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
+ mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
+ db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
+ arFileType.push_back(todo[i].FileType);
+ arFilePath.push_back(todo[i].File.tszDiskPath);
+ arFileName.push_back(tszFileName);
+ arAdvFolder.push_back(todo[i].tszAdvFolder);
+ arExt.push_back(tszExt);
+ if (todo[i].FileType == 1)
+ i = (int)todo.size();
+ }
+ }
+
+ if (UpdatesCount > 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
+ mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ else if (UpdatesCount == 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
+ mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ if (UpdatesCount > 0 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
+ INT rc = -1;
+ Title = TranslateT("Pack Updater");
+ Text = tszBuff;
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
+ rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
+ else
+ rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
+ if (rc == IDYES) {
+ for (int i = 0; i < UpdatesCount; i++) {
+ TCHAR* tszUtilRootPlug = NULL;
+ TCHAR* tszUtilRootIco = NULL;
+ TCHAR* tszUtilRoot = NULL;
+ TCHAR tszCurrentDir[MAX_PATH];
+
+ switch (arFileType[i]) {
+ case 0:
+ break;
case 1:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ if (Reminder == 2)
+ db_set_b(NULL, MODNAME, "Reminder", 1);
+ memset(&si, 0, sizeof(STARTUPINFO));
+ memset(&pi, 0, sizeof(PROCESS_INFORMATION));
+ si.cb = sizeof(STARTUPINFO);
+ {
+ _tcsncpy_s(tszCurrentDir, arFilePath[i].c_str(), _TRUNCATE);
+ TCHAR *p = _tcsrchr(tszCurrentDir, '\\');
+ if (p) *p = 0;
+ }
+ CreateProcess(arFilePath[i].c_str(), _T(""), NULL, NULL, FALSE, NULL, NULL, tszCurrentDir, &si, &pi);
+ i = UpdatesCount;
+ CallFunctionAsync(ExitMe, 0);
break;
case 2:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins"));
+ if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
+ else
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRootPlug);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
break;
case 3:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons"));
+ if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
+ else
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRootIco);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
break;
case 4:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
+ tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ else
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRoot);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
break;
case 5:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- default:
- mir_tstrncpy(tszFileDest, tszRoot, SIZEOF(tszFileDest));
- break;
- }
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
- CreateDirectory(tszBuff, NULL);
- mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
- mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
- UpdatesCount++;
-
- tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL)-5];
- if (mir_tstrcmp(tszExt, _T(".html")) == 0) {
- char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl);
- mir_free(szUrl);
- }
- else {
- // download update
- pFileUrl = &todo[i].File;
- Title = TranslateT("Pack Updater");
- if (todo[i].FileType == 1)
- Text = TranslateT("Downloading pack updates...");
+ tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
else
- Text = TranslateT("Downloading update...");
- DlgDownloadProc();
- if (!DlgDld) {
- if (UpdatesCount)
- UpdatesCount--;
- continue;
- }
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRoot);
+ break;
}
- mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
- db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
- arFileType.push_back(todo[i].FileType);
- arFilePath.push_back(todo[i].File.tszDiskPath);
- arFileName.push_back(tszFileName);
- arAdvFolder.push_back(todo[i].tszAdvFolder);
- arExt.push_back(tszExt);
- if (todo[i].FileType == 1)
- i = (int)todo.size();
}
}
-
- if (UpdatesCount > 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
- else if (UpdatesCount == 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
- if (UpdatesCount > 0 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
- INT rc = -1;
+ else { //reminder for not installed pack update
+ if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
+ db_set_b(NULL, MODNAME, "Reminder", 2);
+ mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
- rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
- else
- rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
- if (rc == IDYES) {
- for (int i = 0; i < UpdatesCount; i++) {
- TCHAR* tszUtilRootPlug = NULL;
- TCHAR* tszUtilRootIco = NULL;
- TCHAR* tszUtilRoot = NULL;
- TCHAR tszCurrentDir[MAX_PATH];
-
- switch (arFileType[i]) {
- case 0:
- break;
- case 1:
- if (Reminder == 2)
- db_set_b(NULL, MODNAME, "Reminder", 1);
- memset(&si, 0, sizeof(STARTUPINFO));
- memset(&pi, 0, sizeof(PROCESS_INFORMATION));
- si.cb = sizeof(STARTUPINFO);
- {
- _tcsncpy_s(tszCurrentDir, arFilePath[i].c_str(), _TRUNCATE);
- TCHAR *p = _tcsrchr(tszCurrentDir, '\\');
- if (p) *p = 0;
- }
- CreateProcess(arFilePath[i].c_str(), _T(""), NULL, NULL, FALSE, NULL, NULL, tszCurrentDir, &si, &pi);
- i = UpdatesCount;
- CallFunctionAsync(ExitMe, 0);
- break;
- case 2:
- tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins"));
- if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRootPlug);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 3:
- tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons"));
- if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRootIco);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 4:
- tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
- if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRoot);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 5:
- tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
- if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRoot);
- break;
- }
- }
- }
- else { //reminder for not installed pack update
- if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- db_set_b(NULL, MODNAME, "Reminder", 2);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
- Title = TranslateT("Pack Updater");
- Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
- Number = 2;
- show_popup(0, Title, Text, Number, 0);
- }
- else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ Number = 2;
+ show_popup(0, Title, Text, Number, 0);
}
+ else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
}
- EndDialog(hDlg, IDOK);
- return TRUE;
+ }
+ EndDialog(hDlg, IDOK);
+ return TRUE;
case IDCANCEL:
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
@@ -539,7 +539,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
return FALSE;
}
-INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM)
{
switch (uMsg) {
case WM_INITDIALOG:
diff --git a/plugins/PackUpdater/Src/Notifications.h b/plugins/PackUpdater/Src/Notifications.h
index 17f896c003..a0467e6dbb 100644
--- a/plugins/PackUpdater/Src/Notifications.h
+++ b/plugins/PackUpdater/Src/Notifications.h
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#define POPUPS 4
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index a061a518d8..a8bb9049a9 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
@@ -55,7 +55,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure);
CheckDlgButton(hwndDlg, IDC_REMINDER, Reminder ? BST_CHECKED : BST_UNCHECKED);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE);
@@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i+1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
}
return TRUE;
@@ -82,14 +82,14 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_UPDATEONPERIOD:
- {
- BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ {
+ BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
@@ -101,13 +101,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_LINK_HOTKEY:
- {
- OPENOPTIONSDIALOG ood = { sizeof(ood) };
- ood.pszGroup = "Customize";
- ood.pszPage = "Hotkeys";
- Options_Open(&ood);
- }
- return true;
+ {
+ OPENOPTIONSDIALOG ood = { sizeof(ood) };
+ ood.pszGroup = "Customize";
+ ood.pszPage = "Hotkeys";
+ Options_Open(&ood);
+ }
+ return true;
case IDC_MSG_BOXES2:
case IDC_ERRORS2:
@@ -120,50 +120,50 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case WM_NOTIFY:
- {
- NMHDR *hdr = (NMHDR *)lParam;
- if(hdr && hdr->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ {
+ NMHDR *hdr = (NMHDR *)lParam;
+ if (hdr && hdr->code == UDN_DELTAPOS)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if (hdr && hdr->code == PSN_APPLY) {
- UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
- OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);
+ if (hdr && hdr->code == PSN_APPLY) {
+ UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
+ OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);
- UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
+ UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
- char buffer[3] = {0};
- Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
- Period = atoi(buffer);
+ char buffer[3] = { 0 };
+ Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
+ Period = atoi(buffer);
- PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));
+ PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));
- InitTimer();
+ InitTimer();
- db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
- db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
- db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
- db_set_dw(NULL, MODNAME, "Period", Period);
- db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
- Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- db_set_b(NULL, MODNAME, "Reminder", Reminder);
- if ( !ServiceExists(MS_POPUP_ADDPOPUPT)) {
- for (int i = 1; i < POPUPS; i++) {
- mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
- }
+ db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
+ db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
+ db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
+ db_set_dw(NULL, MODNAME, "Period", Period);
+ db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
+ Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
+ db_set_b(NULL, MODNAME, "Reminder", Reminder);
+ if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ for (int i = 1; i < POPUPS; i++) {
+ mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
}
}
- break;
}
+ break;
+ }
}
return FALSE;
}
-INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int i;
WORD idCtrl;
- char str[20] = {0}, str2[20] = {0};
+ char str[20] = { 0 }, str2[20] = { 0 };
switch (msg) {
case WM_INITDIALOG:
@@ -185,14 +185,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_UNCHECKED);
}
for (i = 0; i < POPUPS; i++) {
- SendDlgItemMessage(hdlg, (i+42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
- SendDlgItemMessage(hdlg, (i+41071), CPM_SETCOLOUR, 0, PopupsList[i].colorText);
- EnableWindow(GetDlgItem(hdlg, (i+42071)), (MyOptions.DefColors == byCOLOR_OWN));
- EnableWindow(GetDlgItem(hdlg, (i+41071)), (MyOptions.DefColors == byCOLOR_OWN));
+ SendDlgItemMessage(hdlg, (i + 42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
+ SendDlgItemMessage(hdlg, (i + 41071), CPM_SETCOLOUR, 0, PopupsList[i].colorText);
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), (MyOptions.DefColors == byCOLOR_OWN));
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), (MyOptions.DefColors == byCOLOR_OWN));
}
//Timeout
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 4, 0);
- SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
+ SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, MyOptions.Timeout, TRUE);
//Mouse actions
for (i = 0; i < SIZEOF(PopupActions); i++) {
@@ -205,14 +205,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- CheckDlgButton(hdlg, (i+1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- if (IsDlgButtonChecked(hdlg, (i+40071)))
- EnableWindow(GetDlgItem(hdlg, (i+1024)), FALSE);
+ CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ if (IsDlgButtonChecked(hdlg, (i + 40071)))
+ EnableWindow(GetDlgItem(hdlg, (i + 1024)), FALSE);
else if (i > 0)
- EnableWindow(GetDlgItem(hdlg, (i+1024)), TRUE);
+ EnableWindow(GetDlgItem(hdlg, (i + 1024)), TRUE);
}
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -220,7 +220,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_SHOWWINDOW:
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -229,48 +229,48 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
idCtrl = LOWORD(wParam);
if (HIWORD(wParam) == CPN_COLOURCHANGED) {
- if(idCtrl > 40070) {
+ if (idCtrl > 40070) {
//It's a color picker change. idCtrl is the control id.
COLORREF color = SendDlgItemMessage(hdlg, idCtrl, CPM_GETCOLOUR, 0, 0);
int ctlID = idCtrl;
if ((ctlID > 41070) && (ctlID < 42070)) //It's 41071 or above => Text color.
- PopupsList[ctlID-41071].colorText = color;
+ PopupsList[ctlID - 41071].colorText = color;
else if (ctlID > 42070)//Background color.
- PopupsList[ctlID-42071].colorBack = color;
+ PopupsList[ctlID - 42071].colorBack = color;
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
}
- if (HIWORD(wParam) == CBN_SELCHANGE) {
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
if (idCtrl == IDC_LC)
MyOptions.LeftClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_LC, CB_GETCURSEL, 0, 0);
- else if(idCtrl == IDC_RC)
+ else if (idCtrl == IDC_RC)
MyOptions.RightClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_RC, CB_GETCURSEL, 0, 0);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
- switch(idCtrl) {
- case IDC_USEOWNCOLORS:
+ switch (idCtrl) {
+ case IDC_USEOWNCOLORS:
if (HIWORD(wParam) == BN_CLICKED) {
MyOptions.DefColors = byCOLOR_OWN;
BOOL bEnableOthers = TRUE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
break;
- case IDC_USEWINCOLORS:
+ case IDC_USEWINCOLORS:
if (HIWORD(wParam) == BN_CLICKED) {
//Use Windows colors
MyOptions.DefColors = byCOLOR_WINDOWS;
BOOL bEnableOthers = FALSE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
@@ -282,18 +282,18 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
MyOptions.DefColors = byCOLOR_POPUP;
BOOL bEnableOthers = FALSE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
break;
- case IDC_PREVIEW:
+ case IDC_PREVIEW:
Title = TranslateT("Pack Updater");
Text = TranslateT("Test");
for (int i = 0; i < POPUPS; i++) {
- if ((BST_UNCHECKED == IsDlgButtonChecked(hdlg, (i+40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i+40071)))))
+ if ((BST_UNCHECKED == IsDlgButtonChecked(hdlg, (i + 40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i + 40071)))))
continue;
show_popup(0, Title, Text, i, 0);
}
@@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
- case WM_NOTIFY:
+ case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
//Restore the options stored in memory.
@@ -346,16 +346,16 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
InitPopupList();
return TRUE;
- case PSN_APPLY:
+ case PSN_APPLY:
//Text color
- char szSetting[20] = {0};
+ char szSetting[20] = { 0 };
DWORD ctlColor = 0;
- for (i = 0; i <= POPUPS-1; i++) {
- ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
+ for (i = 0; i <= POPUPS - 1; i++) {
+ ctlColor = SendDlgItemMessage(hdlg, (i + 42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iBg", i);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
- ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
+ ctlColor = SendDlgItemMessage(hdlg, (i + 41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iTx", i);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
@@ -372,9 +372,9 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
+ db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
}
@@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
-int OptInit(WPARAM wParam, LPARAM lParam)
+int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
@@ -395,7 +395,7 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.pfnDlgProc = UpdateNotifyOptsProc;
Options_AddPage(wParam, &odp);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.ptszGroup = LPGENT("Popups");
odp.ptszTitle = LPGENT("Pack Updater");
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp
index e6390a3e82..e277a80ca4 100644
--- a/plugins/PackUpdater/Src/PackUpdater.cpp
+++ b/plugins/PackUpdater/Src/PackUpdater.cpp
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,15 +14,15 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
HINSTANCE hInst = NULL;
-HANDLE hOptHook = NULL, hLoadHook = NULL, hPackUpdaterFolder = NULL, hCheckUpdates = NULL, hEmptyFolder = NULL, hOnPreShutdown = NULL;
-TCHAR tszRoot[MAX_PATH] = {0};
+HANDLE hPackUpdaterFolder = NULL;
+TCHAR tszRoot[MAX_PATH] = { 0 };
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -36,16 +36,16 @@ PLUGININFOEX pluginInfoEx = {
__AUTHORWEB,
UNICODE_AWARE,
//{29517BE5-779A-48e5-8950-CB4DE1D43172}
- {0x29517be5, 0x779a, 0x48e5, {0x89, 0x50, 0xcb, 0x4d, 0xe1, 0xd4, 0x31, 0x72}}
+ { 0x29517be5, 0x779a, 0x48e5, { 0x89, 0x50, 0xcb, 0x4d, 0xe1, 0xd4, 0x31, 0x72 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
@@ -68,7 +68,7 @@ extern "C" __declspec(dllexport) int Load(void)
IcoLibInit();
// Add cheking update menu item
- hCheckUpdates = CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand);
+ CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -0x7FFFFFFF;
@@ -78,7 +78,7 @@ extern "C" __declspec(dllexport) int Load(void)
mi.pszService = MODNAME"/CheckUpdates";
Menu_AddMainMenuItem(&mi);
// Add empty updates folder menu item
- hEmptyFolder = CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder);
+ CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder);
memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = -0x7FFFFFFF;
@@ -89,9 +89,9 @@ extern "C" __declspec(dllexport) int Load(void)
Menu_AddMainMenuItem(&mi);
// Add options hook
- hOptHook = HookEvent(ME_OPT_INITIALISE, OptInit);
- hLoadHook = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- hOnPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
return 0;
}
@@ -101,7 +101,5 @@ extern "C" __declspec(dllexport) int Unload(void)
if (hCheckThread)
hCheckThread = NULL;
NetlibUnInit();
- DestroyServiceFunction(hCheckUpdates);
- DestroyServiceFunction(hEmptyFolder);
return 0;
} \ No newline at end of file
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index edb28607d1..84e24d3f2e 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2010 Mataes
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -25,20 +25,20 @@ INT FileCount = 0, CurrentFile = 0, Number = 0;
BYTE Reminder, AutoUpdate;
BYTE UpdateOnStartup, UpdateOnPeriod, OnlyOnceADay, PeriodMeasure;
INT Period;
-TCHAR tszDialogMsg[2048] = {0};
+TCHAR tszDialogMsg[2048] = { 0 };
FILEINFO* pFileInfo = NULL;
FILEURL* pFileUrl = NULL;
HANDLE hCheckThread = NULL, hNetlibUser = NULL;
-MYOPTIONS MyOptions = {0};
+MYOPTIONS MyOptions = { 0 };
aPopups PopupsList[POPUPS];
-LPCTSTR Title = {0}, Text = {0};
+LPCTSTR Title = { 0 }, Text = { 0 };
IconItem iconList[] =
{
- { LPGEN("Check for pack updates"), "check_update", IDI_MENU },
+ { LPGEN("Check for pack updates"), "check_update", IDI_MENU },
{ LPGEN("Clear pack updates folder"), "empty_folder", IDI_DELETE },
- { LPGEN("'Yes' Button"), "btn_ok", IDI_OK },
- { LPGEN("'No' Button"), "btn_cancel", IDI_CANCEL }
+ { LPGEN("'Yes' Button"), "btn_ok", IDI_OK },
+ { LPGEN("'No' Button"), "btn_cancel", IDI_CANCEL }
};
VOID IcoLibInit()
@@ -48,7 +48,7 @@ VOID IcoLibInit()
BOOL NetlibInit()
{
- NETLIBUSER nlu = {0};
+ NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
nlu.ptszDescriptiveName = TranslateT("Pack Updater HTTP connection");
@@ -94,7 +94,7 @@ VOID InitPopupList()
VOID LoadOptions()
{
MyOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- MyOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ MyOptions.LeftClickAction = db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
MyOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
MyOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
UpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
@@ -111,26 +111,26 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
HANDLE hFile = NULL;
DWORD dwBytes;
- NETLIBHTTPREQUEST nlhr = {0};
+ NETLIBHTTPREQUEST nlhr = { 0 };
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_REDIRECT | NLHRF_DUMPASTEXT | NLHRF_HTTP11;
char* szUrl = mir_t2a(tszURL);
nlhr.szUrl = szUrl;
nlhr.headersCount = 4;
- nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
- nlhr.headers[0].szName = "User-Agent";
+ nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
+ nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
- nlhr.headers[1].szName = "Connection";
+ nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
- nlhr.headers[2].szName = "Cache-Control";
+ nlhr.headers[2].szName = "Cache-Control";
nlhr.headers[2].szValue = "no-cache";
- nlhr.headers[3].szName = "Pragma";
+ nlhr.headers[3].szName = "Pragma";
nlhr.headers[3].szValue = "no-cache";
bool ret = false;
NETLIBHTTPREQUEST* pReply = NULL;
- pReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser,(LPARAM)&nlhr);
+ pReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr);
if (pReply) {
if (200 == pReply->resultCode && pReply->dataLength > 0) {
@@ -138,7 +138,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL);
ret = true;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)pReply);
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply);
}
mir_free(szUrl);
@@ -173,19 +173,19 @@ BOOL IsPluginDisabled(TCHAR* filename)
return res;
}
-INT getVer(const TCHAR* verStr)
+size_t getVer(const TCHAR* verStr)
{
- INT v1 = 0, v2 = 0, v3 = 0, v4 = 0;
+ size_t v1 = 0, v2 = 0, v3 = 0, v4 = 0;
_stscanf(verStr, _T("%d.%d.%d.%d"), &v1, &v2, &v3, &v4);
- return v1*10000000 + v2*100000 + v3*1000 + v4;
+ return v1 * 10000000 + v2 * 100000 + v3 * 1000 + v4;
}
static void CheckUpdates(void *)
{
- TCHAR tszBuff[2048] = {0}, tszFileInfo[30] = {0}, tszTmpIni[MAX_PATH] = {0};
- char szKey[64] = {0};
- INT upd_ret;
- DBVARIANT dbVar = {0};
+ TCHAR tszBuff[2048] = { 0 }, tszFileInfo[30] = { 0 }, tszTmpIni[MAX_PATH] = { 0 };
+ char szKey[64] = { 0 };
+ INT upd_ret = 0;
+ DBVARIANT dbVar = { 0 };
vector<FILEINFO> UpdateFiles;
if (!Exists(tszRoot))
@@ -197,7 +197,7 @@ static void CheckUpdates(void *)
// Load files info
db_get_ts(NULL, MODNAME, "File_VersionURL", &dbVar);
if (mir_tstrcmp(dbVar.ptszVal, NULL) == 0) { // URL is not set
- Title=TranslateT("Pack Updater");
+ Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
@@ -225,7 +225,7 @@ static void CheckUpdates(void *)
}
for (CurrentFile = 0; CurrentFile < FileCount; CurrentFile++) {
- FILEINFO FileInfo = {_T(""), _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), {_T(""), _T("")}};
+ FILEINFO FileInfo = { _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), { _T(""), _T("") } };
dbVar.ptszVal = NULL;
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
@@ -259,7 +259,7 @@ static void CheckUpdates(void *)
if (_tcsstr(tszBuff, _T("\\"))) { //check update name
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if ( ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
@@ -271,7 +271,7 @@ static void CheckUpdates(void *)
GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, SIZEOF(Files[CurrentFile].tszInfoURL), tszTmpIni);
Files[CurrentFile].FileType = GetPrivateProfileInt(tszFileInfo, _T("FileType"), 0, tszTmpIni);
Files[CurrentFile].Force = GetPrivateProfileInt(tszFileInfo, _T("Force"), 0, tszTmpIni);
- Files[CurrentFile].FileNum = CurrentFile+1;
+ Files[CurrentFile].FileNum = CurrentFile + 1;
if (Files[CurrentFile].FileType == 2) {
TCHAR pluginFolgerName[MAX_PATH];
@@ -296,7 +296,7 @@ static void CheckUpdates(void *)
} // user have not admin's rights
//добавить проверку на существование файла
- TCHAR tszFilePathDest[MAX_PATH] = {0};
+ TCHAR tszFilePathDest[MAX_PATH] = { 0 };
TCHAR* tszUtilRootPlug = NULL;
TCHAR* tszUtilRootIco = NULL;
TCHAR* tszUtilRoot = NULL;
@@ -345,18 +345,18 @@ static void CheckUpdates(void *)
} //end checking all files in for ()
// Show dialog
- if (UpdateFiles.size()>0)
+ if (UpdateFiles.size() > 0)
upd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)&UpdateFiles);
DeleteFile(tszTmpIni);
if (upd_ret == IDCANCEL) {
hCheckThread = NULL;
return;
}
-
+
if (!UpdatesCount && !Silent) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
@@ -367,7 +367,7 @@ static void CheckUpdates(void *)
if (!FileCount) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
@@ -382,7 +382,7 @@ void DoCheck(int iFlag)
if (hCheckThread != NULL) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if ( ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(0, Title, Text, Number, 0);
}
@@ -397,11 +397,11 @@ void DoCheck(int iFlag)
BOOL AllowUpdateOnStartup()
{
- if(OnlyOnceADay) {
+ if (OnlyOnceADay) {
time_t now = time(NULL);
time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
- if((now - was) < 86400)
+ if ((now - was) < 86400)
return FALSE;
}
return TRUE;
@@ -410,7 +410,7 @@ BOOL AllowUpdateOnStartup()
LONG PeriodToMilliseconds(const INT period, BYTE& periodMeasure)
{
LONG result = period * 1000;
- switch(periodMeasure) {
+ switch (periodMeasure) {
case 1:
// day
result *= 60 * 60 * 24;
@@ -418,7 +418,7 @@ LONG PeriodToMilliseconds(const INT period, BYTE& periodMeasure)
default:
// hour
- if(periodMeasure != 0)
+ if (periodMeasure != 0)
periodMeasure = 0;
result *= 60 * 60;
break;
@@ -426,7 +426,7 @@ LONG PeriodToMilliseconds(const INT period, BYTE& periodMeasure)
return result;
}
-VOID CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
+VOID CALLBACK TimerAPCProc(LPVOID, DWORD, DWORD)
{
DoCheck(TRUE);
}
@@ -434,14 +434,14 @@ VOID CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHig
VOID InitTimer()
{
CancelWaitableTimer(Timer);
- if(UpdateOnPeriod) {
+ if (UpdateOnPeriod) {
LONG interval = PeriodToMilliseconds(Period, PeriodMeasure);
_int64 qwDueTime = -10000i64 * interval;
- LARGE_INTEGER li = {0};
- li.LowPart = (DWORD) ( qwDueTime & 0xFFFFFFFF );
- li.HighPart = (LONG) ( qwDueTime >> 32 );
+ LARGE_INTEGER li = { 0 };
+ li.LowPart = (DWORD)(qwDueTime & 0xFFFFFFFF);
+ li.HighPart = (LONG)(qwDueTime >> 32);
SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0);
}
diff --git a/plugins/PackUpdater/Src/Version.h b/plugins/PackUpdater/Src/Version.h
index c0786a36b2..2c29b8df7d 100644
--- a/plugins/PackUpdater/Src/Version.h
+++ b/plugins/PackUpdater/Src/Version.h
@@ -11,4 +11,4 @@
#define __AUTHOR "Mataes, ZERO_BiT"
#define __AUTHOREMAIL "mataes2007@gmail.com, zero-bit@mail.ru"
#define __AUTHORWEB "http://miranda-ng.org/p/PackUpdater/"
-#define __COPYRIGHT "© 2011 Mataes, 2007 ZERO_BiT"
+#define __COPYRIGHT "© 2011-2015 Mataes, 2007 ZERO_BiT"