summaryrefslogtreecommitdiff
path: root/plugins/PackUpdater/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/PackUpdater/src')
-rw-r--r--plugins/PackUpdater/src/Common.h4
-rw-r--r--plugins/PackUpdater/src/Options.cpp18
-rw-r--r--plugins/PackUpdater/src/PackUpdater.cpp1
-rw-r--r--plugins/PackUpdater/src/Utils.cpp26
-rw-r--r--plugins/PackUpdater/src/resource.h2
5 files changed, 12 insertions, 39 deletions
diff --git a/plugins/PackUpdater/src/Common.h b/plugins/PackUpdater/src/Common.h
index a72e52ce6c..f41ef35d66 100644
--- a/plugins/PackUpdater/src/Common.h
+++ b/plugins/PackUpdater/src/Common.h
@@ -93,9 +93,9 @@ struct PopupDataText
#define DEFAULT_PERIODMEASURE 1
#ifdef WIN32
- #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x32/"
+ #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x32"
#else
- #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x64/"
+ #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x64"
#endif
#define IDINFO 3
diff --git a/plugins/PackUpdater/src/Options.cpp b/plugins/PackUpdater/src/Options.cpp
index 9e09732ee6..1966aceb49 100644
--- a/plugins/PackUpdater/src/Options.cpp
+++ b/plugins/PackUpdater/src/Options.cpp
@@ -70,19 +70,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
}
}
-
- {
- DBVARIANT dbVar;
- if ( !DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) {
- SetDlgItemText(hwndDlg, IDC_UPDATE_URL, dbVar.ptszVal);
- DBFreeVariant(&dbVar);
- }
- else {
- std::tstring url = _T(DEFAULT_UPDATE_URL); url.append( _T("hashes.txt"));
- SetDlgItemText(hwndDlg, IDC_UPDATE_URL, url.c_str());
- DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL));
- }
- }
return TRUE;
case WM_COMMAND:
@@ -129,7 +116,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case IDC_ERRORS2:
case IDC_INFO_MESSAGES2:
case IDC_PROGR_DLG2:
- case IDC_UPDATE_URL:
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -169,10 +155,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
}
}
-
- TCHAR buf[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_UPDATE_URL, buf, SIZEOF(buf));
- DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", buf);
}
break;
}
diff --git a/plugins/PackUpdater/src/PackUpdater.cpp b/plugins/PackUpdater/src/PackUpdater.cpp
index 7886c1b86f..5d1af1b1cc 100644
--- a/plugins/PackUpdater/src/PackUpdater.cpp
+++ b/plugins/PackUpdater/src/PackUpdater.cpp
@@ -73,6 +73,7 @@ extern "C" __declspec(dllexport) int Load(void)
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = -0x7FFFFFFF;
+ mi.flags = CMIF_ICONFROMICOLIB;
mi.icolibItem = Skin_GetIconHandle("check_update");
mi.pszName = LPGEN("Check for pack updates");
mi.pszService = MODNAME"/CheckUpdates";
diff --git a/plugins/PackUpdater/src/Utils.cpp b/plugins/PackUpdater/src/Utils.cpp
index 2ed3362b62..b3a177b41c 100644
--- a/plugins/PackUpdater/src/Utils.cpp
+++ b/plugins/PackUpdater/src/Utils.cpp
@@ -194,7 +194,7 @@ BOOL IsPluginDisabled(const char *filename)
/////////////////////////////////////////////////////////////////////////////////////////
-static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector<FILEINFO>& UpdateFiles)
+static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& hashes, vector<FILEINFO>& UpdateFiles)
{
TCHAR tszMask[MAX_PATH], tszFileBack[MAX_PATH];
mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\*"), tszFolder);
@@ -211,7 +211,7 @@ static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector<FILEINFO>
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\%s"), tszFolder, ffd.cFileName);
- ScanFolder(tszMask, hashes, UpdateFiles);
+ ScanFolder(tszMask, tszBaseUrl, hashes, UpdateFiles);
continue;
}
@@ -252,7 +252,7 @@ static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector<FILEINFO>
_tcscpy(FileInfo.tszDescr, ffd.cFileName);
*p = 0;
- mir_sntprintf(FileInfo.File.tszDownloadURL, SIZEOF(FileInfo.File.tszDownloadURL), _T("%s%s.zip"), _T(DEFAULT_UPDATE_URL), ffd.cFileName);
+ mir_sntprintf(FileInfo.File.tszDownloadURL, SIZEOF(FileInfo.File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, ffd.cFileName);
_tcslwr(FileInfo.File.tszDownloadURL);
mir_sntprintf(FileInfo.File.tszDiskPath, SIZEOF(FileInfo.File.tszDiskPath), _T("%s\\%s.zip"), tszFileBack, ffd.cFileName);
@@ -281,23 +281,15 @@ static void CheckUpdates(void *)
// Load files info
if (DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set
- LPCTSTR Title=TranslateT("Pack Updater");
- LPCTSTR Text = TranslateT("URL for checking updates not found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
- Number = 1;
- show_popup(0, Title, Text, Number, 0);
- }
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONSTOP);
- DBFreeVariant(&dbVar);
- CheckThread = NULL;
- return;
+ DBWriteContactSettingString(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
+ DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar);
}
+ TCHAR* tszBaseUrl = NEWTSTR_ALLOCA(dbVar.ptszVal);
+ DBFreeVariant(&dbVar);
// Download version info
FILEURL *pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl));
- lstrcpyn(pFileUrl->tszDownloadURL, dbVar.ptszVal, SIZEOF(pFileUrl->tszDownloadURL));
- DBFreeVariant(&dbVar);
+ mir_sntprintf(pFileUrl->tszDownloadURL, SIZEOF(pFileUrl->tszDownloadURL), _T("%s/hashes.txt"), tszBaseUrl);
mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\tmp.ini"), tszRoot);
lstrcpyn(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath));
lstrcpyn(tszTmpIni, tszBuff, SIZEOF(tszTmpIni));
@@ -331,7 +323,7 @@ static void CheckUpdates(void *)
DeleteFile(tszTmpIni);
TCHAR *dirname = Utils_ReplaceVarsT(_T("%miranda_path%"));
- ScanFolder(dirname, hashes, UpdateFiles);
+ ScanFolder(dirname, tszBaseUrl, hashes, UpdateFiles);
mir_free(dirname);
// Show dialog
diff --git a/plugins/PackUpdater/src/resource.h b/plugins/PackUpdater/src/resource.h
index 2f9b44cd8c..001732cbf9 100644
--- a/plugins/PackUpdater/src/resource.h
+++ b/plugins/PackUpdater/src/resource.h
@@ -54,8 +54,6 @@
#define IDC_PERIOD 1038
#define IDC_PERIODSPIN 1039
#define IDC_PERIODMEASURE 1040
-#define IDC_EDIT1 1041
-#define IDC_UPDATE_URL 1041
#define IDC_MSG_BOXES 40071
#define IDC_ERRORS 40072
#define IDC_INFO_MESSAGES 40073