Index: Swing.lua
===================================================================
--- Swing.lua	(revision 66692)
+++ Swing.lua	(working copy)
@@ -24,7 +24,29 @@
 	[GetSpellInfo(6807)] = true, -- Maul
 	[GetSpellInfo(2973)] = true, -- Raptor Strike
 	[GetSpellInfo(1464)] = true, -- Slam
+	[GetSpellInfo(24275)] = true, -- MOD 03/27 Charsi - this is the spellid for Hammer of Wrath according to wowhead
 }
+-- BEGIN MOD 03/27 Charsi - added definitions from pre 2.4 swing.lua, credit to Arac for most of this work
+local nextmelee = {
+	[GetSpellInfo(845)] = true, -- Cleave
+	[GetSpellInfo(78)] = true, -- Heroic Strike
+	[GetSpellInfo(6807)] = true, -- Maul
+	[GetSpellInfo(2973)] = true, -- Raptor Strike
+}
+local attackspeedgains = {
+	["You gain Flurry."] = true,
+	["You gain Bloodlust."] = true,
+	["You gain Heroism."] = true,
+	["You gain Haste."] = true,
+}
+local attackspeedfades = {
+	["Flurry fades from you."] = true,
+	["Bloodlust fades from you."] = true,
+	["Heroism fades from you."] = true,
+	["Haste fades from you."] = true,
+}
+local extraattack -- number of autoattacks, starting at 0 and rising
+-- END MOD
 local _, playerclass = UnitClass('player')
 local unpack = unpack
 local math_abs = math.abs
@@ -86,12 +108,23 @@
 	-- fired when autoshot (or autowand) is enabled/disabled
 	self:RegisterEvent("START_AUTOREPEAT_SPELL")
 	self:RegisterEvent("STOP_AUTOREPEAT_SPELL")
-	
+
 	self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
 	
 	self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
 	
 	self:RegisterEvent("UNIT_ATTACK")
+
+-- BEGIN MOD 03/27 Charsi - Windfury/Sword Specialization
+	self:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF") 
+	extraattack = 0
+-- END MOD
+	
+-- BEGIN MOD 03/27 Charsi - Flurry gain/fade
+	self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
+	self:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF")
+-- END MOD
+
 	if not swingbar then
 		swingbar = CreateFrame('Frame', 'QuartzSwingBar', UIParent)
 		swingbar:SetFrameStrata('HIGH')
@@ -112,25 +145,31 @@
 function QuartzSwing:OnDisable()
 	swingbar:Hide()
 end
+-- BEGIN MOD 03/27 Charsi - added zeroing of extraattack to procedures below
 function QuartzSwing:PLAYER_ENTER_COMBAT()
 	local _,_,offhandlow, offhandhigh = UnitDamage('player')
 	if math_abs(offhandlow - offhandhigh) <= 0.1 or playerclass == "DRUID" then
 		swingmode = 0 -- shouldn't be dual-wielding
 	end
+	extraattack = 0
 end
 function QuartzSwing:PLAYER_LEAVE_COMBAT()
 	if not swingmode or swingmode == 0 then
 		swingmode = nil
 	end
+	extraattack = 0
 end
 function QuartzSwing:START_AUTOREPEAT_SPELL()
 	swingmode = 1
+	extraattack = 0
 end
 function QuartzSwing:STOP_AUTOREPEAT_SPELL()
 	if not swingmode or swingmode == 1 then
 		swingmode = nil
 	end
+	extraattack = 0
 end
+-- END MOD
 
 -- blizzard screws that global up, double usage in CombatLog.lua and GlobalStrings.lua, so we create it ourselves
 local COMBATLOG_FILTER_ME = bit.bor(
@@ -141,16 +180,26 @@
 				)
 
 function QuartzSwing:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, srcGUID, srcName, srcFlags)
-	if (event == "SWING_DAMAGE" or event == "SWING_MISSED") and (bit.band(srcFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME) and swingmode == 0 then
+-- BEGIN MOD 03/27 Charsi - added extraattack logic
+	if (event == "SWING_DAMAGE" or event == "SWING_MISSED") and (bit.band(srcFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME) and swingmode == 0 and extraattack == 0 then
 		self:MeleeSwing()
 	end
+	if extraattack > 0 then
+		extraattack = extraattack - 1
+	end
+-- END MOD
 end
 
 function QuartzSwing:UNIT_SPELLCAST_SUCCEEDED(unit, spell)
 	if swingmode == 0 then
-		if resetspells[spell] then
+		if resetspells[spell] and extraattack == 0 then
 			self:MeleeSwing()
 		end
+-- BEGIN MOD 03/27 Charsi - what if they are spamming HS/cleave and convert the windfury/sword specialization attack into a on-next-melee attack?
+		if nextmelee[spell] and extraattack > 0 then
+			extraattack = extraattack - 1
+		end
+-- END MOD
 	elseif swingmode == 1 then
 		if spell == autoshotname then
 			self:Shoot()
@@ -169,6 +218,28 @@
 		durationtext:SetText(('%.1f'):format(duration))
 	end
 end
+function QuartzSwing:CHAT_MSG_SPELL_SELF_BUFF(msg)
+   if string.find(msg, "1 extra attack") then
+      extraattack = extraattack + 1
+   end
+end 
+-- Arac's haste/flurry midswing bar redraw modifications below
+function QuartzSwing:CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS(msg)
+	if attackspeedgains[msg] then
+		self:UpdateAttackSpeed()
+	end
+end
+function QuartzSwing:CHAT_MSG_SPELL_AURA_GONE_SELF(msg)
+	if attackspeedfades[msg] then
+		self:UpdateAttackSpeed()
+	end
+end 
+function QuartzSwing:UpdateAttackSpeed()
+	duration = UnitAttackSpeed('player')
+	durationtext:SetText(('%.1f'):format(duration))
+	OnUpdate()
+end
+-- END Arac's modifications
 function QuartzSwing:MeleeSwing()
 	duration = UnitAttackSpeed('player')
 	durationtext:SetText(('%.1f'):format(duration))
