Language:
Diff     Change language:
Pastebin: 3868
Author: evl
Subject: Gmail-r-21690 and CT_MailMod.diff
Created: 2006-12-21 14:24:51
Download and save
Toggle line numbers
11,53c1,50 
2< GMail = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceHook-2.1") 
3<  
4< local L = AceLibrary("AceLocale-2.2"):new("GMail") 
5<  
6< GMAIL_HELP = L["Fill in as many slots as you want. Each item will be sent in a separate mail to the recipient, with the subject you specify, followed by the item's name and count (for example: <Subject> [Gold Bar x10]). The combined postage is shown in the top right. You can alt-click on items in your bags to add them to the list automatically."] 
7< GMAIL_SEND = L["Send Mail"] 
8< GMAIL_SENDBUTTON = L["Send"] 
9< GMAIL_CANCELBUTTON = L["Cancel"] 
10< GMAIL_SENDINFO = L["Are you sure you want to send the mail? Total postage will be:"] 
11< GMAIL_SENDINFO2 = L["You are sending:"] 
12< GMAIL_ITEMS = L["Item(s)"] 
13< GMAIL_ABORT = L["Abort"] 
14< GMAIL_ITEMNUM = L["Item %d out of %d."] 
15< GMAIL_SENDING = L["Sending mail |c00FFFFFF%d|r/|c00FFFFFF%d|r..."] 
16< GMAIL_DONESENDING = L["Done sending |c00FFFFFF%d|r mail(s)!"] 
17< GMAIL_ABORTED = L["Aborted. |c00FFFFFF%d|r/|c00FFFFFF%d|r mail were sent."] 
18< GMAIL_INBOX_OPENSELECTED = L["Open Selected"] 
19< GMAIL_INBOX_RETURNSELECTED = L["Return Selected"] 
20< GMAIL_INBOX_OPENALL = L["Open All"] 
21< GMAIL_INBOX_OPENALLTITLE = L["Open All?"] 
22< GMAIL_INBOX_OPENALLCONFIRMATION = L["Are you sure you want to open all mail?"] 
23< GMAIL_INBOX_DISPLAYPROCESSMESSAGES = L["Display process messages"] 
24< GMAIL_MASS_MAIL = L["Mass Mail"] 
25< GMAIL_FORWARD = L["Forward"] 
26< GMAIL_NOSUBJECT = L["<No Subject>"] 
27< GMAIL_UNKNOWNSENDER = L["<Unknown Sender>"] 
28< GMAIL_OPEN_FORMAT1 = L["GMail: Mail |c00FFFFFF%d|r/|c00FFFFFF%d|r is Cash on Delivery, skipping..."] 
29< GMAIL_OPEN_FORMAT2 = L["GMail: Mail |c00FFFFFF%d|r/|c00FFFFFF%d|r has no money or items, skipping..."] 
30< GMAIL_OPEN_FORMAT3 = L["GMail: Opening mail |c00FFFFFF%d|r/|c00FFFFFF%d|r: \"|c00FFFFFF%s|r\" from |c00FFFFFF%s|r."] 
31< GMAIL_RETURN_FORMAT = L["GMail: Returning mail |c00FFFFFF%d|r/|c00FFFFFF%d|r: \"|c00FFFFFF%s|r\" to |c00FFFFFF%s|r."] 
32< GMAIL_ERROR = L["GMail: An error occured in GMail. This might be related to lag, trying to send items with an item placed in the normal send mail window, or trying to send items that cannot be sent."] 
33<  
34< function GMail:OnInitialize() 
35<   tinsert(UISpecialFrames, "GMailInboxOpenAll") 
36<  
37<   -- Allows the mail frame to be pushed 
38<   if ( UIPanelWindows["MailFrame"] ) then 
39<       UIPanelWindows["MailFrame"].pushable = 1 
40<   else 
41<       UIPanelWindows["MailFrame"] = { area = "left", pushable = 1 } 
42<   end 
43<  
44<   -- Close FriendsFrame will close if you try to open a mail with mailframe+friendsframe open 
45<   if ( UIPanelWindows["FriendsFrame"] ) then 
46<       UIPanelWindows["FriendsFrame"].pushable = 2 
47<   else 
48<       UIPanelWindows["FriendsFrame"] = { area = "left", pushable = 2 } 
49<   end 
50<  
51<   MailItem1:SetPoint("TOPLEFT", "InboxFrame", "TOPLEFT", 48, -80) 
52<   for i = 1, 7, 1 do 
53<       getglobal("MailItem" .. i .. "ExpireTime"):SetPoint("TOPRIGHT", "MailItem" .. i, "TOPRIGHT", 10, -4) 
54<       getglobal("MailItem" .. i):SetWidth(280) 
55--- 
56> ------------------------------------------------ 
57> --                 CT_MailMod                 -- 
58> --                                            -- 
59> -- Mail several items at once with almost no  -- 
60> -- effort at all. Also takes care of opening  -- 
61> -- several mail items at once, reducing the   -- 
62> -- time spent on maintaining the inbox for    -- 
63> -- bank mules and such.                       -- 
64> -- Please do not modify or otherwise          -- 
65> -- redistribute this without the consent of   -- 
66> -- the CTMod Team. Thank you.                 -- 
67> ------------------------------------------------ 
68>  
69> -------------------------------------------- 
70> -- Initialization 
71>  
72> local module = { }; 
73> local _G = getfenv(0); 
74>  
75> local MODULE_NAME = "CT_MailMod"; 
76> local MODULE_VERSION = strmatch(GetAddOnMetadata(MODULE_NAME, "version"), "^([%d.]+)"); 
77>  
78> module.name = MODULE_NAME; 
79> module.version = MODULE_VERSION; 
80>  
81> _G[MODULE_NAME] = module; 
82> CT_Library:registerModule(module); 
83>  
84> -------------------------------------------- 
85> -- Options 
86>  
87> module.frame = function() 
88>   return "frame#all", { 
89>       "font#tl:5:-5#v:GameFontNormalLarge#CT Team Tip", 
90>       "font#t:0:-20#l:25:0#r#s:0:100#v:ChatFontNormal#You can hold ALT and click an item in your inventory".. 
91>           " to add it to the mail window.  Doing this while targeting a player will add".. 
92>           " items to trade, or open a trade window.  Doing this at the auction house will".. 
93>           " add an item to the auction house window.#l", 
94>        
95>       "font#tl:5:-125#v:GameFontNormalLarge#Options", 
96>       "checkbutton#tl:10:-145#o:hideConfirmation#Hide Confirmation Boxes", 
97>       "checkbutton#tl:10:-165#o:blockTrades#Block Trades When Using Mailbox" 
98>   }; 
99> end 
100>  
101> module.update = function(self, type, value) 
102>   if ( type == "blockTrades" ) then 
103>       if ( MailFrame:IsVisible() ) then 
104>           CT_Mail_BlockTrade(value); 
105>       end 
10655,77d51 
107<  
108<   GMAIL_NUMITEMBUTTONS = 21 
109<   GMail_BagLinks = { } 
110<   GMail_ScheduledStack = { } 
111<   GMail_SelectedItems = { } 
112<   GMail_DELETEDELAY = 1 
113<   GMail_DELETEEVENTDELAY = 1 
114<  
115<   GMailFrame.num = 0 
116<   PanelTemplates_SetNumTabs(MailFrame, 3) 
117<  
118<   GMailForwardFrame.pickItem = { } 
119<   GMailForwardFrame.process = 0 
120<  
121<   GMailGlobalFrame.queue = { } 
122<   GMailGlobalFrame.update = 0 
123<   GMailGlobalFrame.total = 0 
124<   GMailGlobalFrame.sendmail = 0 
125<   GMailGlobalFrame.latency = 2.25 
126<  
127<   GMailTooltip:SetOwner(WorldFrame, "ANCHOR_NONE") 
128<  
129<   GMailInboxFrame.eventFunc = { } 
13080,120c54,61 
131< function GMail:OnEnable() 
132<   self:RegisterEvent("MAIL_INBOX_UPDATE") 
133<   self:RegisterEvent("MAIL_SEND_SUCCESS") 
134<   self:RegisterEvent("MAIL_SEND_INFO_UPDATE") 
135<   self:RegisterEvent("MAIL_CLOSED") 
136<   self:RegisterEvent("MAIL_SHOW") 
137<   self:SecureHook("ContainerFrameItemButton_OnModifiedClick") 
138<   self:SecureHook("PickupContainerItem") 
139<   self:Hook("ContainerFrame_Update", true) 
140<   self:Hook("ClickSendMailItemButton", true) 
141<   self:HookScript(TradeFrame, "OnShow", "TF_Show") 
142<   self:Hook("InboxFrameItem_OnEnter", true) 
143<   self:Hook("MailFrameTab_OnClick", true) 
144<   self:Hook("InboxFrame_OnClick", true) 
145<   self:Hook("InboxFrame_Update", true) 
146<   self:Hook("CloseMail", true) 
147<   self:Hook("TakeInboxItem", true) 
148<   self:Hook("OpenMail_Reply", true) 
149<   oldTakeInboxMoney = OpenMailMoneyButton:GetScript("OnClick") 
150< end 
151<  
152< function GMail:MAIL_SHOW() 
153<   if (not self:IsEventRegistered("BAG_UPDATE")) then self:RegisterEvent("BAG_UPDATE") end 
154<   if (not self:IsEventRegistered("UI_ERROR_MESSAGE")) then self:RegisterEvent("UI_ERROR_MESSAGE") end 
155<   GMailForwardFrame:Show() 
156< end 
157<  
158< function GMail:MAIL_CLOSED() 
159<   if (self:IsEventRegistered("BAG_UPDATE")) then self:UnregisterEvent("BAG_UPDATE") end 
160<   if (self:IsEventRegistered("UI_ERROR_MESSAGE")) then self:UnregisterEvent("UI_ERROR_MESSAGE") end 
161<   GMail:ClearItems() 
162<   GMailGlobalFrame.total = 0 
163<   GMailGlobalFrame.queue = { } 
164<   self:ScheduleEvent(function() GMailForwardFrame:Hide() end, 10) 
165< end 
166<  
167< function GMail:MAIL_SEND_SUCCESS() 
168<   GMAIL_CANSENDNEXT = 1 
169< end 
170<  
171< function GMail:ContainerFrameItemButton_OnModifiedClick(...) 
172--- 
173> -------------------------------------------- 
174> -- Functions 
175>  
176> CT_MAIL_NUMITEMBUTTONS = 21; 
177>  
178> -- Hook the ContainerFrameItemButton_OnClick function 
179> local oldContainerFrameItemButton_OnModifiedClick = ContainerFrameItemButton_OnModifiedClick; 
180> function ContainerFrameItemButton_OnModifiedClick(...) 
181122c63 
182<       local bag, item = this:GetParent():GetID(), this:GetID() 
183--- 
184>       local bag, item = this:GetParent():GetID(), this:GetID(); 
185124,133c65,76 
186<           if ( GMailFrame:IsVisible() and not CursorHasItem() ) then 
187<               if ( ( self:GetItemFrame(bag, item) or ( GMail_addItem and GMail_addItem[1] == bag and GMail_addItem[2] == item ) ) and not special ) then 
188<                   return 
189<               end 
190<               local i 
191<               for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
192<                   if ( not getglobal("GMailButton" .. i).item ) then 
193<                       if ( self:ItemIsMailable(bag, item) ) then 
194<                           GMail:Print(L["GMail: cannot attach item."], 1, 0.5, 0) 
195<                           return 
196--- 
197>           if ( CT_MailFrame:IsVisible() and not CursorHasItem() ) then 
198>               if ( ( CT_Mail_GetItemFrame(bag, item) or ( CT_Mail_addItem and CT_Mail_addItem[1] == bag and CT_Mail_addItem[2] == item ) ) and not special ) then 
199>                   return; 
200>               end 
201>               local i; 
202>               for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
203>                   if ( not getglobal("CT_MailButton" .. i).item ) then 
204>  
205>                       local canMail = CT_Mail_ItemIsMailable(bag, item); 
206>                       if ( canMail ) then 
207>                           DEFAULT_CHAT_FRAME:AddMessage("<CTMod> Cannot attach item, item is " .. canMail, 1, 0.5, 0); 
208>                           return; 
209135,138c78,81 
210<                       PickupContainerItem(bag, item) 
211<                       self:MailButton_OnClick(getglobal("GMailButton" .. i)) 
212<                       self:UpdateItemButtons() 
213<                       return 
214--- 
215>                       PickupContainerItem(bag, item); 
216>                       CT_MailButton_OnClick(getglobal("CT_MailButton" .. i)); 
217>                       CT_Mail_UpdateItemButtons(); 
218>                       return; 
219142,144c85,87 
220<               PickupContainerItem(bag, item) 
221<               ClickSendMailItemButton() 
222<               return 
223--- 
224>               PickupContainerItem(bag, item); 
225>               ClickSendMailItemButton(); 
226>               return; 
227148,150c91,93 
228<                       PickupContainerItem(bag, item) 
229<                       ClickTradeButton(i) 
230<                       return 
231--- 
232>                       PickupContainerItem(bag, item); 
233>                       ClickTradeButton(i); 
234>                       return; 
235154,155c97,98 
236<               InitiateTrade("target") 
237<               GMail_addItem = { bag, item, UnitName("target"), 2 } 
238--- 
239>               InitiateTrade("target"); 
240>               CT_Mail_addItem = { bag, item, UnitName("target"), 2 }; 
241158c101 
242<                       ContainerFrame_Update(getglobal("ContainerFrame" .. i)) 
243--- 
244>                       ContainerFrame_Update(getglobal("ContainerFrame" .. i)); 
245161c104 
246<               return 
247--- 
248>               return; 
249164a108 
250>   oldContainerFrameItemButton_OnModifiedClick(...); 
251167c111 
252< function GMail:PickupContainerItem(bag, item, special) 
253--- 
254> hooksecurefunc("PickupContainerItem", function(bag, item) 
255169,170c113,114 
256<       GMailFrame.bag = bag 
257<       GMailFrame.item = item 
258--- 
259>       CT_MailFrame.bag = bag; 
260>       CT_MailFrame.item = item; 
261172,173c116,117 
262<       GMailFrame.bag = nil 
263<       GMailFrame.item = nil 
264--- 
265>       CT_MailFrame.bag = nil; 
266>       CT_MailFrame.item = nil; 
267175,176c119,120 
268<   self:UpdateItemButtons() 
269< end 
270--- 
271>   CT_Mail_UpdateItemButtons(); 
272> end); 
273178,195c122,126 
274< function GMail:MailFrameTab_OnClick(tab) 
275<   if ( not tab ) then 
276<       tab = this:GetID() 
277<   end 
278<   if ( tab == 3 ) then 
279<       PanelTemplates_SetTab(MailFrame, 3) 
280<       InboxFrame:Hide() 
281<       SendMailFrame:Hide() 
282<       GMailFrame:Show() 
283<       SendMailFrame.sendMode = "massmail" 
284<       MailFrameTopLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopLeft") 
285<       MailFrameTopRight:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopRight") 
286<       MailFrameBotLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-BotLeft") 
287<       MailFrameBotRight:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-BotRight") 
288<       MailFrameTopLeft:SetPoint("TOPLEFT", "MailFrame", "TOPLEFT", 2, -1) 
289<       return 
290<   else 
291<       GMailFrame:Hide() 
292--- 
293> -- Hook the MailFrameTab_OnClick function 
294> local CT_MM_oldMFT_OC = MailFrameTab_OnClick; 
295> function CT_MM_MailFrameTab_OnClick(tab) 
296>   if ( not tab ) then  
297>       tab = this:GetID(); 
298197,199d127 
299<   self.hooks["MailFrameTab_OnClick"](tab) 
300<   self:Forward_EnableForward() 
301< end 
302201c129,151 
303< function GMail:ClickSendMailItemButton() 
304--- 
305>   if ( tab == 3 ) then 
306>       PanelTemplates_SetTab(MailFrame, 3); 
307>       InboxFrame:Hide(); 
308>       SendMailFrame:Hide(); 
309>       CT_MailFrame:Show(); 
310>       SendMailFrame.sendMode = "massmail"; 
311>       MailFrameTopLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopLeft"); 
312>       MailFrameTopRight:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopRight"); 
313>       MailFrameBotLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-BotLeft"); 
314>       MailFrameBotRight:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-BotRight"); 
315>       MailFrameTopLeft:SetPoint("TOPLEFT", "MailFrame", "TOPLEFT", 2, -1); 
316>       return; 
317>   else 
318>       CT_MailFrame:Hide(); 
319>   end 
320>   CT_MM_oldMFT_OC(tab); 
321> end 
322>  
323> MailFrameTab_OnClick = CT_MM_MailFrameTab_OnClick; 
324>  
325> -- Hook the ClickSendMailItemButton function 
326> local CT_MM_oldCSMIB = ClickSendMailItemButton; 
327> function CT_MM_newCSMIB() 
328203,204c153,154 
329<       GMailFrame.mailbag = GMailFrame.bag 
330<       GMailFrame.mailitem = GMailFrame.item 
331--- 
332>       CT_MailFrame.mailbag = CT_MailFrame.bag; 
333>       CT_MailFrame.mailitem = CT_MailFrame.item; 
334206c156 
335<   self.hooks["ClickSendMailItemButton"]() 
336--- 
337>   CT_MM_oldCSMIB(); 
338209,210c159,165 
339< function GMail:MailButton_OnClick(button) 
340<   if ( not button ) then button = this end 
341--- 
342> ClickSendMailItemButton = CT_MM_newCSMIB; 
343>  
344> -- Handle the dragging of items 
345>  
346> function CT_MailButton_OnClick(button) 
347>  
348>   if ( not button ) then button = this; end 
349212,217c167,176 
350<       local bag = GMailFrame.bag 
351<       local item = GMailFrame.item 
352<       if ( not bag or not item ) then return end 
353<       if ( self:ItemIsMailable(bag, item) ) then 
354<           GMail:Print(L["GMail: cannot attach item."], 1, 0.5, 0) 
355<           return 
356--- 
357>        
358>       local bag = CT_MailFrame.bag; 
359>       local item = CT_MailFrame.item; 
360>       if ( not bag or not item ) then return; end 
361>        
362>       local canMail = CT_Mail_ItemIsMailable(bag, item) 
363>       if ( canMail ) then 
364>           DEFAULT_CHAT_FRAME:AddMessage("<CTMod> Cannot attach item, item is " .. canMail, 1, 0.5, 0); 
365>           PickupContainerItem(bag, item); 
366>           return; 
367219c178,180 
368<       PickupContainerItem(bag, item) 
369--- 
370>  
371>       PickupContainerItem(bag, item); 
372>  
373221,223c182,186 
374<           PickupContainerItem(button.bag, button.item) 
375<           GMailFrame.bag = button.bag 
376<           GMailFrame.item = button.item 
377--- 
378>           -- There's already an item there 
379>           -- Pickup that item to replicate Send Mail's behaviour 
380>           PickupContainerItem(button.bag, button.item); 
381>           CT_MailFrame.bag = button.bag; 
382>           CT_MailFrame.item = button.item; 
383225,226c188,189 
384<           GMailFrame.bag = nil 
385<           GMailFrame.item = nil 
386--- 
387>           CT_MailFrame.bag = nil; 
388>           CT_MailFrame.item = nil; 
389228,230c191,196 
390<       local texture, count = GetContainerItemInfo(bag, item) 
391<       getglobal(button:GetName() .. "IconTexture"):Show() 
392<       getglobal(button:GetName() .. "IconTexture"):SetTexture(texture) 
393--- 
394>  
395>       local texture, count = GetContainerItemInfo(bag, item); 
396>  
397>       getglobal(button:GetName() .. "IconTexture"):Show(); 
398>       getglobal(button:GetName() .. "IconTexture"):SetTexture(texture); 
399>  
400232,233c198,199 
401<           getglobal(button:GetName() .. "Count"):SetText(count) 
402<           getglobal(button:GetName() .. "Count"):Show() 
403--- 
404>           getglobal(button:GetName() .. "Count"):SetText(count); 
405>           getglobal(button:GetName() .. "Count"):Show(); 
406235c201 
407<           getglobal(button:GetName() .. "Count"):Hide() 
408--- 
409>           getglobal(button:GetName() .. "Count"):Hide(); 
410237,240c203,208 
411<       button.bag = bag 
412<       button.item = item 
413<       button.texture = texture 
414<       button.count = count 
415--- 
416>  
417>       button.bag = bag; 
418>       button.item = item; 
419>       button.texture = texture; 
420>       button.count = count; 
421>  
422242,256c210,228 
423<       PickupContainerItem(button.bag, button.item) 
424<       getglobal(button:GetName() .. "IconTexture"):Hide() 
425<       getglobal(button:GetName() .. "Count"):Hide() 
426<       GMailFrame.bag = button.bag 
427<       GMailFrame.item = button.item 
428<       button.item = nil 
429<       button.bag = nil 
430<       button.count = nil 
431<       button.texture = nil 
432<   end 
433<   local num = self:GetNumMails() 
434<   GMailFrame.num = num 
435<   self:CanSend(GMailNameEditBox) 
436<   if ( num == 0 ) then num = 1 end 
437<   MoneyFrame_Update("GMailCostMoneyFrame", GetSendMailPrice()*num) 
438--- 
439>  
440>       PickupContainerItem(button.bag, button.item); 
441>       getglobal(button:GetName() .. "IconTexture"):Hide(); 
442>       getglobal(button:GetName() .. "Count"):Hide(); 
443>  
444>       CT_MailFrame.bag = button.bag; 
445>       CT_MailFrame.item = button.item; 
446>  
447>       button.item = nil; 
448>       button.bag = nil; 
449>       button.count = nil; 
450>       button.texture = nil; 
451>  
452>   end 
453>   local num = CT_Mail_GetNumMails(); 
454>   CT_MailFrame.num = num; 
455>   CT_Mail_CanSend(CT_MailNameEditBox); 
456>   if ( num == 0 ) then num = 1; end 
457>   MoneyFrame_Update("CT_MailCostMoneyFrame", GetSendMailPrice()*num); 
458259c231 
459<           ContainerFrame_Update(getglobal("ContainerFrame" .. i)) 
460--- 
461>           ContainerFrame_Update(getglobal("ContainerFrame" .. i)); 
462264,265c236,239 
463< function GMail:ItemIsMailable(bag, item) 
464<   local i, obj = 1 
465--- 
466> function CT_Mail_ItemIsMailable(bag, item) 
467>  
468>   -- Make sure tooltip is cleared 
469>   local i, obj = 1; 
470267c241 
471<       obj = getglobal("GMailTooltipTextLeft" .. i) 
472--- 
473>       obj = getglobal("CT_MMTooltipTextLeft" .. i); 
474269c243 
475<           break 
476--- 
477>           break; 
478271,272c245,246 
479<       obj:SetText("") 
480<       i = i + 1 
481--- 
482>       obj:SetText(""); 
483>       i = i + 1; 
484274,278c248,257 
485<   GMailTooltip:SetBagItem(bag, item) 
486<   for i = 1, GMailTooltip:NumLines(), 1 do 
487<       local text = getglobal("GMailTooltipTextLeft" .. i):GetText() 
488<       if ( text == ITEM_SOULBOUND or text == ITEM_BIND_QUEST or text == ITEM_CONJURED or text == ITEM_BIND_ON_PICKUP ) then 
489<           return 1 
490--- 
491>  
492>   CT_MMTooltip:SetBagItem(bag, item); 
493>   for i = 1, CT_MMTooltip:NumLines(), 1 do 
494>       local text = getglobal("CT_MMTooltipTextLeft" .. i):GetText(); 
495>       if ( text == ITEM_SOULBOUND ) then 
496>           return "soulbound."; 
497>       elseif ( text == ITEM_BIND_QUEST ) then 
498>           return "a quest item."; 
499>       elseif ( text == ITEM_CONJURED ) then 
500>           return "a conjured item."; 
501281c260 
502<   return nil 
503--- 
504>   return; 
505285,288c264,267 
506< function GMail:UpdateItemButtons(frame) 
507<   local i 
508<   for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
509<       local btn = getglobal("GMailButton" .. i) 
510--- 
511> function CT_Mail_UpdateItemButtons(frame) 
512>   local i; 
513>   for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
514>       local btn = getglobal("CT_MailButton" .. i); 
515290c269 
516<           local texture, count 
517--- 
518>           local texture, count; 
519292c271 
520<               texture, count = GetContainerItemInfo(btn.bag, btn.item) 
521--- 
522>               texture, count = GetContainerItemInfo(btn.bag, btn.item); 
523295,300c274,276 
524<               getglobal(btn:GetName() .. "IconTexture"):Hide() 
525<               getglobal(btn:GetName() .. "Count"):Hide() 
526<               btn.item = nil 
527<               btn.bag = nil 
528<               btn.count = nil 
529<               btn.texture = nil 
530--- 
531>               getglobal(btn:GetName() .. "IconTexture"):Hide(); 
532>               getglobal(btn:GetName() .. "Count"):Hide(); 
533>               btn.item = nil; btn.bag = nil; btn.count = nil; btn.texture = nil; 
534302,305c278,281 
535<               btn.count = count 
536<               btn.texture = texture 
537<               getglobal(btn:GetName() .. "IconTexture"):Show() 
538<               getglobal(btn:GetName() .. "IconTexture"):SetTexture(texture) 
539--- 
540>               btn.count = count; 
541>               btn.texture = texture; 
542>               getglobal(btn:GetName() .. "IconTexture"):Show(); 
543>               getglobal(btn:GetName() .. "IconTexture"):SetTexture(texture); 
544307,308c283,284 
545<                   getglobal(btn:GetName() .. "Count"):Show() 
546<                   getglobal(btn:GetName() .. "Count"):SetText(count) 
547--- 
548>                   getglobal(btn:GetName() .. "Count"):Show(); 
549>                   getglobal(btn:GetName() .. "Count"):SetText(count); 
550310c286 
551<                   getglobal(btn:GetName() .. "Count"):Hide() 
552--- 
553>                   getglobal(btn:GetName() .. "Count"):Hide(); 
554317,320c293,296 
555< function GMail:GetItemFrame(bag, item) 
556<   local i 
557<   for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
558<       local btn = getglobal("GMailButton" .. i) 
559--- 
560> function CT_Mail_GetItemFrame(bag, item) 
561>   local i; 
562>   for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
563>       local btn = getglobal("CT_MailButton" .. i); 
564322c298 
565<           return btn 
566--- 
567>           return btn; 
568325c301 
569<   return nil 
570--- 
571>   return; 
572328,332c304,308 
573< function GMail:GetNumMails() 
574<   local i 
575<   local num = 0 
576<   for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
577<       local btn = getglobal("GMailButton" .. i) 
578--- 
579> function CT_Mail_GetNumMails() 
580>   local i; 
581>   local num = 0; 
582>   for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
583>       local btn = getglobal("CT_MailButton" .. i); 
584334c310 
585<           num = num + 1 
586--- 
587>           num = num + 1; 
588337,365c313 
589<   return num 
590< end 
591<  
592< function GMail:ClearItems() 
593<   local i 
594<   local num = 0 
595<   for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
596<       local btn = getglobal("GMailButton" .. i) 
597<       btn.item = nil 
598<       btn.count = nil 
599<       btn.bag = nil 
600<       btn.texture = nil 
601<   end 
602<   self:UpdateItemButtons() 
603<   GMailMailButton:Disable() 
604<   GMailNameEditBox:HighlightText(0,-1) 
605<   GMailSubjectEditBox:SetText("") 
606<   GMailStatusText:SetText("") 
607<   GMailAbortButton:Hide() 
608<   GMailAcceptSendFrame:Hide() 
609< end 
610<  
611< function GMail:CanSend(eb) 
612<   if ( not eb ) then eb = this end 
613<   if ( strlen(eb:GetText()) > 0 and GMailFrame.num > 0 and GetSendMailPrice()*GMailFrame.num <= GetMoney() ) then 
614<       GMailMailButton:Enable() 
615<   else 
616<       GMailMailButton:Disable() 
617<   end 
618--- 
619>   return num; 
620368,404c316,353 
621< function GMail:SendMail() 
622<   for key, val in pairs(this.queue) do 
623<       if ( GetLocale() == "koKR" ) then 
624<           GMailStatusText:SetText(format(GMAIL_SENDING, this.total, key)) 
625<       else 
626<           GMailStatusText:SetText(format(GMAIL_SENDING, key, this.total)) 
627<       end 
628<       GMailAbortButton:Show() 
629<       if ( GetSendMailItem() and GMailFrame.mailbag and GMailFrame.mailitem ) then 
630<           ClickSendMailItemButton() 
631<           PickupContainerItem(GMailFrame.mailbag, GMailFrame.mailitem) 
632<           GMailFrame.mailbag = nil 
633<           GMailFrame.mailitem = nil 
634<       elseif ( CursorHasItem() and GMailFrame.bag and GMailFrame.item ) then 
635<           PickupContainerItem(GMailFrame.bag, GMailFrame.item) 
636<           GMailFrame.bag = nil 
637<           GMailFrame.item = nil 
638<       end 
639<       PickupContainerItem(val.bag, val.item) 
640<       ClickSendMailItemButton() 
641<       local name, useless, count = GetSendMailItem() 
642<       if ( not name ) then 
643<           GMail:Print(GMAIL_ERROR, 1, 0, 0) 
644<       else 
645<           local subjectstr = GMailSubjectEditBox:GetText() 
646<           if ( strlen(subjectstr) > 0 ) then 
647<               subjectstr = subjectstr .. " " 
648<           end 
649<           if ( count > 1 ) then 
650<               subjectstr = subjectstr .. "[" .. name .. " x" .. count .. "]" 
651<           else 
652<               subjectstr = subjectstr .. "[" .. name .. "]" 
653<           end 
654<           if ( GetLocale() == "koKR" ) then 
655<               SendMail(val.to, subjectstr, format(GMAIL_ITEMNUM, this.total, key)) 
656<           else 
657<               SendMail(val.to, subjectstr, format(GMAIL_ITEMNUM, key, this.total)) 
658--- 
659> function CT_Mail_ClearItems() 
660>   local i; 
661>   local num = 0; 
662>   for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
663>       local btn = getglobal("CT_MailButton" .. i); 
664>       btn.item = nil; 
665>       btn.count = nil; 
666>       btn.bag = nil; 
667>       btn.texture = nil; 
668>   end 
669>   CT_Mail_UpdateItemButtons(); 
670>   CT_MailMailButton:Disable(); 
671>   CT_MailNameEditBox:SetText(""); 
672>   CT_MailSubjectEditBox:SetText(""); 
673>   CT_MailStatusText:SetText(""); 
674>   CT_MailAbortButton:Hide(); 
675>  
676>   CT_Mail_AcceptSendFrame:Hide(); 
677> end 
678>  
679> local oldOffline; 
680> local function updateOffline() 
681>   SetGuildRosterShowOffline(oldOffline); 
682> end 
683> function CT_Mail_AutoComplete() 
684>   local text = this:GetText(); 
685>   local textlen = strlen(text); 
686>   local numFriends = GetNumFriends(); 
687>   local name; 
688>   if ( numFriends > 0 ) then 
689>       for i=1, numFriends do 
690>           name =  GetFriendInfo(i); 
691>           if ( name ) then 
692>               if ( strfind(strupper(name), "^"..strupper(text)) ) then 
693>                   this:SetText(name); 
694>                   this:HighlightText(textlen, -1); 
695>                   return; 
696>               end 
697407,423d355 
698<       GMailGlobalFrame.queue[key] = nil 
699<       return 
700<   end 
701<   GMailStatusText:SetText(format(GMAIL_DONESENDING, this.total)) 
702<   GMailAbortButton:Hide() 
703<   GMailGlobalFrame:Hide() 
704<   GMailGlobalFrame.total = 0 
705<   GMailGlobalFrame.queue = { } 
706< end 
707<  
708< function GMail:FillItemTable() 
709<   local arr = { } 
710<   for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
711<       local btn = getglobal("GMailButton" .. i) 
712<       if ( btn.item and btn.bag ) then 
713<           tinsert(arr, { ["item"] = btn.item, ["bag"] = btn.bag, ["to"] = GMailNameEditBox:GetText() }) 
714<       end 
715425,426d356 
716<   return arr 
717< end 
718428,440c358,360 
719< function GMail:ProcessQueue(elapsed) 
720<   if ( not GMAIL_CANSENDNEXT ) then 
721<       return 
722<   end 
723<   this.sendmail = this.sendmail + elapsed 
724<   if ( this.sendmail > 0.5 ) then 
725<       this.sendmail = 0 
726<       if ( this.total > 0 ) then 
727<           self:SendMail() 
728<           GMAIL_CANSENDNEXT = nil 
729<       end 
730<   end 
731< end 
732--- 
733>   -- Hack to scan offline members 
734>   oldOffline = GetGuildRosterShowOffline(); 
735>   SetGuildRosterShowOffline(true); 
736442,452c362,369 
737< function GMail:ContainerFrame_Update(frame) 
738<   self.hooks["ContainerFrame_Update"](frame) 
739<   local id = frame:GetID() 
740<   if ( GMailFrame:IsVisible() ) then 
741<       local i 
742<       for i = 1, GMAIL_NUMITEMBUTTONS, 1 do 
743<           local btn = getglobal("GMailButton" .. i) 
744<           if ( btn.item and btn.bag ) then 
745<               if ( btn.bag == frame:GetID() ) then 
746<                   SetItemButtonDesaturated(getglobal(frame:GetName() .. "Item" .. (frame.size-btn.item)+1), 1, 0.5, 0.5, 0.5) 
747<               end 
748--- 
749>   local numGuildMembers = GetNumGuildMembers(); 
750>   if ( numGuildMembers > 0 ) then 
751>       for i=1, numGuildMembers do 
752>           name = GetGuildRosterInfo(i); 
753>           if ( strfind(strupper(name), "^"..strupper(text)) ) then 
754>               this:SetText(name); 
755>               this:HighlightText(textlen, -1); 
756>               return; 
757456,459d372 
758<   if ( GMail_addItem and GMail_addItem[1] == frame:GetID() ) then 
759<       SetItemButtonDesaturated(getglobal(frame:GetName() .. "Item" .. (frame.size-GMail_addItem[2])+1), 1, 0.5, 0.5, 0.5) 
760<   end 
761< end 
762461,469c374,375 
763< function GMail:MAIL_SEND_INFO_UPDATE() 
764<   if ( not SendMailFrame:IsVisible() ) then return end 
765<   local name, useless, count = GetSendMailItem() 
766<   if ( name and strlen(SendMailSubjectEditBox:GetText()) == 0 ) then 
767<       if ( count > 1 ) then 
768<           name = name .. " x" .. count 
769<       end 
770<       SendMailSubjectEditBox:SetText(name) 
771<   end 
772--- 
773>   -- Revert to old scanning in 0.5 sec 
774>   module:schedule(0.5, updateOffline); 
775472,504c378 
776< function GMail:InboxFrameItem_OnEnter() 
777<   local didSetTooltip 
778<   if ( this.index ) then 
779<       if ( GetInboxItem(this.index) ) then 
780<           GameTooltip:SetOwner(this, "ANCHOR_RIGHT") 
781<           GameTooltip:SetInboxItem(this.index) 
782<           didSetTooltip = 1 
783<       end 
784<   end 
785<   if ( not didSetTooltip ) then 
786<       GameTooltip:SetOwner(this, "ANCHOR_RIGHT") 
787<   end 
788<   if (this.money) then 
789<       GameTooltip:AddLine(ENCLOSED_MONEY, "", 1, 1, 1) 
790<       SetTooltipMoney(GameTooltip, this.money) 
791<       SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) 
792<   elseif (this.cod) then 
793<       GameTooltip:AddLine(COD_AMOUNT, "", 1, 1, 1) 
794<       SetTooltipMoney(GameTooltip, this.cod) 
795<       if ( this.cod > GetMoney() ) then 
796<           SetMoneyFrameColor("GameTooltipMoneyFrame", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) 
797<       else 
798<           SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) 
799<       end 
800<   end 
801<   if ( didSetTooltip and ( this.money or this.cod ) ) then 
802<       GameTooltip:SetHeight(GameTooltip:GetHeight()+getglobal("GameTooltipTextLeft" .. GameTooltip:NumLines()):GetHeight()) 
803<       if ( GameTooltipMoneyFrame:IsVisible() ) then 
804<           GameTooltip:SetHeight(GameTooltip:GetHeight()+GameTooltipMoneyFrame:GetHeight()) 
805<       end 
806<   end 
807<   GameTooltip:Show() 
808< end 
809--- 
810> SendMailFrame_SendeeAutocomplete = CT_Mail_AutoComplete; -- No need for a before/after hook, since our function does both friends & guildies 
811506,510c380,385 
812< function GMail:TF_Show() 
813<   self.hooks[TradeFrame].OnShow() 
814<   if ( GMail_addItem and not CursorHasItem() and UnitName("NPC") == GMail_addItem[3] ) then 
815<       PickupContainerItem(GMail_addItem[1], GMail_addItem[2]) 
816<       ClickTradeButton(1) 
817--- 
818> function CT_Mail_CanSend(eb) 
819>   if ( not eb ) then eb = this; end 
820>   if ( strlen(eb:GetText()) > 0 and CT_MailFrame.num > 0 and GetSendMailPrice()*CT_MailFrame.num <= GetMoney() ) then 
821>       CT_MailMailButton:Enable(); 
822>   else 
823>       CT_MailMailButton:Disable(); 
824512d386 
825<   GMail_addItem = nil 
826515,597c389,403 
827< function GMail:Inbox_OnUpdate(elapsed) 
828<   if ( GMail_addItem ) then 
829<       GMail_addItem[4] = GMail_addItem[4] - elapsed 
830<       if ( GMail_addItem[4] <= 0 ) then 
831<           GMail_addItem = nil 
832<           for i = 1, NUM_CONTAINER_FRAMES, 1 do 
833<               if ( getglobal("ContainerFrame" .. i):IsVisible() ) then 
834<                   ContainerFrame_Update(getglobal("ContainerFrame" .. i)) 
835<               end 
836<           end 
837<       end 
838<   end 
839<   if ( not this.returnSelected and this.num and this.elapsed ) then 
840<       this.elapsed = this.elapsed - elapsed 
841<       if ( this.elapsed <= 0 ) then 
842<           this.elapsed = nil 
843<           if ( this.id[1] ) then 
844<               local val = this.id[1] 
845<               local success = GMail:PickMail(val, this.openSelected) 
846<               if ( success ~= 2 ) then 
847<                   tremove(this.id, 1) 
848<                   this.num = this.num - 1 
849<               end 
850<               if ( success == 1 ) then 
851<                   for key, va in pairs(this.id) do 
852<                       if ( va > val ) then 
853<                           this.id[key] = va-1 
854<                       end 
855<                   end 
856<                   this.lastVal = val 
857<                   InboxFrame_Update() 
858<               else 
859<                   this.elapsed = 1+GMail_DELETEDELAY 
860<                   this.lastVal = nil 
861<               end 
862<               if ( this.num == 0 ) then 
863<                   this.num = nil 
864<                   GMail:Inbox_DisableClicks(nil) 
865<               end 
866<           end 
867<       end 
868<   end 
869<   if ( this.returnSelected and this.num and this.elapsed ) then 
870<       this.elapsed = this.elapsed - elapsed 
871<       if ( this.elapsed <= 0 ) then 
872<           this.elapsed = nil 
873<           if ( this.id[1] ) then 
874<               local val = this.id[1] 
875<               local success = GMail_Inbox_ReturnMail(val, this.returnSelected) 
876<               if ( success ~= 2 ) then 
877<                   tremove(this.id, 1) 
878<                   this.num = this.num - 1 
879<               end 
880<               if ( success == 1 ) then 
881<                   for key, va in pairs(this.id) do 
882<                       if ( va > val ) then 
883<                           this.id[key] = va-1 
884<                       end 
885<                   end 
886<                   this.lastVal = val 
887<                   InboxFrame_Update() 
888<               else 
889<                   this.elapsed = 1+GMail_DELETEDELAY 
890<                   this.lastVal = nil 
891<               end 
892<               if ( this.num == 0 ) then 
893<                   this.num = nil 
894<                   GMail:Inbox_DisableClicks(nil) 
895<                   this.returnSelected = nil 
896<               end 
897<           end 
898<       end 
899<   end 
900<   if ( this.delete ) then 
901<       this.delete[1] = this.delete[1] - elapsed 
902<       if ( this.delete[1] <= 0 ) then 
903<           local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, itemID, wasRead, wasReturned, textCreated  = GetInboxHeaderInfo(this.delete[2]) 
904<           if ( money == 0 and not itemID ) then 
905<               GetInboxText(this.delete[2]) 
906<               DeleteInboxItem(this.delete[2]) 
907<           end 
908<           this.delete = nil 
909<           this.elapsed = 0.5+GMail_DELETEDELAY 
910--- 
911> function CT_Mail_SendMail() 
912>   for key, val in pairs(this.queue) do 
913>       CT_MailStatusText:SetText(format(CT_MAIL_SENDING, key, this.total)); 
914>       CT_MailAbortButton:Show(); 
915>  
916>       if ( GetSendMailItem() and CT_MailFrame.mailbag and CT_MailFrame.mailitem ) then 
917>           -- There's already an item in the slot 
918>           ClickSendMailItemButton(); 
919>           PickupContainerItem(CT_MailFrame.mailbag, CT_MailFrame.mailitem); 
920>           CT_MailFrame.mailbag = nil; 
921>           CT_MailFrame.mailitem = nil; 
922>       elseif ( CursorHasItem() and CT_MailFrame.bag and CT_MailFrame.item ) then 
923>           PickupContainerItem(CT_MailFrame.bag, CT_MailFrame.item); 
924>           CT_MailFrame.bag = nil; 
925>           CT_MailFrame.item = nil; 
926599,600d404 
927<   end 
928< end 
929602,607c406 
930< function GMail:MAIL_INBOX_UPDATE() 
931<   if ( GMailInboxFrame.eventDelete ) then 
932<       GMailInboxFrame.delete = { GMail_DELETEEVENTDELAY, GMailInboxFrame.eventDelete } 
933<       GMailInboxFrame.eventDelete = nil 
934<   end 
935< end 
936--- 
937>       PickupContainerItem(val.bag, val.item); 
938609,628c408 
939< function GMail:UI_ERROR_MESSAGE() 
940<   if ( event == "UI_ERROR_MESSAGE" and ( arg1 == ERR_INV_FULL or arg1 == ERR_ITEM_MAX_COUNT ) ) then 
941<       if ( this.num ) then 
942<           if ( arg1 == ERR_INV_FULL ) then 
943<               GMail:Inbox_Abort() 
944<               GMail:Print(L["GMail: Inventory full, aborting."], 1, 0, 0) 
945<           elseif ( arg1 == ERR_ITEM_MAX_COUNT ) then 
946<               GMail:Print(L["GMail: You already have the maximum amount of that item, skipping..."], 1, 0, 0) 
947<               this.elapsed = GMail_DELETEDELAY 
948<               if ( this.lastVal ) then 
949<                   for key, va in pairs(this.id) do 
950<                       if ( va >= this.lastVal ) then 
951<                           this.id[key] = va+1 
952<                       end 
953<                   end 
954<               end 
955<           end 
956<       end 
957<   end 
958< end 
959--- 
960>       ClickSendMailItemButton(); 
961630,644c410,413 
962< function GMail:PickMail(id, openSelected) 
963<   if ( not id ) then 
964<       return 0 
965<   end 
966<   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply = GetInboxHeaderInfo(id) 
967<   if ( CODAmount > 0 ) then 
968<       if ( GetLocale() == "koKR" ) then 
969<           GMail:Print(format(GMAIL_OPEN_FORMAT1, this.numMails, this.numMails-(this.num-1)), 1, 0, 0) 
970<       else 
971<           GMail:Print(format(GMAIL_OPEN_FORMAT1, this.numMails-(this.num-1), this.numMails), 1, 0, 0) 
972<       end 
973<       return 0 
974<   elseif ( not hasItem and money == 0 and not openSelected ) then 
975<       if ( GetLocale() == "koKR" ) then 
976<           GMail:Print(format(GMAIL_OPEN_FORMAT2, this.numMails, this.numMails-(this.num-1)), 1, 1, 0) 
977--- 
978>       local name, useless, count = GetSendMailItem(); 
979>  
980>       if ( not name ) then  
981>           DEFAULT_CHAT_FRAME:AddMessage("<CTMod> " .. CT_MAIL_ERROR, 1, 0, 0); 
982646,673d414 
983<           GMail:Print(format(GMAIL_OPEN_FORMAT2, this.numMails-(this.num-1), this.numMails), 1, 1, 0) 
984<       end 
985<       return 0 
986<   end 
987<   if ( GetLocale() == "koKR" ) then 
988<       GMail:Print(format(GMAIL_OPEN_FORMAT3, this.numMails, (sender or GMAIL_UNKNOWNSENDER), (subject or GMAIL_NOSUBJECT), this.numMails-(this.num-1)), 1, 1, 0) 
989<   else 
990<       GMail:Print(format(GMAIL_OPEN_FORMAT3, this.numMails-(this.num-1), this.numMails, (subject or GMAIL_NOSUBJECT), (sender or GMAIL_UNKNOWNSENDER)), 1, 1, 0) 
991<   end 
992<   local eventDelete 
993<   if ( hasItem ) then 
994<       TakeInboxItem(id) 
995<       eventDelete = 1 
996<       if ( money > 0 ) then 
997<           return 2 
998<       end 
999<   end 
1000<   if ( money > 0 ) then 
1001<       TakeInboxMoney(id) 
1002<       eventDelete = 1 
1003<   end 
1004<   if ( eventDelete ) then 
1005<       GMailInboxFrame.eventDelete = id 
1006<   else 
1007<       GMailInboxFrame.delete = { GMail_DELETEDELAY, id } 
1008<   end 
1009<   return 1 
1010< end 
1011675,681c416,418 
1012< function GMail_Inbox_SetSelected() 
1013<   local id = this:GetID() + (InboxFrame.pageNum-1)*7 
1014<   if ( not this:GetChecked() ) then 
1015<       for k, v in pairs(GMail_SelectedItems) do 
1016<           if ( v == id ) then 
1017<               tremove(GMail_SelectedItems, k) 
1018<               break 
1019--- 
1020>           local subjectstr = CT_MailSubjectEditBox:GetText(); 
1021>           if ( strlen(subjectstr) > 0 ) then 
1022>               subjectstr = subjectstr .. " "; 
1023683,687d419 
1024<       end 
1025<   else 
1026<       tinsert(GMail_SelectedItems, id) 
1027<   end 
1028< end 
1029689,708c421,425 
1030< function GMail_Inbox_OpenSelected(openAll) 
1031<   GMail:Inbox_DisableClicks(1) 
1032<   GMailInboxFrame.num = 0 
1033<   GMailInboxFrame.elapsed = GMail_DELETEDELAY 
1034<   GMailInboxFrame.id = { } 
1035<   GMailInboxFrame.openSelected = not openAll 
1036<   if ( openAll ) then 
1037<       for i = 1, GetInboxNumItems(), 1 do 
1038<           GMailInboxFrame.num = GMailInboxFrame.num + 1 
1039<           tinsert(GMailInboxFrame.id, i) 
1040<       end 
1041<   else 
1042<       for k, v in pairs(GMail_SelectedItems) do 
1043<           GMailInboxFrame.num = GMailInboxFrame.num + 1 
1044<           tinsert(GMailInboxFrame.id, v) 
1045<       end 
1046<   end 
1047<   GMailInboxFrame.numMails = GMailInboxFrame.num 
1048<   GMail_SelectedItems = { } 
1049< end 
1050--- 
1051>           if ( count > 1 ) then 
1052>               subjectstr = subjectstr .. "[" .. name .. " x" .. count .. "]"; 
1053>           else 
1054>               subjectstr = subjectstr .. "[" .. name .. "]"; 
1055>           end 
1056710,714c427,428 
1057< function GMail_Inbox_ReturnMail(id, returnSelected) 
1058<   if ( not id ) then 
1059<       return 0 
1060<   end 
1061<   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply = GetInboxHeaderInfo(id) 
1062--- 
1063>           SendMail(val.to, subjectstr, ""); 
1064>       end 
1065716,721c430,431 
1066<   if ( GetLocale() == "koKR" ) then 
1067<       curmail =  
1068<       GMail:Print(format(GMAIL_RETURN_FORMAT, this.numMails, (sender or GMAIL_UNKNOWNSENDER), (subject or GMAIL_NOSUBJECT), this.numMails-(this.num-1)), 1, 1, 0) 
1069<   else 
1070<       curmail =  
1071<       GMail:Print(format(GMAIL_RETURN_FORMAT, this.numMails-(this.num-1), this.numMails, (subject or GMAIL_NOSUBJECT), (sender or GMAIL_UNKNOWNSENDER)), 1, 1, 0) 
1072--- 
1073>       CT_MailGlobalFrame.queue[key] = nil; 
1074>       return; 
1075722a433,435 
1076>   CT_MailStatusText:SetText(format(CT_MAIL_DONESENDING, this.total)); 
1077>   CT_MailAbortButton:Hide(); 
1078>   CT_MailGlobalFrame:Hide(); 
1079724,733c437,438 
1080<   local eventDelete 
1081<  
1082<   ReturnInboxItem(id) 
1083<  
1084<   if ( eventDelete ) then 
1085<       GMailInboxFrame.eventDelete = id 
1086<   else 
1087<       GMailInboxFrame.delete = { GMail_DELETEDELAY, id } 
1088<   end 
1089<   return 1 
1090--- 
1091>   CT_MailGlobalFrame.total = 0; 
1092>   CT_MailGlobalFrame.queue = { }; 
1093736,764c441,446 
1094< function GMail_Inbox_ReturnSelected() 
1095<   GMail:Inbox_DisableClicks(1) 
1096<   GMailInboxFrame.num = 0 
1097<   GMailInboxFrame.elapsed = GMail_DELETEDELAY 
1098<   GMailInboxFrame.id = { } 
1099<   GMailInboxFrame.returnSelected = 1 
1100<   for k, v in pairs(GMail_SelectedItems) do 
1101<       GMailInboxFrame.num = GMailInboxFrame.num + 1 
1102<       tinsert(GMailInboxFrame.id, v) 
1103<   end 
1104<   GMailInboxFrame.numMails = GMailInboxFrame.num 
1105<   GMail_SelectedItems = { } 
1106< end 
1107<  
1108< function GMail:InboxFrame_Update() 
1109<   self.hooks["InboxFrame_Update"]() 
1110<   for i = 1, 7, 1 do 
1111<       local index = (i + (InboxFrame.pageNum-1)*7) 
1112<       if ( index > GetInboxNumItems() ) then 
1113<           getglobal("GMailBoxItem" .. i .. "CB"):Hide() 
1114<       else 
1115<           getglobal("GMailBoxItem" .. i .. "CB"):Show() 
1116<           getglobal("GMailBoxItem" .. i .. "CB"):SetChecked(nil) 
1117<           for k, v in pairs(GMail_SelectedItems) do 
1118<               if ( v == index ) then 
1119<                   getglobal("GMailBoxItem" .. i .. "CB"):SetChecked(1) 
1120<                   break 
1121<               end 
1122<           end 
1123--- 
1124> function CT_Mail_FillItemTable() 
1125>   local arr = { }; 
1126>   for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
1127>       local btn = getglobal("CT_MailButton" .. i); 
1128>       if ( btn.item and btn.bag ) then 
1129>           tinsert(arr, { ["item"] = btn.item, ["bag"] = btn.bag, ["to"] = CT_MailNameEditBox:GetText() }); 
1130767,769c449 
1131<   if ( GMailInboxFrame.num ) then 
1132<       GMail:Inbox_DisableClicks(1, 1) 
1133<   end 
1134--- 
1135>   return arr; 
1136772,783c452,461 
1137< function GMail:Inbox_DisableClicks(disable, loopPrevention) 
1138<   if ( disable ) then 
1139<       for i = 1, 7, 1 do 
1140<           getglobal("MailItem" .. i .. "ButtonIcon"):SetDesaturated(1) 
1141<       end 
1142<       if not self:IsHooked("InboxFrame_OnClick") then self:Hook("InboxFrame_OnClick", "DummyFunction", true) end 
1143<   else 
1144<       for i = 1, 7, 1 do 
1145<           getglobal("MailItem" .. i .. "ButtonIcon"):SetDesaturated(nil) 
1146<       end 
1147<       if ( not loopPrevention ) then 
1148<           InboxFrame_Update() 
1149--- 
1150> function CT_Mail_ProcessQueue(elapsed) 
1151>   if ( not CT_Mail_CanSendNext ) then 
1152>       return; 
1153>   end 
1154>   this.sendmail = this.sendmail + elapsed; 
1155>   if ( this.sendmail > 0.5 ) then 
1156>       this.sendmail = 0; 
1157>       if ( this.total > 0 ) then 
1158>           CT_Mail_SendMail(); 
1159>           CT_Mail_CanSendNext = nil; 
1160785d462 
1161<       if self:IsHooked("InboxFrame_OnClick") then self:Unhook("InboxFrame_OnClick") end 
1162789,800c466 
1163< function GMail:InboxFrame_OnClick() 
1164<   this:SetChecked(nil) 
1165< end 
1166<  
1167< function GMail:Inbox_Abort() 
1168<   GMailInboxFrame.num = nil 
1169<   GMailInboxFrame.elapsed = nil 
1170<   GMailInboxFrame.id = { } 
1171<   GMail_SelectedItems = { } 
1172<   GMail:Inbox_DisableClicks() 
1173<   HideUIPanel(GMailInboxOpenAll) 
1174< end 
1175--- 
1176> local CT_oldMM_CF_U = ContainerFrame_Update 
1177802,805c468,469 
1178< function GMail:CloseMail() 
1179<   self.hooks["CloseMail"]() 
1180<   GMail:Inbox_Abort() 
1181< end 
1182--- 
1183> function CT_Mail_ContainerFrame_Update(frame) 
1184>   CT_oldMM_CF_U(frame); 
1185807,810c471,481 
1186< function GMail:TakeInboxItem(id) 
1187<   local name = GetInboxItem(id) 
1188<   if name then 
1189<       tinsert(GMailForwardFrame.pickItem, name) 
1190--- 
1191>   local id = frame:GetID(); 
1192>   if ( CT_MailFrame:IsVisible() ) then 
1193>       local i; 
1194>       for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do 
1195>           local btn = getglobal("CT_MailButton" .. i); 
1196>           if ( btn.item and btn.bag ) then 
1197>               if ( btn.bag == frame:GetID() ) then 
1198>                   SetItemButtonDesaturated(getglobal(frame:GetName() .. "Item" .. (frame.size-btn.item)+1), 1, 0.5, 0.5, 0.5); 
1199>               end 
1200>           end 
1201>       end 
1202812,825c483,485 
1203<   self.hooks["TakeInboxItem"](id) 
1204< end 
1205<  
1206< function GMail:DisableAttachments(disable) 
1207<   if ( disable ) then 
1208<       OpenMailMoneyButtonIconTexture:SetDesaturated(1) 
1209<       OpenMailPackageButtonIconTexture:SetDesaturated(1) 
1210<       if not self:IsHooked(OpenMailMoneyButton, "OnClick") then self:HookScript(OpenMailMoneyButton, "OnClick", "DummyFunction") end 
1211<       if not self:IsHooked(OpenMailPackageButton, "OnClick") then self:HookScript(OpenMailPackageButton, "OnClick", "DummyFunction") end 
1212<   else 
1213<       OpenMailMoneyButtonIconTexture:SetDesaturated(nil) 
1214<       OpenMailPackageButtonIconTexture:SetDesaturated(nil) 
1215<       if self:IsHooked(OpenMailMoneyButton, "OnClick") then self:Unhook(OpenMailMoneyButton, "OnClick") end 
1216<       if self:IsHooked(OpenMailPackageButton, "OnClick") then self:Unhook(OpenMailPackageButton, "OnClick") end 
1217--- 
1218>    
1219>   if ( CT_Mail_addItem and CT_Mail_addItem[1] == frame:GetID() ) then 
1220>       SetItemButtonDesaturated(getglobal(frame:GetName() .. "Item" .. (frame.size-CT_Mail_addItem[2])+1), 1, 0.5, 0.5, 0.5); 
1221827d486 
1222< end 
1223829d487 
1224< function GMail:DummyFunction() 
1225832,837c490 
1226< function GMail:OpenMail_Reply() 
1227<   self.hooks["OpenMail_Reply"]() 
1228<   SendMailMoneyCopper:SetText("") 
1229<   SendMailMoneySilver:SetText("") 
1230<   SendMailMoneyGold:SetText("") 
1231< end 
1232--- 
1233> ContainerFrame_Update = CT_Mail_ContainerFrame_Update; 
1234838a492,494 
1235> function CT_Mail_AddSubject() 
1236>   if ( not SendMailFrame:IsVisible() ) then return; end 
1237>   local name, useless, count = GetSendMailItem(); 
1238840,886c496,498 
1239< function GMail:OpenReply() 
1240<   OpenMail_Reply() 
1241<   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply = GetInboxHeaderInfo(InboxFrame.openMailID) 
1242<   local gold, silver, copper = "", "", "" 
1243<   if ( money and money > 0 ) then 
1244<       gold = floor(money / (COPPER_PER_SILVER * SILVER_PER_GOLD)) 
1245<       silver = floor((money - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER) 
1246<       copper = mod(money, COPPER_PER_SILVER) 
1247<   end 
1248<   SendMailMoneyCopper:SetText(copper) 
1249<   SendMailMoneySilver:SetText(silver) 
1250<   SendMailMoneyGold:SetText(gold) 
1251<   local name, itemTexture, count, quality, canUse = GetInboxItem(InboxFrame.openMailID) 
1252<   SendMailPackageButton:SetNormalTexture(itemTexture) 
1253<   if ( count > 1 ) then 
1254<       SendMailPackageButtonCount:SetText(count) 
1255<   else 
1256<       SendMailPackageButtonCount:SetText("") 
1257<   end 
1258<   SendMailNameEditBox:SetText("") 
1259<   local subject = OpenMailSubject:GetText() 
1260<   local prefix = GetLocale() == "koKR" and "´äÃ~@Ã¥:".." " or "FW:".." " 
1261<   if ( strsub(subject, 1, strlen(prefix)) ~= prefix ) then 
1262<       subject = prefix..subject 
1263<   end 
1264<   SendMailSubjectEditBox:SetText(subject or "") 
1265<   SendMailBodyEditBox:SetText(string.gsub(OpenMailBodyText:GetText() or "", "\n", "\n>")) 
1266<   SendMailNameEditBox:SetFocus() 
1267<   SendMailFrame.sendMode = "reply" 
1268<   self:Forward_EnableForward(1) 
1269< end 
1270<  
1271< function GMail:SendMailMailButton_OnClick() 
1272<   local name, itemTexture, count, quality, canUse = GetInboxItem(InboxFrame.openMailID) 
1273<   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply = GetInboxHeaderInfo(InboxFrame.openMailID) 
1274<   if ( name ) then 
1275<       GMailForwardFrame.searchItem = name 
1276<       GMailForwardFrame.forwardStep = 1 
1277<       self.hooks["TakeInboxItem"](InboxFrame.openMailID) 
1278<   else 
1279<       GMailForwardFrame.forwardStep = 2 
1280<       if ( money and money > 0 ) then 
1281<           SetSendMailMoney(money) 
1282<           GMailForwardFrame.countDown = 2 
1283<           oldTakeInboxMoney(InboxFrame.openMailID) 
1284<       else 
1285<           GMailForwardFrame.countDown = 0.5 
1286--- 
1287>   if ( name and strlen(SendMailSubjectEditBox:GetText()) == 0 ) then 
1288>       if ( count > 1 ) then 
1289>           name = name .. " x" .. count; 
1290887a500 
1291>       SendMailSubjectEditBox:SetText(name); 
1292889d501 
1293<   SendMailMailButton:Disable() 
1294892,919c504,509 
1295< function GMail:Forward_OnUpdate(elapsed) 
1296<   if ( this.forwardStep and this.forwardStep > 1 ) then 
1297<       if ( this.countDown ) then 
1298<           this.countDown = this.countDown - elapsed 
1299<           if ( this.countDown <= 0 ) then 
1300<               if ( this.forwardStep == 2 ) then 
1301<                   this.countDown = 0.5 
1302<                   this.forwardStep = 3 
1303<                   SendMail(SendMailNameEditBox:GetText(), SendMailSubjectEditBox:GetText(), SendMailBodyEditBox:GetText()) 
1304<                   SendMailMailButton:Disable() 
1305<               elseif ( this.forwardStep == 3 ) then 
1306<                   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, itemID, wasRead, wasReturned, textCreated  = GetInboxHeaderInfo(InboxFrame.openMailID) 
1307<                   if ( money == 0 and not itemID ) then 
1308<                       DeleteInboxItem(InboxFrame.openMailID) 
1309<                   end 
1310<                   self:MailFrameTab_OnClick(1) 
1311<                   HideUIPanel(OpenMailFrame) 
1312<                   this.countDown = nil 
1313<                   this.forwardStep = nil 
1314<               end 
1315<           end 
1316<       end 
1317<   end 
1318<   this.process = this.process - elapsed 
1319<   if ( this.process <= 0 ) then 
1320<       this.process = 3 
1321<       if ( getn(GMail_ScheduledStack) > 0 ) then 
1322<           self:ProcessStack() 
1323--- 
1324> local oldValue; 
1325> function CT_Mail_BlockTrade(block) 
1326>   if ( not module:getOption("blockTrades") ) then 
1327>       if ( oldValue ) then 
1328>           SetCVar("blockTrades", oldValue); 
1329>           oldValue = nil; 
1330920a511 
1331>       return; 
1332922,930c513,517 
1333< end 
1334<  
1335< function GMail:InboxFrame_OnClick(id) 
1336<   self.hooks["InboxFrame_OnClick"](id) 
1337<   local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, itemID, wasRead, wasReturned, textCreated  = GetInboxHeaderInfo(id) 
1338<   if ( CODAmount and CODAmount > 0 ) then 
1339<       OpenMailForwardButton:Disable() 
1340<   else 
1341<       OpenMailForwardButton:Enable() 
1342--- 
1343>   if ( block ) then 
1344>       oldValue = GetCVar("blockTrades"); 
1345>       SetCVar("blockTrades", 1); 
1346>   elseif ( oldValue ) then 
1347>       SetCVar("blockTrades", oldValue); 
1348934,941c521,527 
1349< function GMail:Forward_EnableForward(enable) 
1350<   if ( enable ) then 
1351<       OpenMailForwardButton:Disable() 
1352<       if not self:IsHooked(SendMailPackageButton, "OnEnter") then self:HookScript(SendMailPackageButton, "OnEnter", "SMPBOE") end 
1353<       SendMailCODButton:Disable() 
1354<       self:DisableAttachments(1) 
1355<       if not self:IsHooked("SendMailMailButton_OnClick") then self:Hook("SendMailMailButton_OnClick", true) end 
1356<       if not self:IsHooked("SendMailPackageButton_OnClick") then self:Hook("SendMailPackageButton_OnClick", true) end 
1357--- 
1358> function CT_Mail_OnEvent(event) 
1359>   if ( event == "MAIL_SEND_SUCCESS" ) then 
1360>       CT_Mail_CanSendNext = 1; 
1361>   elseif ( event == "MAIL_SHOW" ) then 
1362>       CT_Mail_BlockTrade(true); 
1363>   elseif ( event == "MAIL_CLOSED" ) then 
1364>       CT_Mail_BlockTrade(false); 
1365943,948c529 
1366<       OpenMailForwardButton:Enable() 
1367<       if self:IsHooked(SendMailPackageButton, "OnEnter") then self:Unhook(SendMailPackageButton, "OnEnter") end 
1368<       SendMailCODButton:Enable() 
1369<       self:DisableAttachments(nil) 
1370<       if self:IsHooked("SendMailMailButton_OnClick") then self:Unhook("SendMailMailButton_OnClick") end 
1371<       if self:IsHooked("SendMailPackageButton_OnClick") then self:Unhook("SendMailPackageButton_OnClick") end 
1372--- 
1373>       CT_Mail_AddSubject(); 
1374952,1021c533,541 
1375< function GMail:SMPBOE() 
1376<   GameTooltip:SetOwner(SendMailPackageButton, "ANCHOR_RIGHT") 
1377<   GameTooltip:SetInboxItem(InboxFrame.openMailID) 
1378< end 
1379< function GMail:SendMailPackageButton_OnClick() 
1380< end 
1381<  
1382< function GMail:Forward_AttachSlot(container, item) 
1383<   PickupContainerItem(container, item) 
1384<   ClickSendMailItemButton() 
1385<   GMailForwardFrame.searchItem = nil 
1386<   GMailForwardFrame.forwardStep = 2 
1387<   GMailForwardFrame.countDown = 1.5 
1388< end 
1389<  
1390< function GMail:BAG_UPDATE() 
1391<   local old = { } 
1392<   for k, v in pairs(GMail_BagLinks) do 
1393<       if ( type(v) == "table" ) then 
1394<           old[k] = { } 
1395<           for key, val in pairs(v) do 
1396<               old[k][key] = val 
1397<           end 
1398<       end 
1399<   end 
1400<   GMail_BagLinks = { } 
1401<   for i = 0, 4, 1 do 
1402<       GMail_BagLinks[i] = { } 
1403<       for y = 1, GetContainerNumSlots(i), 1 do 
1404<           local curr = GetContainerItemLink(i, y) 
1405<           local _, _, name = string.find(( curr or "" ), "%[(.+)%]") 
1406<           if ( name ) then 
1407<               if ( GMailForwardFrame.searchItem ) then 
1408<                   if ( name and name == GMailForwardFrame.searchItem and (not old[i] or not old[i][y])) then 
1409<                       self:Forward_AttachSlot(i, y) 
1410<                   end 
1411<               else 
1412<                   local _, _, name = string.find(( curr or "" ), "%[(.+)%]") 
1413<                   if ( name and name == GMailForwardFrame.pickItem[1] and (not old[i] or not old[i][y])) then 
1414<                       tremove(GMailForwardFrame.pickItem, 1) 
1415<                       for k, v in pairs(old) do 
1416<                           local hasFound 
1417<                           for key, val in pairs(v) do 
1418<                               if ( val == name and ( k ~= i or key ~= y ) ) then 
1419<                                   local _,_, link = string.find((GetContainerItemLink(k, key) or ""), "(item:[%d:]+)") 
1420<                                   if ( link ) then 
1421<                                       local texture, itemCount = GetContainerItemInfo(k,key) 
1422<                                       local tex, iC = GetContainerItemInfo(i, y) 
1423<                                       local sName, sLink, iQuality, iLevel, _, sType, sSubType, iCount = GetItemInfo(link) 
1424<                                       if ( sName and itemCount and iCount and iC ) then 
1425<                                           if ( iCount >= (itemCount+iC) ) then 
1426<                                               if ( getn(GMail_ScheduledStack) == 0 ) then 
1427<                                                   GMailForwardFrame.process = 2 
1428<                                               end 
1429<                                               tinsert(GMail_ScheduledStack, { i, y, k, key }) 
1430<                                               hasFound = 1 
1431<                                               break 
1432<                                           end 
1433<                                       end 
1434<                                   end 
1435<                               end 
1436<                           end 
1437<                           if ( hasFound ) then 
1438<                               break 
1439<                           end 
1440<                       end 
1441<                   end 
1442<               end 
1443<               GMail_BagLinks[i][y] = name 
1444<           end 
1445--- 
1446> -- Show item link if there is one 
1447> CT_Mail_oldInboxFrameItem_OnEnter = InboxFrameItem_OnEnter; 
1448> function CT_Mail_newInboxFrameItem_OnEnter() 
1449>   local didSetTooltip; 
1450>   if ( this.index ) then 
1451>       if ( GetInboxItem(this.index) ) then 
1452>           GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); 
1453>           GameTooltip:SetInboxItem(this.index); 
1454>           didSetTooltip = 1; 
14551024,1036c544,545 
1456< end 
1457<  
1458<  
1459< function GMail:ProcessStack() 
1460<   local val = tremove(GMail_ScheduledStack, 1) 
1461<   PickupContainerItem(val[1], val[2]) 
1462<   PickupContainerItem(val[3], val[4]) 
1463< end 
1464<  
1465< local oldSMMFfunc = SendMailMoneyFrame.onvalueChangedFunc 
1466< SendMailMoneyFrame.onvalueChangedFunc = function() 
1467<   if ( oldSMMFfunc ) then 
1468<       oldSMMFfunc() 
1469--- 
1470>   if ( not didSetTooltip ) then 
1471>       GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); 
14721038,1045c547,557 
1473<   local subject = SendMailSubjectEditBox:GetText() 
1474<   if ( subject == "" or string.find(subject, "%[%d+G, %d+S, %d+C%]") ) then 
1475<       local copper, silver, gold = SendMailMoneyFrameCopper:GetText(), SendMailMoneyFrameSilver:GetText(), SendMailMoneyFrameGold:GetText() 
1476<       if ( not tonumber(copper) ) then 
1477<           copper = 0 
1478<       end 
1479<       if ( not tonumber(silver) ) then 
1480<           silver = 0 
1481--- 
1482>   if (this.money) then 
1483>       GameTooltip:AddLine(ENCLOSED_MONEY, "", 1, 1, 1); 
1484>       SetTooltipMoney(GameTooltip, this.money); 
1485>       SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); 
1486>   elseif (this.cod) then 
1487>       GameTooltip:AddLine(COD_AMOUNT, "", 1, 1, 1); 
1488>       SetTooltipMoney(GameTooltip, this.cod); 
1489>       if ( this.cod > GetMoney() ) then 
1490>           SetMoneyFrameColor("GameTooltipMoneyFrame", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); 
1491>       else 
1492>           SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); 
14931047,1048c559,563 
1494<       if ( not tonumber(gold) ) then 
1495<           gold = 0 
1496--- 
1497>   end 
1498>   if ( didSetTooltip and ( this.money or this.cod ) ) then 
1499>       GameTooltip:SetHeight(GameTooltip:GetHeight()+getglobal("GameTooltipTextLeft" .. GameTooltip:NumLines()):GetHeight()); 
1500>       if ( GameTooltipMoneyFrame:IsVisible() ) then 
1501>           GameTooltip:SetHeight(GameTooltip:GetHeight()+GameTooltipMoneyFrame:GetHeight()); 
15021050d564 
1503<       SendMailSubjectEditBox:SetText(format("[%sG, %sS, %sC]", gold, silver, copper)) 
15041051a566 
1505>   GameTooltip:Show(); 
15061052a568 
1507> InboxFrameItem_OnEnter = CT_Mail_newInboxFrameItem_OnEnter; 
15081054,1055c570,578 
1509< function GMail:Print(msg, r, g, b) 
1510<   DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b) 
1511--- 
1512> -- Hook the TradeFrame OnShow 
1513> CT_Mail_oldTradeFrameShow = TradeFrame:GetScript("OnShow"); 
1514> function CT_Mail_newTradeFrameShow() 
1515>   CT_Mail_oldTradeFrameShow(); 
1516>   if ( CT_Mail_addItem and not CursorHasItem() and UnitName("NPC") == CT_Mail_addItem[3] ) then 
1517>       PickupContainerItem(CT_Mail_addItem[1], CT_Mail_addItem[2]); 
1518>       ClickTradeButton(1); 
1519>   end 
1520>   CT_Mail_addItem = nil; 
15211057c580 
1522<  
1523--- 
1524> TradeFrame:SetScript("OnShow", CT_Mail_newTradeFrameShow); 
1525\ No newline at end of file 
1526 
Download and save
Toggle line numbers
Thread:
[3868] Gmail-r-21690 and CT_MailMod.diff by evl at 2006-12-21 14:24:51
  [8120] Re: Gmail-r-21690 and CT_MailMod.diff by Anonymous at 2007-03-11 03:43:30 (diff)
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject: