John@98: local bsk=bsk John@98: local _G=_G John@98: local table=table John@98: local pairs=pairs John@98: local setmetatable=setmetatable John@98: local ipairs=ipairs John@98: local string=string John@98: local sformat=string.format John@98: local strsplit=strsplit John@98: local tostring=tostring John@98: local type=type John@98: local unpack=unpack John@98: local getn=getn John@98: setfenv(1,bsk) John@98: John@98: adminList = {} John@98: John@98: local function GuildRosterUpdate() John@98: local guildInfoText = _G.GetGuildInfoText() John@98: local newAdminList = {} John@98: for line in guildInfoText:gmatch("[^\r\n]+") do John@98: local l,r = line:match("(.*):(.*)") -- could use wow strsplit had I known about it before writing this John@98: l = string.trim(l or "") John@98: r = string.trim(r or "") John@98: if l == "BSKADMIN" then -- found a juicy line. may contain multiple, comma delimited John@98: local admins = {strsplit(", ",r)} John@98: for _,a in pairs(admins) do John@98: a = string.trim(a or "") John@98: if a ~= "" then John@98: newAdminList[a] = true John@98: end John@98: end John@98: end John@98: end John@98: John@98: if _G.next(adminList) ~= nil then -- had old admins. don't want to spam on initial load John@98: -- diff new vs old John@98: for a in pairs(adminList) do John@98: if not newAdminList[a] then John@98: print("Admin removed:", a) John@98: end John@98: end John@98: for a in pairs(newAdminList) do John@98: if not adminList[a] then John@98: print("Admin added:",a) John@98: end John@98: end John@98: end John@98: adminList = newAdminList John@98: end John@98: John@98: function InitializeAdmin() John@98: if not event then John@98: _G.error("BSK: Improper order of initialization") John@98: end John@98: event:RegisterEvent("GUILD_ROSTER_UPDATE",GuildRosterUpdate) John@98: _G.GuildRoster() -- will eventually force the event to fire John@98: end John@98: John@98: