1// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
2//
3// Copyright (C) 2004 Grzegorz Jaskiewicz <gj at pointblue.com.pl>
4//
5// gadudcctransaction.cpp
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public License
9// as published by the Free Software Foundation; either version 2
10// of the License, or (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20// 02110-1301, USA.
21
22
23#ifndef GADUDCCTRANS_H
24#define GADUDCCTRANS_H
25
26#include <qobject.h>
27#include <qfile.h>
28
29class QSocketNotifier;
30class gg_dcc;
31class GaduContact;
32namespace Kopete { class Transfer; }
33namespace Kopete { class FileTransferInfo; }
34class GaduDCC;
35
36class GaduDCCTransaction: QObject {
37 Q_OBJECT
38public:
39 explicit GaduDCCTransaction( GaduDCC* );
40 ~GaduDCCTransaction();
41
42 bool setupIncoming( const unsigned int, GaduContact* );
43 bool setupIncoming( gg_dcc* );
44 bool setupOutgoing( GaduContact*, QString& );
45 unsigned int recvUIN();
46 unsigned int peerUIN();
47
48public slots:
49
50signals:
51
52protected:
53
54protected slots:
55
56private slots:
57 void watcher();
58 void slotIncomingTransferAccepted ( Kopete::Transfer*, const QString& );
59 void slotTransferRefused ( const Kopete::FileTransferInfo& );
60 void slotTransferResult();
61
62private:
63 void enableNotifiers( int );
64 void disableNotifiers();
65 void checkDescriptor();
66 void closeDCC();
67 void destroyNotifiers();
68 void createNotifiers( bool );
69 void askIncommingTransfer();
70
71 gg_dcc* dccSock_;
72
73 QSocketNotifier* read_;
74 QSocketNotifier* write_;
75
76 GaduContact* contact;
77
78 Kopete::Transfer* transfer_;
79 long transferId_;
80 QFile localFile_;
81 int peer;
82 unsigned int incoming;
83 GaduDCC* gaduDCC_;
84};
85
86#endif
87