WorldPacket * Mailbox::MailboxListingPacket() { WorldPacket * data = new WorldPacket(SMSG_MAIL_LIST_RESULT, 500); MessageMap::iterator itr; uint32 realcount = 0; uint32 count = 0; uint32 t = (uint32)UNIXTIME; *data << uint32(0); // realcount - this can be used to tell the client we have more mail than that fits into this packet *data << uint8(0); // size placeholder for(itr = Messages.begin(); itr != Messages.end(); itr++) { if(count >= 50) { ++realcount; continue; } if(AddMessageToListingPacket(*data, &itr->second)) { ++count; ++realcount; } } data->put<uint32>(0, realcount); data->put<uint8>(4, count); // do cleanup on request mail //CleanupExpiredMessages(); return data; }
WorldPacket * Mailbox::MailboxListingPacket() { WorldPacket * data = new WorldPacket(SMSG_MAIL_LIST_RESULT, 500); MessageMap::iterator itr; uint32 count = 0; uint32 t = (uint32)UNIXTIME; *data << uint8(0); // size placeholder for(itr = Messages.begin(); itr != Messages.end(); ++itr) { if(AddMessageToListingPacket(*data, &itr->second)) ++count; if(count == 25) break; } const_cast<uint8*>(data->contents())[0] = count; // do cleanup on request mail // CleanupExpiredMessages(); return data; }