summaryrefslogtreecommitdiff
path: root/updater/xmldata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'updater/xmldata.cpp')
-rw-r--r--updater/xmldata.cpp48
1 files changed, 26 insertions, 22 deletions
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);
}