From c64a2e8c84eb16f6340747fadb0312af68866938 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 12 Apr 2010 05:04:05 +0400 Subject: [PATCH] [9730] Mail send related fixes in recent code. * Avoid use explicit MailReciever/MailSender where not need. Types specially added for autoconvertion from common cases. * Prevent allow copy text auction mails. It anyway store encoded data. Same for some another non-player mails. --- 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 +++--- src/shared/revision_nr.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 75b9a2972..8f890065e 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -127,7 +127,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); } } @@ -149,7 +149,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); } } @@ -455,7 +455,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 20b4429da..802b0c5dd 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -152,7 +152,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction ) // will delete item or place to receiver mail list 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); } // receiver not exist else @@ -188,7 +188,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); } } @@ -231,7 +231,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction ) MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str()) .AddMoney(profit) - .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_NONE, HOUR); + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED, HOUR); } } @@ -266,7 +266,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction ) // will delete item or place to receiver mail list MailDraft(subject.str(), "") // TODO: fix body .AddItem(pItem) - .SendMailTo(MailReceiver(owner,auction->owner), auction); + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED); } // owner not found else diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 66dc5fa31..a3f8c6c6e 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -273,7 +273,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 8372ceb4d..da135e241 100644 --- a/src/game/Mail.h +++ b/src/game/Mail.h @@ -62,8 +62,8 @@ enum MailCheckMask { MAIL_CHECK_MASK_NONE = 0x00, /// Nothing. MAIL_CHECK_MASK_READ = 0x01, /// This mail was read. - 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. No allow return mail. + MAIL_CHECK_MASK_COPIED = 0x04, /// This mail was copied. No allow make item copy from mail text. MAIL_CHECK_MASK_COD_PAYMENT = 0x08, /// This mail is payable on delivery. MAIL_CHECK_MASK_HAS_BODY = 0x10, /// This mail has body text. }; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f5941b844..33875a162 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13459,7 +13459,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()) { @@ -15737,7 +15737,7 @@ void Player::_LoadInventory(QueryResult *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()) @@ -19899,7 +19899,7 @@ void Player::AutoUnequipOffhandIfNeed() CharacterDatabase.CommitTransaction(); std::string subject = GetSession()->GetMangosString(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's were problems with equipping this item.").AddItem(offItem).SendMailTo(this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED); } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1883d7c1d..0965a6bb4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9729" + #define REVISION_NR "9730" #endif // __REVISION_NR_H__