More preparation towards transferring avatars.

This commit is contained in:
lotodore
2007-10-05 14:23:36 +00:00
parent 90bd87d776
commit 5d974a6450
6 changed files with 228 additions and 1 deletions
+13
View File
@@ -24,6 +24,14 @@
#include <core/crypthelper.h>
#include <map>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#define MAX_AVATAR_FILE_SIZE 30720
struct AvatarFileState;
class NetPacket;
class AvatarManager
{
public:
@@ -33,6 +41,11 @@ public:
bool Init(const std::string &dataDir, const std::string &cacheDir);
boost::shared_ptr<AvatarFileState> OpenAvatarFileForChunkRead(const std::string &fileName, unsigned &outFileSize);
unsigned ChunkReadAvatarFile(boost::shared_ptr<AvatarFileState> fileState, unsigned char *data, unsigned chunkSize);
bool SendAvatarFile(const std::string &fileName, unsigned requestId, boost::function<void (boost::shared_ptr<NetPacket>)> sender);
bool GetHashForAvatar(const std::string &fileName, MD5Buf &md5buf);
bool GetAvatarFileName(const MD5Buf &md5buf, std::string &fileName) const;
bool StoreAvatarInCache(const MD5Buf &md5buf, const std::string &fileExtension, const unsigned char *data, unsigned size);