diff options
-rw-r--r-- | updater/scan.cpp | 2 | ||||
-rw-r--r-- | updater/services.cpp | 88 | ||||
-rw-r--r-- | updater/updater.dsp | 2 | ||||
-rw-r--r-- | updater/xmldata.cpp | 48 |
4 files changed, 84 insertions, 56 deletions
diff --git a/updater/scan.cpp b/updater/scan.cpp index 21e9311..8b43d8a 100644 --- a/updater/scan.cpp +++ b/updater/scan.cpp @@ -284,7 +284,7 @@ bool RearrangeDllsWorker(char *shortName, StrList &filenames, TCHAR *basedir) // disable any new plugins (i.e. not installed before) that somehome got into the
// dowloaded archives (e.g. loadavatars comes with loadavatarsw - installing both is not good!)
- char *temp_str = mir_t2a(fileName);
+ char *temp_str = _strlwr(mir_t2a(fileName));
disabled_val = DBGetContactSettingByte(0, "PluginDisable", temp_str, 255);
if (disabled_val == 255) { // assume this means setting not in db (should be 1 or 0)
DBWriteContactSettingByte(0, "PluginDisable", temp_str, 1);
diff --git a/updater/services.cpp b/updater/services.cpp index 49b3c91..43b86c8 100644 --- a/updater/services.cpp +++ b/updater/services.cpp @@ -99,7 +99,7 @@ bool DownloadUpdates(UpdateList &todo, FilenameMap *map, bool dlls_only) { if(got_file)
{
a_download_succeeded = true;
- if(todo[index].file_id != -1)
+ if (todo[index].file_id != -1)
{
FileNameStruct* fns = map->find((FileNameStruct*)&todo[index].file_id);
if (todo[index].cat == MC_PLUGINS || todo[index].cat == MC_UNKNOWN)
@@ -117,7 +117,7 @@ bool DownloadUpdates(UpdateList &todo, FilenameMap *map, bool dlls_only) { }
}
- if(use_popup == false && hwndProgress == 0)
+ if (!use_popup && hwndProgress == 0)
{
RemoveFolder(options.temp_folder);
break; // user closed progress window - cancel
@@ -201,9 +201,12 @@ void CheckForUpdatesWorker(void *param) { FilenameMap fn_map(5, CompareFileNameStruct);
- if(use_popup) {
+ if (use_popup)
+ {
ShowPopup(0, TranslateT("Checking for Updates"), _T(""), POPFLAG_SAVEHWND, -1);
- } else {
+ }
+ else
+ {
CreateProgressWindow();
PostMessage(hwndProgress, WM_SETTEXT, 0, (LPARAM)TranslateT("Progress - Checking for updates..."));
@@ -214,14 +217,16 @@ void CheckForUpdatesWorker(void *param) { EnterCriticalSection(&list_cs);
- if(options.use_xml_backend)
+ if (options.use_xml_backend)
{
- if (UpdateXMLData(MC_PLUGINS)) {// prevent double error messages (in some cases)
+ if (UpdateXMLData(MC_PLUGINS)) // prevent double error messages (in some cases)
+ {
// iterate through the registered plugins
if (!use_popup) PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Scanning plugins folder"), 0);
ScanPlugins(&fn_map, &update_list);
- if (UpdateXMLData(MC_LOCALIZATION)) {
+ if (UpdateXMLData(MC_LOCALIZATION))
+ {
if (!use_popup) PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Scanning language packs"), 0);
ScanLangpacks(&fn_map, &update_list);
}
@@ -242,11 +247,15 @@ void CheckForUpdatesWorker(void *param) { UpdateList todo;
- for(index = 0; index < count; index++) {
- if(update_list2[index].update_options.enabled) {
+ for(index = 0; index < count; index++)
+ {
+ if(update_list2[index].update_options.enabled)
+ {
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Checking plugin: %s"), (temp_str = GetTString(update_list2[index].update.szComponentName)));
mir_free(temp_str);
- } else {
+ }
+ else
+ {
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Skipping plugin: %s"), (temp_str = GetTString(update_list2[index].update.szComponentName)));
mir_free(temp_str);
}
@@ -257,23 +266,26 @@ void CheckForUpdatesWorker(void *param) { } //else if(hwndPop) // disabled - just annoying
//ChangePopupText(hwndPop, msg);
- if(update_list2[index].update_options.enabled) {
+ if (update_list2[index].update_options.enabled)
+ {
char *nv;
bool beta;
- if(nv = UpdateRequired(update_list2[index], &beta)) {
+ if (nv = UpdateRequired(update_list2[index], &beta))
+ {
todo.insert(new UpdateInternal(update_list2[index]));
todo[todo.getCount()-1].newVersion = nv;
todo[todo.getCount()-1].update_options.use_beta = beta;
}
}
- if(use_popup == false && hwndProgress == 0) {
+ if (!use_popup && hwndProgress == NULL)
+ {
RemoveFolder(options.temp_folder);
break; // user closed progress window - cancel
}
}
- if(!use_popup && hwndProgress) ProgressWindowDone();
- if(hwndPop) PostMessage(hwndPop, WMU_CLOSEPOP, 0, 0);
+ if (!use_popup && hwndProgress) ProgressWindowDone();
+ if (hwndPop) PostMessage(hwndPop, WMU_CLOSEPOP, 0 , 0);
if(options.use_xml_backend) {
FreeXMLData(MC_PLUGINS);
@@ -282,16 +294,23 @@ void CheckForUpdatesWorker(void *param) { bool restore_status = true;
- if(todo.getCount()) {
+ if (todo.getCount())
+ {
int cd_ret = CD_OK;
- if(confirm) {
- if(use_popup) {
+ if (confirm)
+ {
+ if (use_popup)
+ {
ShowPopup(0, TranslateT("Updates Available"), TranslateT("Updated Miranda components detected.\nClick here to install."), POPFLAG_SAVEHWND, -1);
DWORD ret;
- while((ret = WaitForSingleObject(hEventPop, 200)) == WAIT_TIMEOUT && !Miranda_Terminated());
- if(!pop_cancelled && ret == WAIT_OBJECT_0 && !Miranda_Terminated()) {
+ while ((ret = WaitForSingleObject(hEventPop, 200)) == WAIT_TIMEOUT && !Miranda_Terminated());
+
+ if (!pop_cancelled && ret == WAIT_OBJECT_0 && !Miranda_Terminated())
+ {
cd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMUPDATES), GetDesktopWindow(), DlgProcConfirm, (LPARAM)&todo);
- } else {
+ }
+ else
+ {
if(hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
RestoreStatus();
for(int i=0; i<todo.getCount(); ++i)
@@ -301,24 +320,25 @@ void CheckForUpdatesWorker(void *param) { hNetlibHttp = NULL;
return;
}
- } else
+ }
+ else
cd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMUPDATES), GetDesktopWindow(), DlgProcConfirm, (LPARAM)&todo);
}
- if(!confirm || cd_ret == CD_CONFALL || cd_ret == CD_NOINSTALL || cd_ret == CD_OK)
+ if (!confirm || cd_ret == CD_CONFALL || cd_ret == CD_NOINSTALL || cd_ret == CD_OK)
{
bool conf_all = (cd_ret == CD_CONFALL), no_install = (cd_ret == CD_NOINSTALL);
// ensure the backup folder exists (either create it or return non-zero signifying error)
- if(options.backup && !CreatePath(options.backup_folder))
+ if (options.backup && !CreatePath(options.backup_folder))
{
//MessageBox(0, Translate("Could not create backup folder"), Translate("Error"), MB_OK | MB_ICONERROR);
ShowError(TranslateT("Could not create backup folder"));
- if(hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
+ if (hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
RestoreStatus();
- for(int i=0; i<todo.getCount(); ++i)
+ for (int i=0; i<todo.getCount(); ++i)
free(todo[i].newVersion);
checking = false;
Netlib_CloseHandle(hNetlibHttp);
@@ -352,26 +372,30 @@ void CheckForUpdatesWorker(void *param) { // rescan to get correct version numbers
ScanPlugins(0, 0);
- } else
+ }
+ else
{
- if(ExternProcess(restart) == 0) // if restarting, don't restore status
+ if (ExternProcess(restart) == 0) // if restarting, don't restore status
restore_status = false;
}
}
}
}
- for(int i=0; i<todo.getCount(); ++i)
+ for (int i=0; i<todo.getCount(); ++i)
free(todo[i].newVersion);
- } else if(!restart) {
+ }
+ else if (!restart)
+ {
HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0);
}
- if(restore_status && restart) { // restore status if we're not doing an 'update and shutdown', and the update was unsuccessful (or there was nothing to update, or no need to shutdown)
+ if (restore_status && restart) // restore status if we're not doing an 'update and shutdown', and the update was unsuccessful (or there was nothing to update, or no need to shutdown)
+ {
checking = false;
- if(hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
+ if (hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
RestoreStatus();
}
Netlib_CloseHandle(hNetlibHttp);
diff --git a/updater/updater.dsp b/updater/updater.dsp index 6d428e1..8049822 100644 --- a/updater/updater.dsp +++ b/updater/updater.dsp @@ -99,7 +99,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UPDATER_EXPORTS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /Zd /O1 /I "../../include" /I "../../../include" /I "zbin" /I "zbin/minizip" /I "bzip2-1.0.3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "BZ_NO_STDIO" /D "_UNICODE" /D "UNICODE" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include" /I "../../../include" /I "zbin" /I "zbin/minizip" /I "bzip2-1.0.3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "BZ_NO_STDIO" /D "_UNICODE" /D "UNICODE" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
diff --git a/updater/xmldata.cpp b/updater/xmldata.cpp index 61239b1..e98fd51 100644 --- a/updater/xmldata.cpp +++ b/updater/xmldata.cpp @@ -421,20 +421,34 @@ const char *FindVersion(int file_id, BYTE *pbVersionBytes, int cpbVersionBytes, return 0;
}
-int FindFileID(const char *name, const Category cat, UpdateList *update_list) {
-
+int FindFileID(const char *name, const Category cat, UpdateList *update_list)
+{
if (!doc[cat]) return -1;
+ if (update_list)
+ {
+ // couldn't find it in xml file - check if a plugin gave us a file id for a different shortName
+ for (int i = 0; i < update_list->getCount(); ++i)
+ {
+ UpdateInternal &ui = (*update_list)[i];
+ if (ui.file_id != -1 && strcmp(ui.update.szComponentName, name) == 0)
+ return ui.file_id;
+ }
+ }
+
// ignore case in name
int id = -1;
char *version = NULL;
ezxml_t root = ezxml_get(doc[cat], "channel", 0, "item", -1);
- while (root) {
+ while (root)
+ {
const char* title = ezxml_txt(ezxml_child(root, "title"));
- if (_stricmp(title, name) == 0) {
+ if (_stricmp(title, name) == 0)
+ {
const char* subcategory = ezxml_txt(ezxml_child(root, "subcategory"));
- if (strcmp(subcategory, "Archived")) {
+ if (strcmp(subcategory, "Archived"))
+ {
int id1 = atoi(ezxml_txt(ezxml_child(root, "id")));
if (id1)
{
@@ -450,19 +464,6 @@ int FindFileID(const char *name, const Category cat, UpdateList *update_list) { root = ezxml_next(root);
}
- if(id == -1 && update_list)
- {
- // couldn't find it in xml file - check if a plugin gave us a file id for a different shortName
- for (int i = 0; i < update_list->getCount(); ++i)
- {
- if ((*update_list)[i].file_id != -1 && strcmp((*update_list)[i].update.szComponentName, name) == 0)
- {
- id = (*update_list)[i].file_id;
- break;
- }
- }
- }
-
return id;
}
@@ -470,18 +471,21 @@ void UpdateFLIDs(UpdateList &update_list) {
for (int i = 0; i < update_list.getCount(); ++i)
{
- if(update_list[i].file_id == -1 && update_list[i].update.szUpdateURL && strcmp(update_list[i].update.szUpdateURL, UPDATER_AUTOREGISTER) == 0) {
+ if(update_list[i].file_id == -1 && update_list[i].update.szUpdateURL && strcmp(update_list[i].update.szUpdateURL, UPDATER_AUTOREGISTER) == 0)
+ {
int file_id = FindFileID(update_list[i].update.szComponentName, MC_PLUGINS, 0);
- if(file_id == -1)
+ if (file_id == -1)
file_id = FindFileID(update_list[i].update.szComponentName, MC_LOCALIZATION, 0);
- if(file_id != -1) {
+ if (file_id != -1)
+ {
update_list[i].file_id = file_id;
char *buff = (char *)safe_alloc((int)strlen(MIM_DOWNLOAD_URL_PREFIX) + 9);
sprintf(buff, MIM_DOWNLOAD_URL_PREFIX "%d", file_id);
update_list[i].update.szUpdateURL = buff;
update_list[i].shortName = safe_strdup(update_list[i].update.szComponentName);
- if(update_list[i].update.szBetaVersionURL) {
+ if(update_list[i].update.szBetaVersionURL)
+ {
update_list[i].update_options.fixed = false;
LoadUpdateOptions(update_list[i].update.szComponentName, &update_list[i].update_options);
}
|