Version v0.4.4

Noshei [02-28-14 - 00:55]
Version v0.4.4
Fix for bag overlay sometimes staying visible when they shouldn't.
Fixed issue is there were items attached when sending a message to multiple recipients.
Fixed issue when clicking cancel on the multiple attachment popup.
Filename
RiftAddon.toc
emInventory.lua
emMain.lua
emSend.lua
emUtility.lua
diff --git a/RiftAddon.toc b/RiftAddon.toc
index 107b70c..ab5bc9b 100644
--- a/RiftAddon.toc
+++ b/RiftAddon.toc
@@ -7,7 +7,7 @@ Author = "Noshei"
 Website = "http://www.riftgame.com"
 Email = "Noshei.Rift@gmail.com"

-Version = "v0.4.3"
+Version = "v0.4.4"

 Environment = "2.5"

diff --git a/emInventory.lua b/emInventory.lua
index b3778cc..853f721 100644
--- a/emInventory.lua
+++ b/emInventory.lua
@@ -28,7 +28,6 @@ function EM.UI.Inventory.CreateSlots(bag, totalSlots)
 			bagWindow[i]:SetWidth((50*bagScale))
 			bagWindow[i]:SetBackgroundColor(0,0,0,0)
 			bagWindow[i]:SetMouseMasking("limited")
-			bagWindow[i]:SetVisible(true)

 		if slotPosition.col < 3 then
 			slotPosition.col = slotPosition.col + 1
diff --git a/emMain.lua b/emMain.lua
index bdd6505..d7f6d6b 100644
--- a/emMain.lua
+++ b/emMain.lua
@@ -61,6 +61,9 @@ function EM.UI.Create()
 			if EM.UI.Contacts.Window then
 				EM.UI.Contacts.Window:SetVisible(false)
 			end
+			for child, st in pairs(EM.Context.Inventory:GetChildren()) do
+				child:SetVisible(false)
+			end
 		end, "LeftClick")

 	EM.UI.MailWindow = window
@@ -245,10 +248,8 @@ function EM.Event.LeftClick(handle)
 				end
 			end
 		else
-			for i=1,7,1 do
-				if EM.UI.Inventory.Bags[i] then
-					EM.UI.Inventory.Bags[i]:SetVisible(false)
-				end
+			for child, st in pairs(EM.Context.Inventory:GetChildren()) do
+				child:SetVisible(false)
 			end
 			if EM.UI.Contacts.Window and EM.UI.Contacts.Window:GetVisible() then
 				EM.UI.Contacts.Window:SetVisible(false)
diff --git a/emSend.lua b/emSend.lua
index 407bf0a..9a772d3 100644
--- a/emSend.lua
+++ b/emSend.lua
@@ -21,15 +21,16 @@ function EM.UI.Setup.Send()

 	for i=1,7,1 do
 		local bag = "BagInventory"..i
+		local bagNumber = "Bag" .. i
 		if UI.Native[bag]:GetLoaded() then
-			EM.UI.Inventory.Loaded(i)
+			EM.UI.Inventory.Bags.Loaded[bagNumber]()
 		end
 	end

 	local sendTab = EM.UI.Send
 	local plat,gold,silver = EM.Utility.Coin(Inspect.Currency.List().coin)
 	EM.UI.Send.Attachments = {}
-
+
 	sendTab.Display = UI.CreateFrame("Texture", "SendDisplay", sendTab)
 		sendTab.Display:SetTexture(AddonId, "gfx/sendTabSmall.png")
 		sendTab.Display:SetLayer(0)
@@ -739,6 +740,8 @@ function EM.UI.SendAttach(hEvent)
 	if EM.Temp.PopupTest then
 		EM.UI.SendMessage()
 		EM.Temp.PopupTest = false
+	elseif EM.Temp.PopupTest == nil then
+		EM.Temp.PopupTest = false
 	else
 		EM.Utility.Popup(2, "Send next set of attachments?", EM.UI.SendAttach)
 	end
@@ -748,7 +751,8 @@ end
 function EM.UI.SendMultiRecipients(hEvent)

 	if EM.Temp.PopupTest then
-		EM.UI.SendMessage()
+		--EM.UI.SendMessage()
+		EM.Event.Trigger.SendMessage()
 		EM.Temp.PopupTest = false
 	elseif EM.Temp.PopupTest == nil then
 		EM.Temp.PopupTest = false
@@ -794,6 +798,7 @@ end
 EM.Temp.mail = {}

 function EM.UI.SendMessage(hEvent)
+	dump(hEvent)
 	local codValue = nil
 	local coinValue = nil

@@ -812,19 +817,23 @@ function EM.UI.SendMessage(hEvent)

 	if multipleRecipients then
 			EM.Temp.mail = { 	to = tofield, subject = sendTab.SubjectField:GetText(),
-						body = sendTab.MessageField:GetText() }
+								body = sendTab.MessageField:GetText() }
+			if attachment then
+				EM.Utility.ClearAttachments()
+				print("Cannot send Attachments to Multiple Recipients.")
+			end
 	else
 		if sendTab.radioSelected == "Money" then
 			coinValue = ((tonumber(sendTab.SentMoneyPlat:GetText()) or 0) * 10000) + ((tonumber(sendTab.SentMoneyGold:GetText()) or 0) * 100) + (tonumber(sendTab.SentMoneySilver:GetText()) or 0)
 			EM.Temp.mail = { 	to = tofield, subject = sendTab.SubjectField:GetText(),
-						body = sendTab.MessageField:GetText(), coin = coinValue, attachments = attachment }
+								body = sendTab.MessageField:GetText(), coin = coinValue, attachments = attachment }
 			EM.UI.Send.SentMoneySilver:SetText("")
 			EM.UI.Send.SentMoneyGold:SetText("")
 			EM.UI.Send.SentMoneyPlat:SetText("")
 		elseif sendTab.radioSelected == "CoD" then
 			codValue = ((tonumber(sendTab.SentMoneyPlat:GetText()) or 0) * 10000) + ((tonumber(sendTab.SentMoneyGold:GetText()) or 0) * 100) + (tonumber(sendTab.SentMoneySilver:GetText()) or 0)
 			EM.Temp.mail = { 	to = tofield, subject = sendTab.SubjectField:GetText(),
-						body = sendTab.MessageField:GetText(), cod = codValue, attachments = attachment }
+								body = sendTab.MessageField:GetText(), cod = codValue, attachments = attachment }
 		end
 	end
 	Command.Mail.Send(EM.Temp.mail, EM.UI.Callback.Send)
diff --git a/emUtility.lua b/emUtility.lua
index ff590c6..50ea38b 100644
--- a/emUtility.lua
+++ b/emUtility.lua
@@ -53,6 +53,11 @@ function EM.Utility.ClearMessage()
 	EM.UI.Send.btnSend:SetEnabled(false)
 end

+function EM.Utility.ClearAttachments()
+	EM.UI.Send.Attachments = {}
+	EM.Send.Fill()
+end
+
 function EM.Utility.Coin(coin)

 	if not coin then return end