aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/dcc
diff options
context:
space:
mode:
authorGravatar Fabio Bas2008-07-13 18:35:12 +0000
committerGravatar Fabio Bas2008-07-13 18:35:12 +0000
commita19e69058ca7bb27715420d830fea9e4c75257fb (patch)
tree77f4b492aac4598c3ced66806ecb0c9ece41cd0c /src/modules/dcc
parentscroll the ircview during a selection when the mouse reach borders; partially... (diff)
downloadKVIrc-a19e69058ca7bb27715420d830fea9e4c75257fb.tar.gz
KVIrc-a19e69058ca7bb27715420d830fea9e4c75257fb.tar.bz2
KVIrc-a19e69058ca7bb27715420d830fea9e4c75257fb.zip
fixed not-working dcc (missing ctcp) on 4.0. Probably fixes #173 too
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2067 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/dcc')
-rw-r--r--src/modules/dcc/marshal.cpp54
-rw-r--r--src/modules/dcc/marshal.h2
-rw-r--r--src/modules/dcc/send.cpp1
3 files changed, 6 insertions, 51 deletions
diff --git a/src/modules/dcc/marshal.cpp b/src/modules/dcc/marshal.cpp
index 5f6aa6b3b..628889e45 100644
--- a/src/modules/dcc/marshal.cpp
+++ b/src/modules/dcc/marshal.cpp
@@ -33,6 +33,7 @@
#include <stdlib.h> //for exit()
+#include <QTimer>
KviDccMarshal::KviDccMarshal(KviDccMarshalOutputContext * ctx)
: QObject(0)
@@ -40,7 +41,6 @@ KviDccMarshal::KviDccMarshal(KviDccMarshalOutputContext * ctx)
setObjectName("dcc_marshal");
m_pSn = 0;
m_fd = KVI_INVALID_SOCKET;
- m_pTimeoutTimer = 0;
m_bIPv6 = false;
m_pOutputContext = ctx;
#ifdef COMPILE_SSL_SUPPORT
@@ -94,11 +94,6 @@ void KviDccMarshal::reset()
m_pSSL = 0;
}
#endif
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
m_bIPv6 = false;
}
@@ -118,25 +113,13 @@ int KviDccMarshal::dccListen(const QString &ip,const QString &port,bool bUseTime
#else
if(bUseSSL)return KviError_noSSLSupport;
#endif
-
- if(m_pTimeoutTimer)delete m_pTimeoutTimer;
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(doListen()));
-// m_pTimeoutTimer->start(100,true);
- m_pTimeoutTimer->setInterval(199);
- m_pTimeoutTimer->setSingleShot(true);
+ QTimer::singleShot(100, this, SLOT(doListen()));
return KviError_success;
}
void KviDccMarshal::doListen()
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
// Check the address type
if(!kvi_isValidStringIp(m_szIp.toUtf8().data()))
{
@@ -284,13 +267,7 @@ void KviDccMarshal::doListen()
KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5;
if(m_bUseTimeout)
- {
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut()));
- //m_pTimeoutTimer->start(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000,true);
- m_pTimeoutTimer->setInterval(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000);
- m_pTimeoutTimer->setSingleShot(true);
- }
+ QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut()));
// and wait for connect
emit inProgress();
@@ -311,23 +288,12 @@ int KviDccMarshal::dccConnect(const char * ip,const char * port,bool bUseTimeout
if(bUseSSL)return KviError_noSSLSupport;
#endif
- if(m_pTimeoutTimer)delete m_pTimeoutTimer;
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(doConnect()));
-// m_pTimeoutTimer->start(100,true);
- m_pTimeoutTimer->setInterval(100);
- m_pTimeoutTimer->setSingleShot(true);
+ QTimer::singleShot(100, this, SLOT(doConnect()));
return KviError_success;
}
void KviDccMarshal::doConnect()
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
// Check the address type
if(!kvi_isValidStringIp(m_szIp.toUtf8().data()))
{
@@ -425,11 +391,7 @@ void KviDccMarshal::doConnect()
KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5;
if(m_bUseTimeout)
- {
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut()));
- m_pTimeoutTimer->start(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000,true);
- }
+ QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut()));
// and wait for connect
emit inProgress();
@@ -438,12 +400,6 @@ void KviDccMarshal::doConnect()
void KviDccMarshal::snActivated(int)
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
#ifdef COMPILE_IPV6_SUPPORT
struct sockaddr_in6 hostSockAddr6;
#endif
diff --git a/src/modules/dcc/marshal.h b/src/modules/dcc/marshal.h
index 9470a7862..946a531e8 100644
--- a/src/modules/dcc/marshal.h
+++ b/src/modules/dcc/marshal.h
@@ -28,7 +28,6 @@
#include <QObject>
#include <QSocketNotifier>
-#include <QTimer>
class KviWindow;
class KviDccMarshal;
@@ -68,7 +67,6 @@ protected:
// internals
kvi_socket_t m_fd; // socket
QSocketNotifier * m_pSn;
- QTimer * m_pTimeoutTimer;
bool m_bUseTimeout;
#ifdef COMPILE_SSL_SUPPORT
KviSSL * m_pSSL;
diff --git a/src/modules/dcc/send.cpp b/src/modules/dcc/send.cpp
index aa9a001be..180b62999 100644
--- a/src/modules/dcc/send.cpp
+++ b/src/modules/dcc/send.cpp
@@ -68,6 +68,7 @@
#include <QPushButton>
#include <QEvent>
#include <QCloseEvent>
+#include <QTimer>
#define INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_MSECS 3000
#define INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS 3