|
|
|
<?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
|
|
|
|
name="zzUpdaterzz"
|
|
|
|
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[
|
|
|
|
function update_plugin (pid, pfile, pversion, raw)
|
|
|
|
async_ok, async = pcall (require, "async")
|
|
|
|
|
|
|
|
if async_ok then
|
|
|
|
plugin_page = async.request(raw, "HTTPS")
|
|
|
|
end
|
|
|
|
|
|
|
|
retval, page, status, headers, full_status = plugin_page:join()
|
|
|
|
plugin_page = nil
|
|
|
|
|
|
|
|
if status == 200 then
|
|
|
|
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"')) -- Pulls version number
|
|
|
|
end
|
|
|
|
|
|
|
|
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.")
|
|
|
|
local file = io.open(pfile, "w")
|
|
|
|
file:write(page)
|
|
|
|
file:close()
|
|
|
|
end
|
|
|
|
|
|
|
|
raw_version = nil
|
|
|
|
UnloadPlugin(pid)
|
|
|
|
LoadPlugin(pfile)
|
|
|
|
end
|
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
</muclient>
|