diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-13 07:19:40 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-13 07:19:40 +0000 |
commit | 77b0ee42f97d9f3f42d09e40ad79ddccac300974 (patch) | |
tree | cf8024f79d66fc6602cddac5c14a3dea925bfbc3 /updater/services.cpp | |
parent | 41f8db5f1aa22411abdcd27cf32d12f74b947570 (diff) |
Fixes for update issues
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@560 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/services.cpp')
-rw-r--r-- | updater/services.cpp | 88 |
1 files changed, 56 insertions, 32 deletions
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);
|