author | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
commit | 8aaae9e3eca7853e9c693d2401f721d75209acf7 (patch) (unidiff) | |
tree | 6f700d154fac8510b322242496604d0ad7589377 /noncore/net/opieirc/dcctransfer.cpp | |
parent | 875b3b63624308f4e50f82e17db27edeb9609d6c (diff) | |
download | opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.zip opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.tar.gz opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.tar.bz2 |
Added DCC receive support
Diffstat (limited to 'noncore/net/opieirc/dcctransfer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/dcctransfer.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/noncore/net/opieirc/dcctransfer.cpp b/noncore/net/opieirc/dcctransfer.cpp new file mode 100644 index 0000000..cfa9f74 --- a/dev/null +++ b/noncore/net/opieirc/dcctransfer.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | #include <qsocket.h> | ||
2 | #include <qfile.h> | ||
3 | |||
4 | #include "dcctransfer.h" | ||
5 | |||
6 | |||
7 | DCCTransfer::DCCTransfer(Q_UINT32 ip4Addr, Q_UINT16 port, const QString &filename, unsigned int size) | ||
8 | : m_socket(new QSocket), m_file(new QFile), m_bufSize(4096), m_buffer(new char[m_bufSize]), | ||
9 | m_ip4Addr(ip4Addr), m_port(port), m_totalSize(size), m_processedSize(0) | ||
10 | { | ||
11 | m_file->setName(filename); | ||
12 | } | ||
13 | |||
14 | DCCTransfer::~DCCTransfer() | ||
15 | { | ||
16 | if(m_socket) | ||
17 | delete m_socket; | ||
18 | if(m_file) { | ||
19 | m_file->close(); | ||
20 | delete m_file; | ||
21 | } | ||
22 | if(m_buffer) | ||
23 | delete []m_buffer; | ||
24 | } | ||
25 | |||
26 | |||
27 | void DCCTransfer::cancel() | ||
28 | { | ||
29 | if(m_socket) | ||
30 | m_socket->close(); | ||
31 | |||
32 | emit(finished(DCCTransfer::SelfAborted)); | ||
33 | } | ||
34 | |||
35 | QString DCCTransfer::filename() | ||
36 | { | ||
37 | if(!m_file) | ||
38 | return QString::null; | ||
39 | |||
40 | return m_file->name().mid(m_file->name().findRev('/') + 1); | ||
41 | } | ||