<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>tekKonfigButton.lua</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -43,6 +43,68 @@ function f:ADDON_LOADED(event, addon)
 end
 
 
+-----------------------
+--      Buttons      --
+-----------------------
+
+local function GrabItem(i)
+	AutoLootMailItem(i)
+	InboxFrame.openMailID = i
+	OpenMailFrame.updateButtonPositions = true
+	OpenMail_Update()
+	ShowUIPanel(OpenMailFrame)
+	InboxFrame_Update()
+end
+
+
+local nutting, shining
+local function GatherShinies()
+	shining = true
+	for i=1,GetInboxNumItems() do
+		local _, _, _, subject = GetInboxHeaderInfo(i)
+		if subject:match(&quot;^Auction successful:&quot;) then
+			Debug(&quot;Grabbing cash&quot;, i, subject)
+			return GrabItem(i)
+		end
+	end
+	shining = false
+	Debug(&quot;Done gathering shinies&quot;)
+end
+
+local function CollectNuts()
+	nutting = true
+	local free = 0
+	for i=0,4 do free = free + GetContainerNumFreeSlots(i) end
+	if free &gt; 1 then
+		for i=1,GetInboxNumItems() do
+			local _, _, _, subject = GetInboxHeaderInfo(i)
+			if subject:match(&quot;^Auction expired:&quot;) then
+				Debug(&quot;Grabbing nuts&quot;, i, subject)
+				return GrabItem(i)
+			end
+		end
+	end
+	nutting = false
+	Debug(&quot;Done collecting nuts&quot;)
+end
+
+local leftbutt = LibStub(&quot;tekKonfig-Button&quot;).new(MailFrame, &quot;TOPLEFT&quot;, 80, -40)
+leftbutt:SetWidth(55)
+leftbutt:SetText(&quot;Shinies&quot;)
+leftbutt.tiptext = &quot;Collect successful auctions&quot;
+leftbutt:SetScript(&quot;OnClick&quot;, GatherShinies)
+
+local rightbutt = LibStub(&quot;tekKonfig-Button&quot;).new(leftbutt, &quot;LEFT&quot;, leftbutt, &quot;RIGHT&quot;, 5, 0)
+rightbutt:SetWidth(40)
+rightbutt:SetText(&quot;Nuts&quot;)
+rightbutt.tiptext = &quot;Collect failed auctions&quot;
+rightbutt:SetScript(&quot;OnClick&quot;, CollectNuts)
+
+
+-----------------------
+--      Tracker      --
+-----------------------
+
 local lastcount, lastitem, lastprice, cashingout, lastexpire
 
 local orig = AutoLootMailItem
@@ -55,7 +117,9 @@ function AutoLootMailItem(i, ...)
 	return orig(i, ...)
 end
 
+
 function f:MAIL_INBOX_UPDATE()
+	local grabnextshiney, grabnextnut
 	local count = GetInboxNumItems()
 	Debug(&quot;MAIL_INBOX_UPDATE&quot;, count)
 
@@ -72,6 +136,7 @@ function f:MAIL_INBOX_UPDATE()
 		Debug(&quot;Detected expired mail removal&quot;, lastexpire)
 		db.failed[lastexpire] = (db.failed[lastexpire] or 0) + 1
 		lastexpire = nil
+		grabnextnut = nutting
 	elseif lastprice and count == lastcount - 1 then
 		Debug(&quot;Detected mail removal&quot;, lastprice, lastitem)
 		db.min[lastitem] = math.min(lastprice, db.min[lastitem] or math.huge)
@@ -79,9 +144,19 @@ function f:MAIL_INBOX_UPDATE()
 		db.last[lastitem] = lastprice
 		db.sold[lastitem] = (db.sold[lastitem] or 0) + 1
 		lastprice, lastitem = nil
+		grabnextshiney = shining
 	end
 
 	lastcount = count
+
+	if grabnextnut then
+		Debug(&quot;Still collecting nuts&quot;)
+		return CollectNuts()
+	end
+	if grabnextshiney then
+		Debug(&quot;Still gathering shinies&quot;)
+		return GatherShinies()
+	end
 end
 
 </diff>
      <filename>NutCounter.lua</filename>
    </modified>
    <modified>
      <diff>@@ -17,6 +17,7 @@
 
 LibStub.lua
 tekKonfigAboutPanel.lua
+tekKonfigButton.lua
 tekIDmemo.lua
 
 NutCounter.lua</diff>
      <filename>NutCounter.toc</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3f3fb088302aba81d767a9ede5120a801446eddf</id>
    </parent>
  </parents>
  <author>
    <name>Tekkub</name>
    <email>tekkub@gmail.com</email>
  </author>
  <url>http://github.com/tekkub/nutcounter/commit/92d6b2cbac9a84ec749b4f84372713d9483f84c1</url>
  <id>92d6b2cbac9a84ec749b4f84372713d9483f84c1</id>
  <committed-date>2008-11-08T14:54:55-08:00</committed-date>
  <authored-date>2008-11-08T14:54:55-08:00</authored-date>
  <message>Add loot-all buttons to the mail frame</message>
  <tree>91005e3570ab22d5df6fee80afe98663e39a5600</tree>
  <committer>
    <name>Tekkub</name>
    <email>tekkub@gmail.com</email>
  </committer>
</commit>
