Files

16 lines
658 B
Lua

-- File-local explicit realm-change intent. Native disconnect remains at the
-- original caller; normal sign-in and other accounts' preferences are untouched.
return function(provider, preference, clearLegacy)
return function()
if not provider.Refresh() then return false; end
local status = provider.GetLoginStatus();
local key = status and status.account_preference_key;
if type(key) ~= "string" or #key ~= 64 or key:find("[^0-9a-f]") then
return false;
end
preference.Write(key, nil);
if type(clearLegacy) == "function" then pcall(clearLegacy); end
return true;
end;
end