diff options
Diffstat (limited to 'plugins/PluginUpdater/src/Utils.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index ac05ae7844..d5f03c8076 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -20,8 +20,6 @@ Boston, MA 02111-1307, USA. #include "Common.h"
HANDLE hNetlibUser = NULL, hPipe = NULL;
-POPUP_OPTIONS PopupOptions = {0};
-extern DWORD g_mirandaVersion;
/////////////////////////////////////////////////////////////////////////////////////
#if MIRANDA_VER >= 0x0A00
@@ -54,22 +52,6 @@ void UnloadNetlib() hNetlibUser = NULL;
}
-void LoadOptions()
-{
- PopupOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
-
- opts.bUpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
- opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
-}
-
ULONG crc32_table[256];
ULONG ulPolynomial = 0x04c11db7;
@@ -123,48 +105,6 @@ int Get_CRC(unsigned char* buffer, ULONG bufsize) return crc^0xffffffff;
}
-int GetUpdateMode()
-{
- int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, -1);
-
- // Check if there is url for custom mode
- if (UpdateMode == UPDATE_MODE_CUSTOM) {
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
- if (url == NULL || !_tcslen(url)) {
- // No url for custom mode, reset that setting so it will be determined automatically
- db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
- UpdateMode = -1;
- }
- }
-
- if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
- // Missing or unknown mode, determine correct from version of running core
- char coreVersion[512];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(coreVersion), (LPARAM)coreVersion);
- UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
- }
-
- return UpdateMode;
-}
-
-TCHAR* GetDefaultUrl()
-{
-#if MIRANDA_VER < 0x0A00
- return mir_tstrdup(_T("http://miranda-ng.org/distr/deprecated/0.94.9/x%platform%"));
-#else
- switch (GetUpdateMode()) {
- case UPDATE_MODE_STABLE:
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL));
- case UPDATE_MODE_TRUNK:
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK));
- case UPDATE_MODE_TRUNK_SYMBOLS:
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
- default:
- return db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
- }
-#endif
-}
-
int CompareHashes(const ServListEntry *p1, const ServListEntry *p2)
{
return _tcsicmp(p1->m_name, p2->m_name);
@@ -270,13 +210,14 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) NETLIBHTTPREQUEST nlhr = {0};
#if MIRANDA_VER < 0x0A00
nlhr.cbSize = NETLIBHTTPREQUEST_V1_SIZE;
+ nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
+ if (g_mirandaVersion >= PLUGIN_MAKE_VERSION(0, 9, 0, 0))
+ nlhr.flags |= NLHRF_PERSISTENT;
#else
nlhr.cbSize = sizeof(nlhr);
+ nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_PERSISTENT;
#endif
nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
- if (g_mirandaVersion >= PLUGIN_MAKE_VERSION(0, 9, 0, 0))
- nlhr.flags |= NLHRF_PERSISTENT;
nlhr.nlc = nlc;
char *szUrl = mir_t2a(pFileURL->tszDownloadURL);
nlhr.szUrl = szUrl;
|