[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.
This commit is contained in:
VladimirMangos 2010-04-12 05:04:05 +04:00
parent 9304d7509d
commit c64a2e8c84
6 changed files with 14 additions and 14 deletions

View file

@ -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
{

View file

@ -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

View file

@ -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();

View file

@ -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.
};

View file

@ -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);
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9729"
#define REVISION_NR "9730"
#endif // __REVISION_NR_H__