--[[--------------------------
--  Change Log
--  Batch Craft Chat Filter
--   2013, Corwin MacGregor
------------------------------
-- version format:  MAJOR.MINOR
-- date stamp


v0.1  [10/01/2011] -- init
*  initial work


v1.0  [07/26/2013] -- recode
*  clean-up of old code logic; insertion of new code logic based on actual firing events
*  polish up auto-localization: PatternizeGlobalString()


v1.1  [07/29/2013] -- spoof messages
* attempt to push final message through ChatFrame MessageHandler as a spoofed CHAT_MSG_LOOT
    so that other chat filters can respond to it appropriately (alpha, possibly buggy)


v1.1b  [07/31/2013] -- spoof singles message
* use LOOT_ITEM_CREATED_SELF in spoof if only one item is created (for user thresholds = 1)


v1.2  [08/01/2013] -- Ace packages, options, debugging
* addition of AceDB, AceConfig, AceConsole to provide database, configuration, and slash-command support
* proper coding to allow users to adjust num lines spam threshold
* allow for refined level-of-detail with debug levels for debugf()


v1.2b  [08/09/2013] -- feedback messages
* added messages to indicate start and interruption of batch craftings.


v1.2c  [08/12/2013] -- mutltichatframe partial bugfix, db and options clean-up
* (bugfix 2b) fixed error with filter being attached to multiple listening chatframes. only first gets to play, for now.
* clean-up of database and config.
* set up options, with both console and dialog support.


v1.2d  [08/23/2013] -- versioning, options improvements, localization restructure
* added version-announcing option
* added option default get and set handlers
* added feedback for options' sets
* restructured localization


v1.2e  [08/26/2013] -- ALL THE COLORS, message tags
* preliminary groundwork for coloring messages

       [08/27/2013]
* introduction of output and auxiliary formatting functions
* commented out LICS_SINGLE code; we never filter just one anymore
* removed deprecated ChatCommand code; chat commands are entirely handled through AceConfigCmd

       [08/28/2013]
* (bugfix 3) restored LICS_SINGLE_PATTERN. we need to /find/ singles, we don't ever numMade singles (re: CleanUp())
* added state-wise property handlers for toggle options
* all BCCF chat output now tagged with [BCCF], color-coded to the type of message priority: normal, alert, debug, error
* messages which BCCF provide are now colored in a user-configurable color stored in the db
	spoofed messages will continue to be colored as their message type (CHAT_MSG_LOOT, CHAT_MSG_SKILL, etc.)


v1.2f  [08/28/2013] -- skill-up filtering, bugfixes
* preliminary groundwork for suppressing batch craft skill-up spam

       [08/29/2013]
* broke Project Notes and Changelog out of main codefile into seperate text files in preparation for release build
* broke can-we-debug logic check into own function
* skill filter code for suppressing batch craft skill-up spam in place.
	works on at least the main profession and recipe's specialization subprofession
* (test 3) double-skill up (main & specialty)
* (test 4) random skill-up fails to proc on final cast; make sure message still posted if prev casts skilled-up

       [08/30/2013]
* (bugfix 5) track UNIT_SPELLCAST_FAILED to quit nicely when recipe is: on CD, missing reagent, missing tool
* (bugfix 6) BCCF now properly fails when casting is interrupted by movement  (Thank you, Beahr)

       [09/06/2013]
* (bug 4) failure for skill-up to proc on final cast prevents skill-up message from posting if prev casts skilled up
* (bug 7) spamming Create or Create All buttons spams :Initialize() through :DoTradeSkill() hook, possibly
	corrupting internal settings.

       [09/07/2013]
* (bugfix 4) added AceTimer; CleanUp() :Schedules a timer to CleanUpSkill() 1 sec after last cast,
	to cover skill-up filter not proccing on last cast.  This only happens for "easy" (green) or "medium" (yellow)
	quality recipes.

       [09/08/2013]
* (bugfix 7) spamming Create or Create All buttons no longer spams :Initialize() through :DoTradeSkill() hook
* (bugfix 8) fixed issue where debug verbose command was not properly setting debug level-of-detail
* (bug 9) inappropriately triggers when applying an enchant, hanging addon through bugfix 7.  Likely also triggered
	for casting of Leatherworker's Fur Linings, Tailor's Embroideries, and Blacksmith's Sockets.

       [09/10/2013]
* (bugfix 9) should no longer inappropriately trigger (and hang via bugfix 7) on recipes which do not Create items.
* patch 5.4 TOC bump

       [09/14/2013]
* changed threshold logic to be a bit more intuitive. the value now is the minimum number of lines to filter
* suppressed MSG_BATCH_START in :Initialize() if we're only doing one cast (.threshold = 1)

       [09/17/2013]
* (bugfix 10) Abort_Handler() now calls CleanUpSkill() to properly clean up skill-ups when we have failure or interrupt

       [09/19/2013]
* (bugfix 11) Fixed arguments in call to create timer
* restricted creation of timer to situations when we have more than one cast. (single cast either skills or not,
	(but there wont be a "previous dirty" skill-up to dangle on)

       [09/20/2013]
* (bugfix 12) eliminated clean-up of filteredChatFrame, as interrupt scenarios were somehow causing CleanUp()
	to wipe the variable before CleanUpSkill() had a chance to play with it.  :\
* (bugfix 13) fixed issue that was preventing CleanUpSkill() from firing when recipe downgraded quality during batching

       [04/07/2014]
* (bugfix 17) add code to check specialty status of recipe, make sure we don't bail too early on skill-ups on final cast

       [04/12/2014]
* (bugfix 17b) fix bugfix 17 code so that specialty skill-ups are reported if they're the only skill-ups happening

       [05/04/2016]
* (bugfix 18) fix color option. swatch should now properly acquire the color setting


v1.3   [07/17/2016]
*  push Legion TOC, some changes


v1.3b  [??/??/????] -- rewrite skill-up filtering, scheduling clean-ups, debug system rewrite, testbedding, queued cast handling
* 


v1.4   [??/??/????] -- multichatframe handling
* ???

-- -- --
TO DO

* (bug 14) use AceTimers to actually :Schedule() clean-ups, hopefully this will resolve certain issues with
	interrupted casts clearing filters before they can catch last-moment latent events
* entirely rewrite debug system to provide categorized debugging, instead of flat priority.  should result in
	less debug spam when debugging
* write a debugging testbed that will allow us to test codeflow on-demand, rather than having to rely on Wow
	server-base situations and events

* (bug 15) when a second recipe is cast at the tail of the first, the server is able to queue the spellcast;
	however, bugfix 7 currently kills any set-up for the second recipe, and also the code cannot currently
	handle queued casts.

* (bug 16) [02/28/2014]  Casting Mining:Smelt Trillium after having cast Blacksmithing:Socket Bracers didn't
	trap the smelting spam.  issue with bugfix #9 being broken/incomplete?

* (bug 18) [05/04/2016]  fix color option.  the get handler isn't providing the correct RGBA format for the swatch

* (test 3) compatibility of base profession plus specialization profession with skill filter code
* (bug 4) failure for skill-up to proc on final cast prevents skill-up message from posting if prev casts skilled up
	> this issue still persistant  :<

* (bug 17) [03/31/2014]  when a specialty recipe skills up, the final cast drops the final skill-up of the specialty skill.
* (#17) re-evaluate the logic for skill-up capture.  skill-ups should be pushed on last cast of batch, regardless.
    if filtering the skill-ups isn't working for some reason, consider capturing the skill levels at start of batch,
	and comparing them to levels at end of batch

* remove 'addonName' as a slash command.  too damned unwieldy

* re-evaluate the need for spoofing setOption, especially as called by the verbose option

* determine which frames are registered for CHAT_MSG_LOOT, print our BCCF messages to them (v1.2g)
* colorize messages according to colors for CHAT_MSG_LOOT messages, per frame  (=> ChatTypeInfo["LOOT"]) (1.2g)

* add "Craft loot" as a ChatType, and to ChatTypeGroup["LOOT"]
* add filter for Craft loot in chatframe filters; color feedback and messages according to its colorpicker

* (bug 1) prolly doesn't properly register stack-split loot messages

* dynamic detection of num lines in chat window, to auto-adjust spam threshold
* dynamic detection of maxLines of chat window(s), to determine max threshold of threshold
  (but /which/ chat windows? we don't know ahead of time which ones are being filtered :\ )

* add credits: Siku, Beahr, Carlina, Ixiseclessia

-------------------]]
-- // --