From 34a70d3e46e6b4947df0c4d3cfaa3faabae6e738 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 14 Apr 2010 19:06:37 +0200 Subject: Port some mailsending-fixes from MaNGOS - prevents copying maildata/text into new mails Original fix by Vladimir --HG-- branch : trunk --- src/game/AuctionHouseHandler.cpp | 6 +++--- src/game/AuctionHouseMgr.cpp | 8 ++++---- src/game/Mail.cpp | 2 +- src/game/Mail.h | 4 ++-- src/game/Player.cpp | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 2a2308019fd..c2c54139be8 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -138,7 +138,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body .AddMoney(auction->bid) - .SendMailTo(MailReceiver(oldBidder, auction->bidder), auction); + .SendMailTo(MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } } @@ -160,7 +160,7 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction) MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body .AddMoney(auction->bid) - .SendMailTo(MailReceiver(bidder, auction->bidder), auction); + .SendMailTo(MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } } @@ -464,7 +464,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) // item will deleted or added to received mail list MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body .AddItem(pItem) - .SendMailTo(pl, auction); + .SendMailTo(pl, auction, MAIL_CHECK_MASK_COPIED); } else { diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index f5b3a960ffb..95b388b6c1a 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -156,7 +156,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str()) .AddItem(pItem) - .SendMailTo(MailReceiver(bidder,auction->bidder), MailSender(auction), MAIL_CHECK_MASK_NONE); + .SendMailTo(MailReceiver(bidder,auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } } @@ -185,7 +185,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction) sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str()) - .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_NONE); + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED); } } @@ -222,7 +222,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) } MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str()) .AddMoney(profit) - .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_NONE, sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY)); + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY)); } } @@ -247,7 +247,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction) MailDraft(subject.str(), "") // TODO: fix body .AddItem(pItem) - .SendMailTo(MailReceiver(owner,auction->owner), auction); + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED); } } diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 14096fa796f..cb4c464af6a 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -274,7 +274,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) draft .AddMoney(money) .AddCOD(COD) - .SendMailTo(MailReceiver(receive, GUID_LOPART(rc)), MailSender(pl), body.empty() ? MailCheckMask(MAIL_CHECK_MASK_NONE | MAIL_CHECK_MASK_COPIED) : MAIL_CHECK_MASK_HAS_BODY, deliver_delay); + .SendMailTo(MailReceiver(receive, GUID_LOPART(rc)), pl, body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay); CharacterDatabase.BeginTransaction(); pl->SaveInventoryAndGoldToDB(); diff --git a/src/game/Mail.h b/src/game/Mail.h index 7a28787fec5..b0103897864 100644 --- a/src/game/Mail.h +++ b/src/game/Mail.h @@ -44,8 +44,8 @@ enum MailCheckMask { MAIL_CHECK_MASK_NONE = 0x00, MAIL_CHECK_MASK_READ = 0x01, - MAIL_CHECK_MASK_RETURNED = 0x02, /// This mail was returned. - MAIL_CHECK_MASK_COPIED = 0x04, /// This mail was copied. + MAIL_CHECK_MASK_RETURNED = 0x02, /// This mail was returned. Do not allow returning mail back again. + MAIL_CHECK_MASK_COPIED = 0x04, /// This mail was copied. Do not allow making a copy of items in mail. MAIL_CHECK_MASK_COD_PAYMENT = 0x08, MAIL_CHECK_MASK_HAS_BODY = 0x10, /// This mail has body text. }; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8441dd31fa5..10aac3aa60b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14118,7 +14118,7 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver, // Send reward mail if (uint32 mail_template_id = pQuest->GetRewMailTemplateId()) - MailDraft(mail_template_id).SendMailTo(MailReceiver(this), MailSender(questGiver), MAIL_CHECK_MASK_HAS_BODY, pQuest->GetRewMailDelaySecs()); + MailDraft(mail_template_id).SendMailTo(this, questGiver, MAIL_CHECK_MASK_HAS_BODY, pQuest->GetRewMailDelaySecs()); if (pQuest->IsDaily()) { @@ -16548,7 +16548,7 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff) draft.AddItem(item); } - draft.SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM)); + draft.SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED); } } //if (isAlive()) @@ -21139,7 +21139,7 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) CharacterDatabase.CommitTransaction(); std::string subject = GetSession()->GetTrinityString(LANG_NOT_EQUIPPED_ITEM); - MailDraft(subject, "There's were problems with equipping this item.").AddItem(offItem).SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM)); + MailDraft(subject, "There were problems with equipping one or several items").AddItem(offItem).SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED); } } -- cgit v1.2.3