summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabberfiletransfer.h
blob: 01ba99e145707e8a47da2b8305b93de4851967cf (plain)
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
 /*
  * jabberfiletransfer.h
  *
  * Copyright (c) 2004 by Till Gerken <till@tantalo.net>
  *
  * Kopete    (c) by the Kopete developers  <kopete-devel@kde.org>
  *
  * *************************************************************************
  * *                                                                       *
  * * This program is free software; you can redistribute it and/or modify  *
  * * it under the terms of the GNU General Public License as published by  *
  * * the Free Software Foundation; either version 2 of the License, or     *
  * * (at your option) any later version.                                   *
  * *                                                                       *
  * *************************************************************************
  */

#ifndef JABBERFILETRANSFER_H
#define JABBERFILETRANSFER_H

#include <qobject.h>
#include <filetransfer.h>

class QString;
class JabberAccount;
namespace Kopete { class Transfer; }
namespace Kopete { class FileTransferInfo; }
class JabberBaseContact;

class JabberFileTransfer : public QObject
{

Q_OBJECT

public:
	/**
	 * Constructor for an incoming transfer
	 */
	JabberFileTransfer ( JabberAccount *account, XMPP::FileTransfer *incomingTransfer );

	/**
	 * Constructor for an outgoing transfer
	 */
	JabberFileTransfer ( JabberAccount *account, JabberBaseContact *contact, const QString &file );

	~JabberFileTransfer ();

private slots:
	void slotIncomingTransferAccepted ( Kopete::Transfer *transfer, const QString &fileName );
	void slotTransferRefused ( const Kopete::FileTransferInfo &transfer );
	void slotTransferResult ();
	void slotTransferError ( int errorCode );

	void slotOutgoingConnected ();
	void slotOutgoingBytesWritten ( int nrWritten );

	void slotIncomingDataReady ( const QByteArray &data );

private:
	void initializeVariables ();

	JabberAccount *mAccount;
	XMPP::FileTransfer *mXMPPTransfer;
	Kopete::Transfer *mKopeteTransfer;
	QFile mLocalFile;
	int mTransferId;
	Q_LLONG mBytesTransferred;
	Q_LLONG mBytesToTransfer;

};

#endif

// vim: set noet ts=4 sts=4 tw=4: