diff options
author | megamage <none@none> | 2009-09-01 17:09:39 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-09-01 17:09:39 -0500 |
commit | 176a710e72b6e9c81e6b84967faae17d9f84f3af (patch) | |
tree | 6cce15b108373c70a1a4fb549c10b4de280e8c84 | |
parent | 28e229d8a894619629e8c5bd745fcc274b417729 (diff) |
[8442] Fixed displaying return button in mails Author: arrai
--HG--
branch : trunk
-rw-r--r-- | src/game/Mail.cpp | 21 | ||||
-rw-r--r-- | src/shared/Database/Database.cpp | 39 | ||||
-rw-r--r-- | src/shared/Database/Database.h | 1 |
3 files changed, 51 insertions, 10 deletions
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index d50a1715952..d0e75f425ab 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -37,8 +37,8 @@ enum MailShowFlags MAIL_SHOW_UNK0 = 0x0001, MAIL_SHOW_DELETE = 0x0002, // forced show delete button instead return button MAIL_SHOW_AUCTION = 0x0004, // from old comment - MAIL_SHOW_COD = 0x0008, // show subject prefix - MAIL_SHOW_UNK4 = 0x0010, + MAIL_SHOW_UNK2 = 0x0008, // unknown, COD will be shown even without that flag + MAIL_SHOW_RETURN = 0x0010, }; void MailItem::deleteItem( bool inDB ) @@ -321,14 +321,15 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data ) Mail *m = _player->GetMail(mailId); if(m) { - if (m->COD > 0) + // delete shouldn't show up for COD mails + if (m->COD) + { + pl->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR); return; - m->state = MAIL_STATE_DELETED; - } - - Player* pl = _player; - pl->m_mailsUpdated = true; + } + m->state = MAIL_STATE_DELETED; + } pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK); } @@ -605,8 +606,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) show_flags |= MAIL_SHOW_DELETE; if ((*itr)->messageType == MAIL_AUCTION) show_flags |= MAIL_SHOW_AUCTION; - if ((*itr)->COD) - show_flags |= MAIL_SHOW_COD; + if ((*itr)->HasItems() && (*itr)->messageType == MAIL_NORMAL) + show_flags |= MAIL_SHOW_RETURN; data << (uint16) 0x0040; // unknown 2.3.0, different values data << (uint32) (*itr)->messageID; // Message ID diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 651ea7f41fb..bf33d96fcc0 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -192,3 +192,42 @@ bool Database::DirectPExecute(const char * format,...) return DirectExecute(szQuery); } +bool Database::CheckRequiredField( char const* table_name, char const* required_name ) +{ + // check required field + QueryResult* result = PQuery("SELECT %s FROM %s LIMIT 1",required_name,table_name); + if(result) + { + delete result; + return true; + } + + // check fail, prepare readabale error message + + // search current required_* field in DB + QueryNamedResult* result2 = PQueryNamed("SELECT * FROM %s LIMIT 1",table_name); + if(result2) + { + QueryFieldNames const& namesMap = result2->GetFieldNames(); + std::string reqName; + for(QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr) + { + if(itr->substr(0,9)=="required_") + { + reqName = *itr; + break; + } + } + + delete result; + + if(!reqName.empty()) + { + sLog.outErrorDb("Table `%s` have field `%s` but expected `%s`! Not all sql updates applied?",table_name,reqName.c_str(),required_name); + return false; + } + } + + sLog.outErrorDb("Table `%s` not have required_* field but expected `%s`! Not all sql updates applied?",table_name,required_name); + return false; +} diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index c7390d08a1b..a11c8e9a31f 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -131,6 +131,7 @@ class TRINITY_DLL_SPEC Database // sets the result queue of the current thread, be careful what thread you call this from void SetResultQueue(SqlResultQueue * queue); + bool CheckRequiredField(char const* table_name, char const* required_name); private: bool m_logSQL; std::string m_logsDir; |