Checking for the calendar loading normally can be done like this
Lua Code:
local eventframe = CreateFrame("Frame")
eventframe.OnEvent = function(self,event,...)
return eventframe[event] and eventframe[event](...)
end
eventframe:SetScript("OnEvent",eventframe.OnEvent)
local AwesomeDespamFunction = function()
-- do whatever I need to do to remove spam
end
eventframe.ADDON_LOADED = function(addon)
if addon == "Blizzard_Calendar" then
AwesomeDespamFunction()
eventframe:UnregisterEvent("ADDON_LOADED")
end
end
if IsAddOnLoaded("Blizzard_Calendar") then
AwesomeDespamFunction()
else
eventframe:RegisterEvent("ADDON_LOADED")
end
The macro you have would be a good starting point for the AwesomeDespamFunction.
You'd have to use the API to detect the calendar events you want to remove.
Example: Remove any events that are not posted from someone on your guild or friendlist would be an option.
Example2: Hooking the existing Report function and removing all events posted from same player instead of user having to do each one manually.
(or adding an extra item in the event dropdown, "Clear spam")
Or make it a user option.
For starters as a user I'd be happy with either.
a. Use events to detect when something changed in calendar and automatically remove any events that weren't posted by guild/friends.
b. Add an item to the context menu that allows me to mass-remove events from a specific creator.