summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-06-22 21:49:33 +0000
committerRobert Pösel <robyer@seznam.cz>2013-06-22 21:49:33 +0000
commitd5461e60cced301b7251e525f02b89c15198bbcc (patch)
tree62b19bd0fb6e1e7da693fb19c4d811a418c0ebf5 /plugins/PluginUpdater/src
parent588be356cf29887a02e12dd9e5a1d50bd58a1b3e (diff)
PluginUpdater:
- Don't notify unchecked files as updates when auto update check - Added new files source - development version with debug symbola - Some small improvements - Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@5089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/Common.h7
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp25
-rw-r--r--plugins/PluginUpdater/src/Options.cpp13
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp8
-rw-r--r--plugins/PluginUpdater/src/Version.h2
-rw-r--r--plugins/PluginUpdater/src/resource.h5
6 files changed, 42 insertions, 18 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index 5628960b8c..9673cb8226 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -92,7 +92,7 @@ struct PopupDataText
struct PlugOptions
{
- BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bUpdateIcons;
+ BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bUpdateIcons, bForceRedownload;
BOOL bSilent, bDlgDld;
BYTE bPeriodMeasure;
@@ -106,8 +106,9 @@ struct PlugOptions
#define DEFAULT_PERIOD 1
#define DEFAULT_PERIODMEASURE 1
-#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%"
-#define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x%platform%"
+#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%"
+#define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x%platform%"
+#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS "http://miranda-ng.now.im/pdb_x%platform%/"
#define IDINFO 3
#define IDDOWNLOAD 4
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 9c957d0f90..a82d8d368f 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -139,6 +139,9 @@ LBL_Exit:
db_set_ts(NULL, "CList", "TitleText", _T("Miranda NG"));
#endif
+ opts.bForceRedownload = false;
+ db_unset(NULL, MODNAME, "ForceRedownload");
+
db_set_b(NULL, MODNAME, "RestartCount", 2);
CallFunctionAsync(RestartMe, 0);
goto LBL_Exit;
@@ -414,11 +417,13 @@ static bool isValidExtension(const TCHAR *ptszFileName)
return false;
}
-static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles)
+static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles)
{
+ int count = 0;
+
// skip updater's own folder
if ( !_tcsicmp(tszFolder, tszRoot))
- return;
+ return count;
TCHAR tszBuf[MAX_PATH];
mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s\\*"), tszFolder);
@@ -426,7 +431,7 @@ static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, cons
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszBuf, &ffd);
if (hFind == INVALID_HANDLE_VALUE)
- return;
+ return count;
do {
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -439,7 +444,7 @@ static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, cons
mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s\\%s"), tszFolder, ffd.cFileName);
if (0 != _tcsicmp(tszBuf, tszProfilePath))
- ScanFolder(tszBuf, cbBaseLen, level+1, tszBaseUrl, hashes, UpdateFiles);
+ count += ScanFolder(tszBuf, cbBaseLen, level+1, tszBaseUrl, hashes, UpdateFiles);
continue;
}
@@ -483,7 +488,7 @@ static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, cons
CalculateModuleHash(tszBuf, szMyHash);
MyCRC = item->m_crc;
- bHasNewVersion = strcmp(szMyHash, item->m_szHash) != 0;
+ bHasNewVersion = opts.bForceRedownload ? true : strcmp(szMyHash, item->m_szHash) != 0;
}
else { // file was marked for deletion, add it to the list anyway
bHasNewVersion = true;
@@ -517,11 +522,15 @@ static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, cons
FileInfo->File.CRCsum = MyCRC;
UpdateFiles->insert(FileInfo);
+
+ if (!opts.bSilent || db_get_b(NULL, MODNAME "Files", StrToLower(_T2A(FileInfo->tszNewName)), true))
+ count++;
} // end compare versions
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
+ return count;
}
static void CheckUpdates(void *)
@@ -536,13 +545,13 @@ static void CheckUpdates(void *)
ptrT updateUrl( GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
- if ( ParseHashes(updateUrl, baseUrl, hashes)) {
+ if (ParseHashes(updateUrl, baseUrl, hashes)) {
FILELIST *UpdateFiles = new FILELIST(20);
VARST dirname( _T("%miranda_path%"));
- ScanFolder(dirname, lstrlen(dirname)+1, 0, baseUrl, hashes, UpdateFiles);
+ int count = ScanFolder(dirname, lstrlen(dirname)+1, 0, baseUrl, hashes, UpdateFiles);
// Show dialog
- if (UpdateFiles->getCount() == 0) {
+ if (count == 0) {
if ( !opts.bSilent)
ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("No updates found."), 2, 0);
delete UpdateFiles;
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 9f4d228139..56f3643ac1 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -70,6 +70,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
else if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL_TRUNK))
CheckDlgButton(hwndDlg, IDC_TRUNK, TRUE);
+ else if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS))
+ CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, TRUE);
else {
CheckDlgButton(hwndDlg, IDC_CUSTOM, TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
@@ -99,6 +101,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
break;
+ case IDC_TRUNK_SYMBOLS:
case IDC_TRUNK:
case IDC_STABLE:
case IDC_CUSTOM:
@@ -159,7 +162,15 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK))
db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK);
- else {
+ else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
+ ptrA oldUrl = db_get_sa(NULL, MODNAME, "UpdateURL");
+ if (strcmp(oldUrl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS)) {
+ opts.bForceRedownload = true;
+ db_set_b(NULL, MODNAME, "ForceRedownload", 1);
+ }
+
+ db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK_SYMBOLS);
+ } else {
char szUrl[100];
GetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, szUrl, SIZEOF(szUrl));
db_set_s(NULL, MODNAME, "UpdateURL", szUrl);
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 0de79f2b10..040dc72319 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -122,6 +122,7 @@ void LoadOptions()
opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
opts.bUpdateIcons = db_get_b(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
+ opts.bForceRedownload = db_get_b(NULL, MODNAME, "ForceRedownload", 0);
}
ULONG crc32_table[256];
@@ -209,7 +210,8 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT& baseUrl, SERVLIST& arHashes)
baseUrl = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)ptszUrl, (LPARAM)&dat);
// Download version info
- ShowPopup(NULL, TranslateT("Plugin Updater"), TranslateT("Downloading version info..."), 4, 0);
+ if (!opts.bSilent)
+ ShowPopup(NULL, TranslateT("Plugin Updater"), TranslateT("Checking new updates..."), 4, 0);
FILEURL pFileUrl;
mir_sntprintf(pFileUrl.tszDownloadURL, SIZEOF(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), baseUrl);
@@ -219,8 +221,8 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT& baseUrl, SERVLIST& arHashes)
BOOL ret = DownloadFile(pFileUrl.tszDownloadURL, pFileUrl.tszDiskPath, 0, nlc);
Netlib_CloseHandle(nlc);
- if (!ret) {
- ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("An error occured while downloading the update."), 1, 0);
+ if (!ret && !opts.bSilent) {
+ ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("An error occured while checking new updates."), 1, 0);
return false;
}
diff --git a/plugins/PluginUpdater/src/Version.h b/plugins/PluginUpdater/src/Version.h
index f6ed8685b4..c32af45d56 100644
--- a/plugins/PluginUpdater/src/Version.h
+++ b/plugins/PluginUpdater/src/Version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h
index df0fb846fe..20466bdc0c 100644
--- a/plugins/PluginUpdater/src/resource.h
+++ b/plugins/PluginUpdater/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by e:\Projects\C++\MirandaNG\plugins\PluginUpdater\res\Resource.rc
+// Used by D:\Development\Miranda NG\plugins\PluginUpdater\res\Resource.rc
//
#define IDI_MENU 101
#define IDD_UPDATE 102
@@ -60,7 +60,8 @@
#define IDC_CUSTOMURL 1042
#define IDC_STABLE 1043
#define IDC_TRUNK 1044
-#define IDC_CUSTOM 1045
+#define IDC_TRUNK_SYMBOLS 1045
+#define IDC_CUSTOM 1046
#define IDC_MSG_BOXES 40071
#define IDC_ERRORS 40072
#define IDC_INFO_MESSAGES 40073