From f8847c2493e899ad2e7527803354bc47ba6ac736 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 21 Aug 2015 20:06:53 +0000 Subject: PluginUpdater: - Implemented "Backup profile after update" option - minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@15007 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/DlgListNew.cpp | 50 ++++++++++++++------------------ 1 file changed, 21 insertions(+), 29 deletions(-) (limited to 'plugins/PluginUpdater/src/DlgListNew.cpp') diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 6dc0558cc8..d144b5cd35 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -423,24 +423,19 @@ void UninitListNew() DestroyWindow(hwndDialog); } -INT_PTR ShowListCommand(WPARAM,LPARAM) +static INT_PTR ShowListCommand(WPARAM,LPARAM) { DoGetList(); return 0; } -void InitListNew() -{ - CreateServiceFunction(MS_PU_SHOWLIST, ShowListCommand); -} - void UnloadListNew() { if (hListThread) hListThread = NULL; } -INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam) +static INT_PTR ParseUriService(WPARAM, LPARAM lParam) { TCHAR *arg = (TCHAR *)lParam; if (arg == NULL) @@ -458,6 +453,9 @@ INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam) p = _tcschr(pluginPath, _T('/')); if (p) *p = _T('\\'); + if (GetFileAttributes(pluginPath) != INVALID_FILE_ATTRIBUTES) + return 0; + ptrT updateUrl(GetDefaultUrl()), baseUrl; SERVLIST hashes(50, CompareHashes); if (!ParseHashes(updateUrl, baseUrl, hashes)) { @@ -465,30 +463,24 @@ INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam) return 1; } - FILELIST *fileList = new FILELIST(1); + ServListEntry *hash = hashes.find((ServListEntry*)&pluginPath); + if (hash == NULL) + return 0; VARST dirName(_T("%miranda_path%")); - for (int i = 0; i < hashes.getCount(); i++) - { - ServListEntry &hash = hashes[i]; - - if (mir_tstrcmpi(hash.m_name, pluginPath) == 0) - { - TCHAR tszPath[MAX_PATH]; - mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirName, hash.m_name); - - FILEINFO *fileInfo = ServerEntryToFileInfo(hash, baseUrl, tszPath); - fileList->insert(fileInfo); + TCHAR tszPath[MAX_PATH]; + mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirName, hash->m_name); + FILEINFO *fileInfo = ServerEntryToFileInfo(*hash, baseUrl, tszPath); - break; - } - } - - if (fileList->getCount() == 0) { - ShowPopup(TranslateT("Plugin Updater"), TranslateT("List is empty."), POPUP_TYPE_INFO); - delete fileList; - } - else CallFunctionAsync(LaunchListDialog, fileList); + FILELIST *fileList = new FILELIST(1); + fileList->insert(fileInfo); + CallFunctionAsync(LaunchListDialog, fileList); return 0; -} \ No newline at end of file +} + +void InitListNew() +{ + CreateServiceFunction(MODNAME "/ParseUri", ParseUriService); + CreateServiceFunction(MS_PU_SHOWLIST, ShowListCommand); +} -- cgit v1.2.3