From 77b0ee42f97d9f3f42d09e40ad79ddccac300974 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Sat, 13 Nov 2010 07:19:40 +0000 Subject: Fixes for update issues git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@560 4f64403b-2f21-0410-a795-97e2b3489a10 --- updater/xmldata.cpp | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'updater/xmldata.cpp') 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); } -- cgit v1.2.3