-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetransfertask.h
92 lines (70 loc) · 2.04 KB
/
filetransfertask.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef FILETRANSFERTASK_H
#define FILETRANSFERTASK_H
#include <QObject>
#include "mra/filetransferinfo.h"
#include "mra/mraprotocolv123.h"
class MrimAccount;
class MrimContact;
namespace Kopete {
class Transfer;
class FileTransferInfo;
}
QT_BEGIN_NAMESPACE
class QTcpSocket;
class QByteArray;
class QString;
QT_END_NAMESPACE
class FileTransferTask : public QObject, public qtmra::IFileTransferInfo
{
Q_OBJECT
public:
enum Direction {
Incoming,
Outgoing
};
explicit FileTransferTask(MrimAccount *account,
MrimContact *contact,
QStringList fileNames,
Direction dir,
const TransferRequestInfo *info,
QObject *parent = 0);
virtual ~FileTransferTask();
void run();
QString getContact();
QList<QPair<QString, quint64> > getFiles();
quint64 getFilesSize();
int getSessionId();
QString getHostAndPort();
QString getAccountId();
void cancel();
void tryThisHost(const QString &hosts);
void useThisProxy(const QString &hosts, const QByteArray &proxyKey);
signals:
void transferComplete();
void transferFailed();
void bytesSent(uint);
public slots:
void slotIncommingData();
void discardClient();
void slotIncomingConnection();
void slotTransferAccepted(Kopete::Transfer*transfer, const QString &filePath);
void slotTransferRefused(const Kopete::FileTransferInfo &fileTransferInfo);
void slotBytesProcessed(qint64 bytes);
void slotCancel();
private:
class Private;
Private *d;
void finishTransfer(bool succesful);
void openServer();
void openSocket(const TransferRequestInfo *info);
void sendHello();
void commandHello();
void commandGetFile(const QString &filename);
void dataReceived(QByteArray &data);
QString getFirstFilename();
QString getNextFileName();
QString filePathByFilename(const QString &filename);
void nextFile(const QString &filename);
void proxyNegotiate(const QByteArray &proxyKey);
};
#endif // FILETRANSFERTASK_H