Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function MassMail()
- if not mailFrame then
- mailFrame = AceGUI:Create("Window");
- mailFrame:SetTitle("Ravencrest Union Mailing");
- mailFrame:SetStatusText("")
- mailFrame:SetWidth(600);
- mailFrame:SetLayout("Flow")
- core:setEscapeHandler(mailFrame,function()
- mailFrame:Hide();
- mailFrame = false
- end)
- mailEditBox = AceGUI:Create("MultiLineEditBox");
- mailEditBox:SetFullWidth(true)
- mailEditBox:SetNumLines(28);
- mailEditBox:SetLabel("Syntax: Name:Amount | Each line represents a mail!")
- mailEditBox:DisableButton(true)
- local send_mail_button = CreateFrame('Button', 'PostmasterGeneralButton', mailEditBox, 'UIPanelButtonTemplate')
- send_mail_button:SetPoint('BOTTOMRIGHT', -46, 70)
- send_mail_button:SetText("Send Mails")
- send_mail_button:SetWidth(send_mail_button:GetFontString():GetWidth() + 20)
- send_mail_button:SetHeight(19)
- send_mail_button:SetScript('OnClick', function(self) -- begin scanning
- print("Click")
- normalize_text(text)
- local tosend = {};
- for name, amount in text:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
- table.insert(mails,name..":"..amount)
- tosend.Subject = subject;
- tosend.Gold = amount;
- tosend.InOut = "Sent";
- tosend.Location = GetRealZoneText();
- tosend.From = GetUnitName ("player").."-"..GetRealmName();
- tosend.Recipient = name.."-"..GetRealmName();
- tosend.Timestamp = ActiveTrade.Timestamp;
- --table.insert(mails,tosend)
- print(dump(mails));
- end
- local test = tostring(mails[1])
- for name, amount in test:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
- core:send_mail(name,amount,"RCU Test");
- end
- table.remove(mails,1);
- end)
- mailFrame:AddChild(mailEditBox);
- mailFrame:Show();
- else
- mailFrame:Hide();
- mailFrame = false
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement