diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-05-07 15:52:28 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-05-07 15:52:28 +0000 |
commit | fb2739625f4424488433e4edc53082e452e610fa (patch) | |
tree | a76d1be3328c018150206d241cfda30621b61a14 /protocols/Tox/src/tox_transfer.h | |
parent | 7bea1db1766147e4294f92c55dc94f247f7ff0e1 (diff) |
Tox: some refactoring
git-svn-id: http://svn.miranda-ng.org/main/trunk@13474 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_transfer.h')
-rw-r--r-- | protocols/Tox/src/tox_transfer.h | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 2ac2726b9d..b8511779f3 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -1,32 +1,18 @@ #ifndef _TOX_TRANSFERS_H_
#define _TOX_TRANSFERS_H_
-enum FILE_TRANSFER_STATUS
-{
- NONE,
- STARTED,
- PAUSED,
- BROKEN,
- FAILED,
- CANCELED,
- FINISHED,
- DESTROYED
-};
-
struct FileTransferParam
{
PROTOFILETRANSFERSTATUS pfts;
- FILE_TRANSFER_STATUS status;
FILE *hFile;
uint32_t friendNumber;
uint32_t fileNumber;
uint64_t transferNumber;
- bool isAvatar;
+ TOX_FILE_KIND transferType;
FileTransferParam(uint32_t friendNumber, uint32_t fileNumber, const TCHAR *fileName, uint64_t fileSize)
{
- status = NONE;
hFile = NULL;
this->friendNumber = friendNumber;
this->fileNumber = fileNumber;
@@ -43,7 +29,7 @@ struct FileTransferParam pfts.currentFileNumber = 0;
pfts.tszWorkingDir = NULL;
- isAvatar = false;
+ transferType = TOX_FILE_KIND_DATA;
}
bool OpenFile(const TCHAR *mode)
@@ -64,7 +50,6 @@ struct FileTransferParam ~FileTransferParam()
{
- status = DESTROYED;
if (pfts.tszWorkingDir != NULL)
{
mir_free(pfts.tszWorkingDir);
@@ -79,6 +64,17 @@ struct FileTransferParam }
};
+struct AvatarTransferParam : public FileTransferParam
+{
+ uint8_t hash[TOX_HASH_LENGTH];
+
+ AvatarTransferParam(uint32_t friendNumber, uint32_t fileNumber, const TCHAR *fileName, uint64_t fileSize)
+ : FileTransferParam(friendNumber, fileNumber, NULL, fileSize)
+ {
+ transferType = TOX_FILE_KIND_AVATAR;
+ }
+};
+
class CTransferList
{
private:
@@ -119,17 +115,6 @@ public: return NULL;
}
- void Remove(uint32_t friendNumber, uint32_t fileNumber)
- {
- int64_t transferNumber = (((int64_t)friendNumber) << 32) | ((int64_t)fileNumber);
- if (transfers.find(transferNumber) != transfers.end())
- {
- FileTransferParam *transfer = transfers.at(transferNumber);
- transfers.erase(transferNumber);
- delete transfer;
- }
- }
-
void Remove(FileTransferParam *transfer)
{
if (transfers.find(transfer->transferNumber) != transfers.end())
|