You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

9 years ago
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, December 20, 2015, 1:20 PM -->
<!-- MuClient version 4.99 -->
<!-- Plugin "Updater" generated by Plugin Wizard -->
<muclient>
<plugin
9 years ago
name="zzUpdaterzz"
9 years ago
author="Arcidayne"
id="dff6da0f0c8bd7605fe6a5f4"
language="Lua"
purpose="Created to allow reloading of plugins after updating"
save_state="y"
date_written="2015-12-20 13:19:13"
requires="4.00"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
9 years ago
function update_plugin (pid, pfile, pversion, raw)
9 years ago
async_ok, async = pcall (require, "async")
if async_ok then
9 years ago
plugin_page = async.request(raw, "HTTPS")
9 years ago
end
9 years ago
retval, page, status, headers, full_status = plugin_page:join()
plugin_page = nil
9 years ago
if status == 200 then
9 years ago
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"')) -- Pulls version number
9 years ago
end
9 years ago
if raw_version == pversion then
ColourNote("white", "blue", GetPluginInfo(pid, 1) .. " is up-to-date.")
elseif raw_version > pversion then
ColourNote("white", "blue", "Updating from version " .. pversion .. " to " .. raw_version .. ". Do not touch anything.")
9 years ago
local file = io.open(pfile, "w")
file:write(page)
file:close()
end
raw_version = nil
9 years ago
local ulp, rlp = UnloadPlugin(pid), LoadPlugin(pfile)
DoAfterSpecial(1, "ulp", 12)
DoAfterSpecial(5, "rlp", 12)
9 years ago
end
9 years ago
]]>
</script>
</muclient>