Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Implemented processing of MOD_DELETED events for pollInstalledModsEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
Melodatron committed Jun 10, 2020
1 parent 0a7d458 commit 574fc0c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ModioUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static void onGetAllEventsPoll(void *object, ModioResponse response, ModioModEve

std::vector<u32> mod_edited_ids;
std::vector<u32> mod_to_download_queue_ids;
std::vector<u32> mod_deleted_ids;
if(events_array_size > 0)
modio::clearCache();
for (size_t i = 0; i < events_array_size; i++)
Expand Down Expand Up @@ -316,11 +317,22 @@ static void onGetAllEventsPoll(void *object, ModioResponse response, ModioModEve
mod_edited_ids.push_back(events_array[i].mod_id);
break;
}
case MODIO_EVENT_MOD_DELETED:
{
modio::writeLogLine("Mod deleted. Mod id: " + modio::toString(events_array[i].mod_id) + " Uninstalling...", MODIO_DEBUGLEVEL_LOG);
mod_deleted_ids.push_back(events_array[i].mod_id);
}
}
}
/* TODO: Re-enable mod profile update? */
//if (mod_edited_ids.size() > 0)
// updateModsCache(mod_edited_ids);
size_t deleted_mod_count = mod_deleted_ids.size();
for (size_t i = 0; i < deleted_mod_count; ++i)
{
modioUninstallMod(mod_deleted_ids[i]);
}

if (mod_to_download_queue_ids.size() > 0)
addModsToDownloadQueue(mod_to_download_queue_ids);

Expand Down

0 comments on commit 574fc0c

Please sign in to comment.