diff options
-rw-r--r-- | updater/extern.cpp | 2 | ||||
-rw-r--r-- | updater/progress_dialog.cpp | 23 | ||||
-rw-r--r-- | updater/scan.cpp | 38 | ||||
-rw-r--r-- | updater/services.cpp | 11 | ||||
-rw-r--r-- | updater/xmldata.cpp | 2 |
5 files changed, 48 insertions, 28 deletions
diff --git a/updater/extern.cpp b/updater/extern.cpp index 2f599dd..0c7f8c0 100644 --- a/updater/extern.cpp +++ b/updater/extern.cpp @@ -112,12 +112,10 @@ int ExternProcess(bool restart) if (IsWinVerXPPlus())
{
mir_sntprintf(szParams, SIZEOF(szParams), _T("RUNDLL32.EXE \"%s\",ExternalUpdate %s"), szBuf, data_filename);
-// szProcDir = NULL;
}
else
{
TCHAR* p = _tcsrchr(szBuf, _T('\\')); if (p) *p = 0;
-// szProcDir = szBuf;
// rundll32 hates spaces in the <dll name> arg, but quotes aren't allowed in earlier versions...
// GetShortPath can return paths with spaces (at least on XP with 8.3 filenames disabled)...
diff --git a/updater/progress_dialog.cpp b/updater/progress_dialog.cpp index 4d35bd0..74ac4ef 100644 --- a/updater/progress_dialog.cpp +++ b/updater/progress_dialog.cpp @@ -64,24 +64,27 @@ INT_PTR CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return TRUE; // disable esc, enter, etc
case WM_CLOSE:
- PostMessage(hwndDlg, WM_QUIT, 0, 0);
+ DestroyWindow(hwndDlg);
break;
case WM_DESTROY:
KillTimer(hwndDlg, ID_PROGTIMER);
- Utils_SaveWindowPosition(hwndDlg,0,MODULE,"ProgressWindow");
- ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)0));
- ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)0));
+ Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "ProgressWindow");
+ ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ hwndProgress = NULL;
+ PostQuitMessage(0);
break;
}
return FALSE;
}
-void ProgressWindowThread(void *)
+void ProgressWindowThread(HANDLE hEvent)
{
hwndProgress = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PROGRESS), NULL, DlgProcProgress);
SetWindowPos(hwndProgress, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
UpdateWindow(hwndProgress);
+ SetEvent(hEvent);
MSG hwndMsg;
while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_Terminated())
@@ -92,17 +95,17 @@ void ProgressWindowThread(void *) DispatchMessage(&hwndMsg);
}
}
-
- if (hwndProgress) DestroyWindow(hwndProgress);
- hwndProgress = NULL;
}
void CreateProgressWindow(void)
{
- mir_forkthread(ProgressWindowThread, NULL);
+ HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ mir_forkthread(ProgressWindowThread, hEvent);
+ WaitForSingleObject(hEvent, INFINITE);
+ CloseHandle(hEvent);
}
void ProgressWindowDone(void)
{
- PostMessage(hwndProgress, WM_QUIT, 0, 0);
+ if (hwndProgress) PostMessage(hwndProgress, WM_CLOSE, 0, 0);
}
diff --git a/updater/scan.cpp b/updater/scan.cpp index fc5db50..395b3a7 100644 --- a/updater/scan.cpp +++ b/updater/scan.cpp @@ -15,23 +15,34 @@ static const AlternateShortName alternate_shortname_map[] = { "Version Informations", "Version Information" },
{ "Jabber Protocol", "JabberG Protocol" },
{ "Jabber Protocol (Unicode)", "JabberG Protocol (Unicode)" },
- //{ "PopUp Interoperability", "PopUp Plus" }, - disabled since popup plus archive structure is incompatible
+#ifdef _UNICODE
+ { "PopUp Interoperability", "PopUp Plus (Unicode)" },
+#else
+ { "PopUp Interoperability", "PopUp Plus" },
+#endif
//{ "Messaging Style Conversation", "nConvers++" }, // will this conflict with other nConvers'?
{ "MimQQ-libeva", "MirandaQQ (libeva Version)" },
- { "Icons Library Manager (Unicode)", "Icons library manager" },
// grr
{ "Updater", __PLUGIN_NAME },
{ "Updater (Unicode)", __PLUGIN_NAME },
};
-const char* findAlternateShortName(const char* name)
+char* findAlternateShortName(const char* name)
{
for (int i = 0; i < SIZEOF(alternate_shortname_map); ++i)
{
if (strcmp(name, alternate_shortname_map[i].from) == 0)
- return alternate_shortname_map[i].to;
+ return mir_strdup(alternate_shortname_map[i].to);
}
+#ifdef _UNICODE
+ if (!strstr(name, "Unicode"))
+ {
+ char *buf = (char*)mir_alloc(256);
+ mir_snprintf(buf, 256, "%s (Unicode)", name);
+ return buf;
+ }
+#endif
return NULL;
}
@@ -98,7 +109,8 @@ void ScanPlugins(FilenameMap *fn_map, UpdateList *update_list) DBWriteContactSettingByte(0, "PluginDisable", lowname, 0);
mir_free(lowname);
- const char* alternateName = findAlternateShortName(pluginInfo->shortName);
+ bool found = false;
+ char* alternateName = findAlternateShortName(pluginInfo->shortName);
if (alternateName)
{
int file_id = FindFileID(alternateName, MC_PLUGINS, update_list);
@@ -114,10 +126,13 @@ void ScanPlugins(FilenameMap *fn_map, UpdateList *update_list) fn_map->insert(fns);
}
fns->list.insert(mir_tstrdup(findData.cFileName));
+ found = true;
}
}
+ mir_free(alternateName);
}
- else
+
+ if (!found)
{
int file_id = FindFileID(pluginInfo->shortName, MC_PLUGINS, update_list);
if (file_id != -1)
@@ -259,10 +274,15 @@ bool RearrangeDllsWorker(char *shortName, StrList &filenames, TCHAR *basedir) dll_info_func_ex = (Miranda_Plugin_Info_Ex)GetProcAddress(hModule, "MirandaPluginInfoEx");
if((dll_info_func_ex && (pluginInfo = (PLUGININFO *)dll_info_func_ex(mirandaVersion))) || (dll_info_func && (pluginInfo = dll_info_func(mirandaVersion))))
{
- const char* alternateName = findAlternateShortName(pluginInfo->shortName);
- if (alternateName == NULL) alternateName = pluginInfo->shortName;
+ bool found = !_stricmp(pluginInfo->shortName, shortName);
+ if (!found)
+ {
+ char* alternateName = findAlternateShortName(pluginInfo->shortName);
+ found = alternateName && !_stricmp(alternateName, shortName);
+ mir_free(alternateName);
+ }
- if (_stricmp(alternateName, shortName) == 0)
+ if (found)
{
bool moved = false;
TCHAR* newname = NULL;
diff --git a/updater/services.cpp b/updater/services.cpp index e64e8da..3d6fcd7 100644 --- a/updater/services.cpp +++ b/updater/services.cpp @@ -32,7 +32,7 @@ bool DownloadUpdates(UpdateList &todo, FilenameMap *map, bool dlls_only) { // iterate through the updates we need to check
- if(use_popup)
+ if (use_popup)
{
ShowPopup(0, TranslateT("Downloading Updates"), _T(""), POPFLAG_SAVEHWND, -1);
}
@@ -123,7 +123,7 @@ bool DownloadUpdates(UpdateList &todo, FilenameMap *map, bool dlls_only) { }
- if (!use_popup && hwndProgress) ProgressWindowDone();
+ ProgressWindowDone();
// postmessage here causes a lockup on exit! bah popups!!
//if(hwndPop) PostMessage(hwndPop, WMU_CLOSEPOP, 0, 0);
if (hwndPop) SendMessage(hwndPop, WMU_CLOSEPOP, 0, 0);
@@ -208,7 +208,7 @@ void CheckForUpdatesWorker(void *param) { CreateProgressWindow();
PostMessage(hwndProgress, WM_SETTEXT, 0, (LPARAM)TranslateT("Progress - Checking for updates..."));
- if(options.use_xml_backend) PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Downloading XML data"), 0);
+ if (options.use_xml_backend) PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Downloading XML data"), 0);
else PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Checking for updates"), 0);
}
@@ -282,7 +282,7 @@ void CheckForUpdatesWorker(void *param) { }
}
- if (!use_popup && hwndProgress) ProgressWindowDone();
+ ProgressWindowDone();
if (hwndPop) PostMessage(hwndPop, WMU_CLOSEPOP, 0 , 0);
if(options.use_xml_backend) {
@@ -382,8 +382,7 @@ void CheckForUpdatesWorker(void *param) { }
else if (!restart)
{
- HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
- PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0);
+ PostMessage((HWND)CallService(MS_CLUI_GETHWND, 0, 0), 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)
diff --git a/updater/xmldata.cpp b/updater/xmldata.cpp index 02017d7..5a7aed4 100644 --- a/updater/xmldata.cpp +++ b/updater/xmldata.cpp @@ -265,7 +265,7 @@ bool UpdateXMLData(const Category cat, const char *redirect_url /*= 0*/, int rec req.flags |= NLHRF_PERSISTENT | NLHRF_REDIRECT;
NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&req);
- if (etag_hdr.szValue) free(etag_hdr.szValue);
+ free(etag_hdr.szValue);
if (!resp)
{
|