From c85beefd3a445d56a59c3b38426cec3986746446 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Fri, 3 Dec 2010 05:42:39 +0000 Subject: Fixed Updates in some cases git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@579 4f64403b-2f21-0410-a795-97e2b3489a10 --- updater/scan.cpp | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'updater/scan.cpp') 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; -- cgit v1.2.3