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.
66 lines
1.5 KiB
66 lines
1.5 KiB
<?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="Updater"
|
|
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 UpdatePlugin(pid, pfile, pversion, raw)
|
|
async_ok, async = pcall (require, "async")
|
|
|
|
ColourNote("white", "blue", pfile)
|
|
|
|
if async_ok then
|
|
raw_return = async.request(raw, "HTTPS")
|
|
end
|
|
|
|
retval, page, status, headers, full_status = raw_return:join()
|
|
raw_return = nil
|
|
|
|
if status == 200 then
|
|
raw_version = string.match(page, '%s%s+version="([0-9%.]+)"')
|
|
print("Raw version: " .. raw_version)
|
|
print("Plugin version: " .. pversion)
|
|
end
|
|
|
|
if tonumber(raw_version) == tonumber(pversion) then
|
|
ColourNote("white", "blue", "You currently have the latest version!")
|
|
elseif tonumber(raw_version) > tonumber(pversion) then
|
|
ColourNote("white", "blue", "Updating from " .. pversion .. " to " .. raw_version .. "!")
|
|
Unload(pid)
|
|
local file = io.open(pfile, "w")
|
|
file:write(page)
|
|
file:close()
|
|
DoAfterSpecial(3, "ReloadPlugin(" .. pid .. ")", 12)
|
|
Unload(GetPluginID())
|
|
end
|
|
|
|
raw_version = nil
|
|
end
|
|
]]>
|
|
</script>
|
|
|
|
|
|
</muclient>
|